Page MenuHomePhabricator

Replace SyntaxHighlight's inspector with a dialog to avoid closing the inspector losing data
Closed, ResolvedPublic8 Estimated Story Points

Description

Bad bad bug: When editing/creating an article in VE, if I use "Insert code block", and enter some text, clicking outside of the form discards all the work I just did.

Event Timeline

Yurik raised the priority of this task from to High.
Yurik updated the task description. (Show Details)
Yurik added a project: VisualEditor.
Yurik subscribed.
Jdforrester-WMF renamed this task from Out-clicking during insertion deletes data to Click out of the SyntaxHighlight inspector closes the inspector, losing data.Sep 15 2015, 6:07 PM
Jdforrester-WMF closed this task as Declined.
Jdforrester-WMF claimed this task.
Jdforrester-WMF set Security to None.
Jdforrester-WMF subscribed.

This is by design – it's what makes it an inspector…

Yurik reopened this task as Open.EditedSep 15 2015, 9:53 PM

@Jdforrester-WMF, this can't be "by design", because it causes significant unexpected behavior and loss of data. If i am an editor, and while editing i insert a code block, and spent half an hour typing up the text inside that code block, I should NOT be able to accidentally delete all my work! I should NOT be able to accidentally discard it without warning by simply clicking outside of the box! This is not an acceptable or expected behavior of the editor!

This is the correct behaviour for an inspector which we probably shouldn't change (again). It is the correct behaviour for editing links, for example.

One solution would be to use dialogs for more complex nodes such as these, however then you woud lose the live preview.

Ultimately the syntax highligter should probably be a dialog which loads a code editor (Ace, CodeMirror, ...), removing the need for a preview (T49742).

Jdforrester-WMF renamed this task from Click out of the SyntaxHighlight inspector closes the inspector, losing data to Replace SyntaxHighlight's inspector with a dialog to avoid closing the inspector losing data.Sep 16 2015, 6:02 PM
Jdforrester-WMF lowered the priority of this task from High to Low.
Jdforrester-WMF added a project: Design.
Jdforrester-WMF edited a custom field.
Jdforrester-WMF moved this task from To Triage to Freezer on the VisualEditor board.

I think the ultimate premise here is incorrect -- from the user's perspective, anything that allows data changes, especially in a text field, should preserve the data at all costs. It sounds like "inspector" is something to view but not change the data - in which case it should never allow editing.

No, the act of clicking away from the inspector is dismissive, not constructive like clicking done. This behaviour is identical to google docs and other editors which use inspectors.

This is the correct behaviour for an inspector which we probably shouldn't change (again). It is the correct behaviour for editing links, for example.

I am not exactly sure here - when editing a link, i would guess the click out should save the change, especially if i was live-previewing it while typing.

@Esanders, I just looked, you are correct that gdocs does that - I was more used to the gmail - which has a dialog box and not an inspector for the link edits. I guess we should look at it as "one line" vs ("multi-line" or several "one liners"), and whenever there are more than a single line change possible, do it as a dialog

Change 247474 had a related patch set uploaded (by Esanders):
WIP Use Ace editor when available

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

Change 247567 had a related patch set uploaded (by Esanders):
Use dialog for editing block level syntax highlights

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

Change 247567 merged by jenkins-bot:
Use dialog for editing block level syntax highlights

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