Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13412 closed Bug (invalid)

Enter mode for shift+enter incorrect

Reported by: Szymon Cofalik Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc:

Description (last modified by Szymon Cofalik)

Steps to reproduce:

  1. Initialize CKEDITOR with those options:
    CKEDITOR.replace( 'editor1', {
    	extraPlugins: 'enterkey',
    	enterMode: CKEDITOR.ENTER_P,
    	shiftEnterMode: CKEDITOR.ENTER_DIV,
    	forceEnterMode: true
    });
    
  2. Write some text in the editor then try to break it with shift+enter.

Result: <p> has been inserted.
Expected result: <div> has been inserted.

The same bug occurs when you set

	enterMode: CKEDITOR.ENTER_DIV,
	shiftEnterMode: CKEDITOR.ENTER_P

Then <div> is inserted instead of <p>. It works fine only if one of options is CKEDITOR.ENTER_BR

You can test this on sample samples/plugins/enterkey/enterkey.html

Change History (7)

comment:1 Changed 4 years ago by Szymon Cofalik

Description: modified (diff)

comment:2 Changed 4 years ago by Szymon Cofalik

The bug was discussed in #11135 but it doesn't work even with forceEnterMode set to true

comment:3 Changed 4 years ago by Piotrek Koszuliński

IIRC there was a ticket about "forceShiftEnterMode", but I wouldn't like adding anything there. IMO the only valid enter mode is P (or NONE, but we don't support it) and the only valid shiftEnter mode is BR/P/NONE. Period. Other settings are not recommended and the fact that we added them in the past is one of the strongest complications in many algorithms. Without these settings editor would be significantly lighter and more stable.

Anyway, @j.swiderski: I leave the decision whether to confirm this ticket to you.

comment:4 Changed 4 years ago by Jakub Ś

Settings:

CKEDITOR.replace( 'editor1', {
	extraPlugins: 'enterkey',
	enterMode: CKEDITOR.ENTER_P,
	shiftEnterMode: CKEDITOR.ENTER_DIV,
	forceEnterMode: true //works the same with false!!!
});

Use Case 1:

  1. Insert the following code and make selection as shown <p>test^</p>
  2. Press Shift+Enter

Result: New div is created.

Use Case 2:

  1. Insert the following code and make selection as shown <p>te^st</p>
  2. Press Shift+Enter

Result: New P is created.

I know we don't have any "forceShiftEnterMode" but I see a little inconsistency here. @Reinmar before confirming this issue, could you tell me if there is any logical or technical (perhaps it couldn't have been done any other way) explanation behind this?

comment:5 Changed 4 years ago by Piotrek Koszuliński

Result: New P is created.

This isn't true - this isn't a new paragraph :) This paragraph which you have at the beginning is split into two parts. So it's just the second part of that paragraph.

The problem here is that setting one enter mode to P and the second to DIV makes no sense at all. It creates situations like this one where you have two conflicting settings. The only logically valid settings are:

  • P+BR
  • NONE+NONE
  • BR+BR (although, only in certain cases, where blocks are not allowed in the content at all!)
  • P+P or P+NONE

And that's it. DIV mode should never existed because DIVs can be nested and that creates awful edge cases. BR should be limited to secondary enter mode and blockless editors.

comment:6 Changed 4 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

This isn't true - this isn't a new paragraph :) This paragraph which you have at the beginning is split into two parts.

I haven't looked at it from that perspective :). I'm not sure any user would think - "hey I'm not creating new paragraph, I'm splitting it" :P. Anyway it makes sense to me...

Pros (for confirming it):

  • In order to create new div with text from paragraph user has to split it in two and the use Format dropdown. Although this is a solution to the problem, it isn't a fast way to do it.
  • Users may get confused with end result.

Cons (for confirming it):

  • This isn't very popular combination of Enters (otherwise we would have more issues about it) - there is no doubt about it. Using Div for Shift+Enter is very unusual and feels just weird. I think that MS Word and other editors of that type has learned users that if they want BR inserted (or line without spaces) they need to press Shift+Enter.
  • There is a way to achieve this result in the editor (mentioned in Pros - it isn't fast but it works). I will also add that such divs won't be needed very often. More popular would be using div container and paragraphs inside it.

I agree with @Reinmar - this is an edge case IMHO and I will mark it as invalid. We can always reopen this ticket if we get few comments saying that this "fix"is needed.

comment:7 Changed 4 years ago by Piotrek Koszuliński

I haven't looked at it from that perspective :). I'm not sure any user would think - "hey I'm not creating new paragraph, I'm splitting it" :P

I have no idea what user will think as well. Especially that some users understand what P/DIV are, some have no idea. And that's the reason why it should be kept as simple as possible - because it's absolutely confusing for everyone.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy