slab / quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility
https://quilljs.com
BSD 3-Clause "New" or "Revised" License
43.34k stars 3.37k forks source link

Shift + Enter Keyboard Shortcut Not Working in Quill 2.0.2 #4248

Open unknown-user-github opened 3 months ago

unknown-user-github commented 3 months ago

Hi Quill Team,

I am currently using Quill 2.0.2 on Windows 10 with Firefox 126.0.1. I encountered an issue with the "Shift + Enter" keyboard shortcut: it does not seem to work as expected. Specifically, when I press "Shift + Enter" while writing text in the editor, it always creates a new paragraph (

) instead of inserting a line break (
).

Here is a snippet of my current implementation:

var quill = new Quill('#editor', {
  theme: 'snow'
});

quill.keyboard.addBinding({
  key: 13,  // Enter key
  shiftKey: true
}, function(range, context) {
  quill.insertText(range.index, '\n');
  quill.setSelection(range.index + 1);
});

Could you help me understand what might be going wrong?

kozi commented 3 months ago

grafik https://quilljs.com/docs/modules/keyboard#configuration

lutzissler commented 3 months ago

Isn’t this more about the fact that Quill doesn’t support line breaks (<br> tags) as any \n will be recognized as a new ‘row’ in Parchment?

dstj commented 2 weeks ago

I found #2872. This appears to be a long standing issue. Quite unfortunate, that was the last piece of the puzzle to migrate away from CKEditor5. :/

lutzissler commented 2 weeks ago

Try CodeMirror…

dstj commented 2 weeks ago

@lutzissler Thanks, but CodeMirror doesn't appear to have a toolbar for Bold, List, Headers, etc. It's specialized for code output. That's not my use case.

lutzissler commented 2 weeks ago

Sorry, meant the sister project, ProseMirror.

kozi commented 2 weeks ago

Is there any similar ProseMirror (or tiptap) based OpenSource solution?