ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Shift Enter cannot be stopped/revoked

Open rplc opened this issue 1 year ago • 1 comments

📝 Provide detailed reproduction steps (if any)

  • Open https://jsfiddle.net/c7xopg0f/3/
  • Type "Foo", hit enter key -> enter key is correctly stopped
  • Continue typing "Bar", hit shift+enter -> shit+enter is not really stopped (model does not register any changes but the editing view inserts a br)
  • Continue typing "F" -> error
Uncaught CKEditorError: n is null
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-n is null
    Pu deletecontent.ts:81
    deleteContent model.ts:701
    decorate observablemixin.ts:277
    fire emittermixin.ts:241
    e observablemixin.ts:281
    execute inserttextcommand.ts:92
    _runPendingChanges model.ts:1109
    enqueueChange model.ts:349
    execute inserttextcommand.ts:85
    decorate observablemixin.ts:277
    fire emittermixin.ts:241
    e observablemixin.ts:281
    execute commandcollection.ts:73
    execute editor.ts:620
    init input.ts:166
    fire emittermixin.ts:241
    Va bubblingemittermixin.ts:207
    fire bubblingemittermixin.ts:118
    vw inserttextobserver.ts:84
    fire emittermixin.ts:241
    Va bubblingemittermixin.ts:207
    fire bubblingemittermixin.ts:118
    fire domeventobserver.ts:106
    onDomEvent inputobserver.ts:181
    observe domeventobserver.ts:82
    fire emittermixin.ts:241
    t emittermixin.ts:340
    attach emittermixin.ts:270
    _addEventListener emittermixin.ts:314
    listenTo emittermixin.ts:894
    listenTo emittermixin.ts:162
    listenTo emittermixin.ts:115
    listenTo emittermixin.ts:112
    observe domeventobserver.ts:80
    observe domeventobserver.ts:79
    attachDomRoot view.ts:322
    init inlineeditorui.ts:96
    create inlineeditor.ts:205
    promise callback*create/< inlineeditor.ts:205
    create inlineeditor.ts:194
    <anonymous>

✔️ Expected result

I would expect according to the doc codes (https://ckeditor.com/docs/ckeditor5/latest/api/module_engine_view_document-Document.html#event-enter) that enter and shift+enter are stopped and nothing happens when hitting enter or shift+enter. Same behaviour can be reproduced with the commented out section, using the beforeinput event.

❌ Actual result

Enter event is stopped, nothing happens, so far so good. Shift+Enter does not change anything in the model but the view contains an additional br. And when you continue typing in the new line an error is thrown.

📃 Other details

Tested in Chrome and Firefox.


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

rplc avatar Nov 28 '24 05:11 rplc

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

CKEditorBot avatar Nov 28 '25 23:11 CKEditorBot