Improve preformated text format for multi-lines usage
Open, Stalled, Needs TriagePublic

Description

In Visual Editor, Usage of 'preformated' text format is not easy for creating a multi-lines block :

1st case :
Given cursor is in a preformated text
When we type 'Enter' key

Expected Result :
Then a new line is added in the same bloc of preformated text

Actual result :
Then a new bloc of preformated text is created for the new line

Note : The expected result is reached when we type 'Shift + Enter' but we should no need to use the shift key

2nd case :
Given cursor is at the end of a preformated block, (especially on a new empty line)
When we click on 'paragraph' format

Expected result :
Then the previous preformated bloc should remain as preformated bloc
And an a new paragraph should be created with cursor in it

Actual result :
Then all the previous preformated block is converted to a paragraph block

3rd case, to be discussed
Given we select a preformated text block with multiple lines
When we click on 'paragraph' format

Expected Result :
Then the block is converted into many paragraph blocks (one for each line), to conserve the display of the multiple lines

Actual result :
Then all the block is converted in one paragraph, on a single line, and a char 'Return' is added to split the old differents lines

Note : in the reverse way, when we select multiple paragraph lines and convert them to preformated text, it should create only one block of preformated text, with multiples lines.

Pyro853 created this task.Feb 8 2017, 10:05 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 8 2017, 10:05 AM
Jdforrester-WMF changed the task status from Open to Stalled.Feb 14 2017, 8:12 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Use case 1 is T60773: VisualEditor: Adding newlines at start/end of preformatted text is broken, I think?

I fundamentally disagree with your use case 2. Changing the formatting at the position of the current cursor changes the current node. In the edge case of being a blank line at the end this is more confusing, but I think we should instead make false-returns (currently, via shift-enter) and split nodes (currently, via enter) more different instead (so false-returns work differently), by having multiple lines each treated the same. This would fix your use case when on its own line at the end.

I think use case 3 is the same behaviour (but the inverse way around) for T74706: VisualEditor: When applying the <pre> formatting to multiple paragraphs, make them instead a single <pre> with newlines between the paragraphs – does that seem right?

Hi,
In use case 1, this is not the ticket you mention. Here, I suggest to remove the need to use the Shift key to add new lines in preformated text. This is not intiutive, nor easy to use for new users.
An other use case is the copy-paste a block content, with the current VE, I didn't find a way to avoid redoing every new line with the Shift+enter in the pasted content.

Use case 2 is due to a side effect of the use case 1 : if you simply do every Enter key as a Shift+enter, then it is not possible to get out of a preformatted text at the end of the editor field, without removing the entire block.
Because if Enter key do not create a new block, but a new line in block, then to change the format of the new line, you should click on 'paragraph' format, but currently it changes all the block, so you cannot create a new one.

Case 3 is indeed the same than T74706. I didn't found it before create this one.