Page MenuHomePhabricator

Visual editor: issues with removing leading space pre blocks
Closed, ResolvedPublic1 Estimated Story Points

Description

When a page with blocks of pre-formatted text that use the leading space in wikitaxt is edited in Visual Editor there are various issues trying to remove the pre-formatted blocks. https://en.wikipedia.org/w/index.php?title=User:Thryduulf/sandbox&oldid=565085889 can be used for testing.

  • It is not possible to delete a block on the first line of a page
  • When the pre-formatted block follows a mutli-line template, that template is deleted and the contents of the pre-formatted block becomes normal text on the line above where the template as, appended to any text that was already there.
  • When the pre-formatted block follows a normal line of text or a single line template the contents of the block are appended to the end of that line.
  • When the block follows indented text, the contents are appended to the last line of the indented block, even if that is a line that doesn't exist in wikitext (see T52995: VisualEditor: Backspace from (or deleteing down) into a DL breaks badly)
  • When the block follows an ordered or unordered list, the text is appended to the last line of the last item in the list

*When the block follows an image, the contents are appended to the image caption. This is probably depends on T53624: VisualEditor: Delete immediately before (or backspace after) a table cell moves text out of/into cell and so I would expect the same behaviour with tables, but I have not tested that.
*If the block follows another pre-formatted block, the contents gets appended to the end of that block.

In all cases this can be worked around by inserting and then backspacing a new line at the start of the block.

In cases when there is a line of normal text, a blank line or a single line template before the pre-formatted block then pressing delete at the end of that line appends the contents of the block at the cursor position as normal text.

The differing behaviour of single and multi-line templates may be related to T53708: VisualEditor: Inline templates don't wrap, assume width:100%, so break layout around floated items


Version: unspecified
Severity: normal

Details

Reference
bz51758

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:55 AM
bzimport set Reference to bz51758.

In this edit https://en.wikipedia.org/w/index.php?title=Morse_code&diff=571916446&oldid=571809074 the multiple leading spaces of a pre-formatted block have been removed while a totally unrelated line was being edited. The edit summary gives no indication that this was done deliberately so I am assuming this was the result of a bug in VisEd.

Aklapper set Security to None.
  • It is not possible to delete a block on the first line of a page

I managed after removing the text and then putting the cursor in front of the "Section 1" heading and pressing Backspace.

  • When the pre-formatted block follows a mutli-line template, that template is deleted and the contents of the pre-formatted block becomes normal text on the line above where the template as, appended to any text that was already there.

When exactly is "that template deleted"? Already by loading the page in VisualEditor? If so I fail to reproduce...

  • When the pre-formatted block follows a mutli-line template, that template is deleted and the contents of the pre-formatted block becomes normal text on the line above where the template as, appended to any text that was already there.

When exactly is "that template deleted"? Already by loading the page in VisualEditor? If so I fail to reproduce...

From memory, what I meant by that was that when you have a template that produces more than one line of text that is immediately followed by a block of pre-formatted text that uses the leading space method (i.e. not <pre> tags), removing the leading space also deletes the preceding template and the linebreak between the template and the paragraph above the template. i.e.

Paragraph one.
Template
[space]two

becomes

Paragraph one.two

when you try to delete [space]. I don't have time now to test whether this still happens.

I also see instances where a space pre was *added* while inserting an image around a paragraph. Or maybe that's T68628?

nshahquinn-wmf claimed this task.
nshahquinn-wmf subscribed.

Most of these workflows now work correctly. A few of them don't, so I've filed them separately as T106905 and T106902.

Jdforrester-WMF edited a custom field.