Page MenuHomePhabricator

VisualEditor: Deletion across a header caused it to remain without WS, leading Parsoid to output "==<nowiki/>=="
Closed, ResolvedPublic1 Estimated Story Points

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:58 AM
bzimport set Reference to bz50100.
  • Bug 50313 has been marked as a duplicate of this bug. ***

*** Bug 51417 has been marked as a duplicate of this bug. ***

I'm not sure we should be deleting empty headings. The user may want to delete all the contents of a heading and replace it (or select-all then type, which would perform the same operations internally).

More generally we don't delete paragraphs when they are empty, unless the user presses backspace again, so doing so for just headings would be a confusing user experience.

Perhaps a solution would be for Parsoid to strip empty blocks (provided they weren't that way to begin with)?

Or we have a system for flagging up formatting irregularities (e.g. markers in the margin), which could also flag up other violations of formatting conventions (e.g. double linebreaks).

(In reply to comment #3)

I'm not sure we should be deleting empty headings. The user may want to
delete all the contents of a heading and replace it (or select-all then type,
which would perform the same operations internally).

Oh, yes, this was meant to be on save, rather than as they edit.

Perhaps a solution would be for Parsoid to strip empty blocks (provided they
weren't that way to begin with)?

That could also work, but feels a bit clunky; I think Parsoid should expect users to send it the HTML they actually want saved, and that it's up to clients to encourage users to indeed create such HTML.

  • Bug 51829 has been marked as a duplicate of this bug. ***

Speaking as an end-user, I spent quite some time trying to figure out how to delete a heading. It was quite confusing. Bug 51829 (marked as a duplicate) describes my attempts.

VE's behavior in this regard is the opposite of (say) MS Word's. In Word, if you highlight one character beyond the heading and press Delete, you remove the heading. In VE, you have to highlight an invisible area *preceding* the heading. This is not intuitive.

Since 51829 is now marked as a dupe,
should we also discuss here an issue that Dan reported as well - VE turning the next paragraph into a heading,
or that "when pressing delete on an empty heading line, if there is a template such as {{main}} on the next line, it is unexpectedly deleted", as user:WS states on enwp?

<< Often, when an editor tries to remove (or accidentally removes) a section header, the result in VE is something like this: http://en.wikipedia.org/w/index.php?title=%C3%87ank%C4%B1r%C4%B1_Province&diff=567375871&oldid=542107518 . This is seldom (if ever) the intention, can VE be coded to simply remove the section header in these cases? Fram (talk) 09:32, 6 August 2013 (UTC) >>

This editor http://en.wikipedia.org/w/index.php?title=Pound_%28mass%29&diff=569770089&oldid=569255959 removed the whole section. It could not possibly have been their intention to leave behind an empty heading line.

en.wp user 28bytes comments:
There was an unneeded section, so I selected the section, pressed "delete" and saved. VE did this [1]; I expected it to do this. [2]

1: https://en.wikipedia.org/w/index.php?title=Degeneracy&diff=prev&oldid=569795975
2: https://en.wikipedia.org/w/index.php?title=Degeneracy&diff=569796007&oldid=567105149

Change 162310 had a related patch set uploaded by Jforrester:
MWHeading: Don't put self in output if contents are blank or whitespace

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

Change 162310 had a related patch set uploaded (by Jforrester):
MWHeading: Don't put self in output if contents are blank or whitespace

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

Patch-For-Review

Change 162310 merged by jenkins-bot:
For empty / whitespace-only headings, output <p> instead of <h#>

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

If I understand correctly, the fix was deployed as part of version 1.25wmf23, which hasn't arrived to Wikipedias yet. It'll be deployed there tomorrow (April 1).