Support for shift + enter
I believe supporting shift + enter should be a a priority. If you want to use div, that's fine, but <div>text</div><div>text</div> should be output with an enter, and <div>text<br>text</div> with shift + enter.
This is a pretty technically costly feature to add to Quill so there'd have to be a large need from the community for it to become a priority.
Thanks for all of your work on quill.js!
I'm in full support of this and hope it can be prioritized. Inserting <br>s into line <div>s with shift + enter would help my company's content editors. We use line <div>s for denoting paragraphs, but they frequently need a way to just to do a break-line without denoting a separation of paragraphs. Inserting <br>s into line <div>s with shift + enter would achieve this perfectly.
Is there any current workaround to get the functionality I want? I've tried every hack I could think of to no avail.
:+1:
I have tried to change DEFAULT_BLOCK_TAG to <p> but realised that it has no sense without line breaks by shift+enter
Just wondering if there is anymore progress on this? In my editor I'm using the divs as a paragraph so having shift+editor would work great for newlines.
This is not currently being worked on as it still lacks a compelling real world use case.
From a user of an editor / word processor perspective, it's incredibly confusing to have two ways to have newlines, especially when one looks like two (<br> vs <p> with padding). I can see why a developer might find this convenient to have richer semantic organization as @davejachimiak mentions, but convenient is a long ways from a need. Furthermore Quill is a WYSIWYG editor, not an HTML editor, and having complete control over the HTML markup it generates is not a project goal.
So there is no way for the user to enter a newline if <div>s are treated as paragraphs?
A user inserts a newline by hitting enter. If the user hits enter again (leaving the new line blank), they have just created what most readers would consider a new paragraph.
But only if <div>s are not treated as paragraph (as in Quill's example). But in my case we are treating the <div>s as paragraphs (i.e. they have margin-bottom: 30px) as we don't want the user to have to press enter twice. The vast majority of the time they want paragraphs so that is our default, occasionally they want a new line which we currently can't provide them with Quill (we are actually using ReactQuill which wraps Quill).
Just thought I'll let you know my use case for it.
+1
a very useful feature!
+1
:+1:
We're building an internal document editor which should act similar to Word. This doesn't :(
@jbrooksuk It doesn't claim to act similar to word. Though, the next update and inclusion of Parchment may provide you with an experience closer to what you're hoping for.
It doesn't claim to act similar to word.
I know that :)
Using shift + enter in a document and bolding text across the two divs created by shift + enter causes the selected text to "jump" or simply doesn't bold the text. Is this a known bug in Quill? Removing the linebreak allows the user to unbold the text.
Console output:
The given range isn't in document.

![]()
@cydrobolt I'm assuming you've made some modification to add shift+enter? On the quilljs.com editor shift+enter is the same as enter but in either case bolding across the line does not error.
@jhchen : I can give you a real world use case. We are writing novels. When we are finished, we have to export the text somehow, so finally a designer can work on this and at least we get a book. The problem is, without shift-enter, everything becomes paragraph
. In the designers software, paragraphs will be formatted like for example text-indent: 30px. because every first line of a paragraph should be intented. But often a writer, doesn't want to have a new paragraph which is intented, but just a new line within the actual paragraph starting at the very left margin. By inserting two normal Returns for a real paragraph and only one for a newline, post production becomes much more complicated, since designers doesn't care about the content.
furtheron, I also have a css which says:
.ql-editor p {
text-indent: 30px;
}
to make reading easier. We are editing our whole books in one document( more then 400 pages when printed). But unfortunatly everything is a new paragraph. By the way, I hoped to get this result with
let Break = Quill.import('blots/break');
Quill.register(Break)
and define a keybord binding like: (here for Ctrl-Return)
linebreak: {
key: 13,
ctrlKey: true,
handler: function (range, context) {
this.quill.insertEmbed(range.index, 'break', true, 'user');
quill.setSelection(range.index + 1, Quill.sources.SILENT);
}
}
but can't get any result. But by th way, nevertheless, Quill is the best WYSIWYG Editor for creating huge docs, I have seen so far
This is an essential feature of any text editor, whether the output is html or books; there is a clear difference between paragraphs and line breaks, and a text editor not supporting both is severely limiting proper content handling.
I'd love to use Quill over other editors, but this is a deal breaker for us.
@tdolsen : as well as for us. but a found a nice workaround and with this we can live quite good:
javascript:
var Parchment = Quill.import('parchment');
var LineBreakClass = new Parchment.Attributor.Class('linebreak', 'linebreak', {
scope: Parchment.Scope.BLOCK
});
Quill.register('formats/linebreak', LineBreakClass);
then inside your keyboard handlers:
...
smartbreak: {
key: 13,
shiftKey: true,
handler: function (range, context) {
this.quill.setSelection(range.index,'silent');
this.quill.insertText(range.index, '\n', 'user')
this.quill.setSelection(range.index +1,'silent');
this.quill.format('linebreak', true,'user');
}
},
paragraph: {
key: 13,
handler: function (range, context) {
this.quill.setSelection(range.index,'silent');
this.quill.insertText(range.index, '\n', 'user')
this.quill.setSelection(range.index +1,'silent');
let f = this.quill.getFormat(range.index +1);
if(f.hasOwnProperty('linebreak')) {
delete(f.linebreak)
this.quill.removeFormat(range.index +1)
for(let key in f){
this.quill.formatText(range.index +1,key,f[key])
}
}
}
....
and finally css:
.ql-editor p {
text-indent: 30px;
margin-top: 10px;
}
p.linebreak-true {
text-indent: 0px;
margin-top: 0px;
}
this causes that shift-enter inserts a new line which is a <p< in quill, but it gets a class linebreak.
the css causes, that normal paragraphs appear with a line indent and a top margin, p.linebreak not. so the writer gets the right feeling.
when exporting quills content to a dektop wordprocessor, just handle the linebreak attribute as a normal linefeed and process all others as normal paragraphs.
hope this helps
@robert-boulanger: Very much. That should be a workable solution, until native support is added. Thanks!