Page MenuHomePhabricator

VisualEditor: Can't add new paragraphs to the end of the page, if the last line is an empty section heading == <nowiki/> ==
Closed, ResolvedPublic

Description

Intention:
Add a new paragraph at the bottom of a page that ended in == <nowiki/> == (not counting the category after the empty section heading).

I was hoping that adding a new paragraph underneath the blank section heading would allow me to select, and therefore to remove, the blank section heading.

Steps to Reproduce:

  1. Edit a page that ends in a == <nowiki/> ==, like https://en.wikipedia.org/w/index.php?title=User:Whatamidoing_(WMF)/sandbox2&oldid=589158823
  1. Place the cursor in the empty section heading.
  1. Hit return.

Actual Results:
Pressing return adds blank paragraphs *above* the empty section heading.

If you type anything into the section heading, then it starts behaving normally.

Expected Results:
Doing the same thing for an empty (or non-empty) section heading anywhere else on the page adds new paragraphs *under* the empty section heading. Pressing return in a section heading should produce the same behavior everywhere on the page.

Reproducible: Always


Version: unspecified
Severity: enhancement

Details

Reference
bz59652

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:17 AM
bzimport set Reference to bz59652.

This is also reproducible with other block nodes, like preformatted text.

There's code in ve.ce.Surface#handleEnter to "If we're at the start/end of something that's not a paragraph, insert a paragraph before/after". The quirk is that it checks for the "at the start" case before checking the "at the end" case, and for empty elements both of these are true. Let's just flip the order.

Change 160215 had a related patch set uploaded by Bartosz Dziewoński:
ve.ce.Surface: Insert new paragraphs after empty nodes rather than before

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

Change 160215 merged by jenkins-bot:
ve.ce.Surface: Insert new paragraphs after empty nodes rather than before

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