Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using <br> instead of using <p> #3065

Closed
conthub opened this issue Jun 15, 2020 · 12 comments
Closed

Using <br> instead of using <p> #3065

conthub opened this issue Jun 15, 2020 · 12 comments

Comments

@conthub
Copy link

conthub commented Jun 15, 2020

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

@IcyFoxe
Copy link

IcyFoxe commented Jun 15, 2020

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..

@conthub
Copy link
Author

conthub commented Jun 15, 2020

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.

@IcyFoxe
Copy link

IcyFoxe commented Jun 15, 2020

I see, well I can't help you with that. It will most likely require changing the source code.

@conthub
Copy link
Author

conthub commented Jun 15, 2020

I see that quilljs used to use DIV for blocks, instead of P. Then they switched to use P. As mentioned here:
#159 (comment)

@jhchen Is there a way to config quilljs instance to use DIVs instead of Ps as an optional feature?

Thank you

@ttypic
Copy link

ttypic commented Jun 18, 2020

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/

@ffxsam
Copy link

ffxsam commented Oct 29, 2020

@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.

@phongnguyenmaster
Copy link

i still got an issue with p tag
I would like to use br instead

@NikolaDojic
Copy link

Does anyone have a solution for this yet? It seems to be an important issue.

@muimota
Copy link

muimota commented Dec 21, 2023

Managed to use
following this example. Found it through this post

@kozi
Copy link

kozi commented Feb 12, 2024

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-bot
Copy link

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 🙏

@CharlieGreenman
Copy link

I created a new issue here: #4194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants