quill
quill copied to clipboard
Using <br> instead of using <p>
Hello, Is there any way to configure quilljs to make use of BR instead of using P upon every time I hit ENTER key? In other words, not to use paragraphs, but BR instead. Thanks for your help
I'm only about to try this editor, hovever I stumbled across your question. Did you try pressing Shift + Enter to create a BR instead of P? That usually creates a break instead of a new paragraph in these kind of editors..
Yeah, but what I need is a forced replace. I need a quilljs instance only meant to create html for email sending, and for this purpose I need NOT to use paragraphs but to use BR exclusively. I need that every time I hit ENTER it creates a BR and not a P.
I see, well I can't help you with that. It will most likely require changing the source code.
I see that quilljs used to use DIV for blocks, instead of P. Then they switched to use P. As mentioned here: https://github.com/quilljs/quill/issues/159#issuecomment-49682445
@jhchen Is there a way to config quilljs instance to use DIVs instead of Ps as an optional feature?
Thank you
Is there a way to config quilljs instance to use DIVs instead of Ps as an optional feature?
yes, you can configure block blot and register it:
const Block = Quill.import('blots/block');
class DivBlock extends Block {}
DivBlock.tagName = 'DIV';
// true means we overwrite
Quill.register('blots/block', DivBlock, true);
working example: https://jsfiddle.net/n4efwxd9/
@ttypic Thank you for this. Forced P tags in rich editors are for monsters. And unfortunately, unlike many other rich editors, Quill doesn't support shift+enter to insert a BR tag.
i still got an issue with p tag I would like to use br instead
Does anyone have a solution for this yet? It seems to be an important issue.
Managed to use
following this example. Found it through this post
Is there any good&simple solution for the functionality SHIFT+ENTER --> <br>
.
In my opinion, this should be a standard functionality of a rich text editor!
Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide :pray:
I created a new issue here: https://github.com/quilljs/quill/issues/4194