Page MenuHomePhabricator

Deleting from an empty paragraph to the end of an inline node throws an exception
Closed, ResolvedPublic8 Estimated Story Points

Description

See https://en.wikipedia.org/wiki/File:VisualEditorTableCopyBugScreenshot.jpg for what the editor selected. See https://en.wikipedia.org/wiki/File:VisualEditorTableCopyBugScreenshot2.jpg (top) for what he got when he pasted it into the new place.

This was found on Chrome and Windows 7.

Also, if he used Ctrl-X to cut the table, he was unable to save his changes. Clicking on the Save button did nothing after that point. Ctrl-C to copy the table did not disable the Save button.


Version: unspecified
Severity: normal

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:46 AM
bzimport set Reference to bz70375.

Update:

To make this work, you have to select the table (just its own cells), without any text before and after.

If you select more than the table (text + table + more text), then the table formatting appears to be correct when pasted in VisualEditor, but isn't actually correct when it's saved. See https://en.wikipedia.org/w/index.php?oldid=624091874 for the saved version, and compare it to the same table in previous versions.

In addition to not being able to save after cutting and pasting, it's not possible to switch to source code editing.

The problem appears after the cutting, not after the pasting. Also, it's usually possible to switch to source editing. Consequently, this is only a lost-work bug for most people (anyone who doesn't know about or doesn't try switching to source.)

Minimal failure case in core to trigger the unbalanced delete which is causing this to happen:

<p></p>
<p>a<span rel="ve:Alien">b</span></p>

Select from the empty paragraph to after the b (range 1,6) and delete.

gerritadmin wrote:

Change 158662 had a related patch set uploaded by Esanders:
WIP Failing test case

https://gerrit.wikimedia.org/r/158662

Jdforrester-WMF renamed this task from VisualEditor: Deleting from an empty paragraph to the end of an inline node throws an exception to Deleting from an empty paragraph to the end of an inline node throws an exception.Nov 24 2014, 2:17 AM
Jdforrester-WMF set Security to None.

Change 158662 had a related patch set uploaded (by Catrope):
WIP Failing test case

https://gerrit.wikimedia.org/r/158662

Change 158662 merged by jenkins-bot:
Fix unbalanced transaction when removing to/from the edge of an inline node

https://gerrit.wikimedia.org/r/158662

Verified in beta - for general cases it's fixed: tables can be copy/cut, the table format is preserved - and Save button is properly activated and functioning.

However, in the issue refers to the particular table example( https://en.wikipedia.org/w/index.php?oldid=624091874 ) due to <ref name="Tuck_U"></ref> will throw a lot of hiccups:

 {| class="wikitable" style="font-size: 10pt; line-height: 11pt; margin-left: 2em; text-align: center; float: right"
! 
!
Winter
!
<nowiki> </nowiki>Spring 
!
Summer 
!
Autumn 
!
Winter
|-
!
1937
| 
| 
| 
| 
| bgcolor="#ccffff" |1
|-
!
1938
| 
| bgcolor="#ccffff" |2 
| bgcolor="#ccffff" |3 
| bgcolor="#ccffff" |4 
| bgcolor="#ccffff" |5
|-
!
1939
| 
| bgcolor="#ccffff" |6 
| bgcolor="#ccffff" |7 
| bgcolor="#ccffff" |8 
| bgcolor="#ccffff" |9
|-
!
1940
| 
| bgcolor="#ccffff" |10 
| bgcolor="#ccffff" |11 
| bgcolor="#ccffff" |12 
|
|-
!
1941
| bgcolor="#ccffff" |13 
| bgcolor="#ccffff" |14 
| 
| bgcolor="#ccffff" |15 
|
|-
!
1942
| 
| bgcolor="#ccffff" |16 
| 
| 
|
|-
| colspan="6" style="font-size: 8pt; text-align:left" |Issues of ''Tales of Wonder'', showing issue number.
Walter Gillings was editor throughout.<ref name="Tuck_U"></ref>
|}
<br>

Try to select, copy, and cut the above table:
Uncaught Error: Offset could not be translated to a DOM element...
Uncaught TypeError: Cannot read property 'isWrapped' of null...
Uncaught Error: offset was inside a handlesOwnChildren...
Uncaught Error: Invalid retain length, cannot retain backwards:...

In test2: selecting the above table and paste it will insert the following symbol.☢

Re-checked with 1.25wmf24 (rMW32a0b3fcf8c1). The fix works reasonably well - just make sure that the table is selected along with some text.