-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Configurable block tag (div, paragraph) #228
Comments
I've had a crack at implementing a configurable block tag and along the way picking up on how Quill works. Whilst most of the changes are straight forward the Formatter and Normalizer have some logic that may conflict and require some attention. With my current limited depth of knowledge on all the moving parts in Quill I am not sure if there is any unintended consequences (tests aside) of making a change like this. @jhchen is there any "here be dragons" you can point me in the direction of to make sure that I can sort it out? The Normalizer class feels like one of them since it sits outside the scope of an editor instance making configs unavailable. I'll push my forked branch soon once I have gotten it a little further along. |
Right I think the major challenge is that the normalizer is not configurable. There are many benefits to turning it into a class and this needs to happen for a couple other bugs to be fixed such as #191. I'm hoping to get to this soon so it might work best for this feature to be added after the normalizer changes. |
+1 looking forward to this landing. |
👍 |
@jhchen what's the normalizer looking like? Are @alexeckermann or you working on the change to make this configurable? If not, perhaps I can help lift. We have Quill configured, but absolutely need content wrapped in I'd much rather help contribute than just hack this into a fork. Just don't want to double up on work. (And I have no context into this project/source so it would take me a while to get ramped up). Thanks! 🍐 |
This may be irrelevant for most, but I am using this editor in a CMS, and I have the following running before the content is saved to my database: // swap div tags with p
$value = str_replace('div>', 'p>', $value);
// remove the empty sections now
$value = str_replace('<p><br></p>', '', $value); This just runs each time I save my page. It works nicely at the moment. I am sure for more complicated code, this would not be as helpful. |
+1 for being able to use paragraphs instead of divs. By the way, thanks for a great editor! |
👍 |
1 similar comment
👍 |
I can't understand how this work: http://codepen.io/SaraVieira/pen/eaAcu |
They seem to either have their own fork or build that probably changed the |
Tnx! |
👍 |
Has no progress been made to make this a customizable option? Surely there should be some mapping for ALL tags to allow customization. I currently need to use paragraph tags instead of divs, in addition to some other changes. Its a bit discouraging to see that this hasn't been resolved yet. |
I'd also like to have this. I'm going to use something similar to @james2doyle 's solution for the time being, but I'd love to be able to have @jhchen I'm open to help get this working if you can point me in the right direction. |
👍 we're strongly considering using Quill in Simpla but non-standard content elements (eg: divs instead of ps) are a dealbreaker for inline editing. |
👍 need this changes too |
The default block tag in the 1.0 beta release is var Parchment = Quill.import('parchment');
var Block = Parchment.query('block');
Block.tagName = 'DIV';
// or class NewBlock extends Block {}; NewBlock.tagName = 'DIV';
Quill.register(Block /* or NewBlock */, true);
// Create your Quill editor like before
var quill = new Quill('#editor'); |
Hurray --- thanks! |
Thank you =) |
Any ideas on how to implement this solution in Typescript in an Angular 2 project? |
|
This approach does not work with multiple instances of Quill editor in the same page using different tagNames.
Both editors are using same last tagName='P'. |
After making DIV as a block tag I wanted to add SCRIPT tag inside DIV but I am only able to see DIV but not SCRIPT tag even it's same with other elements like SECTION , ARTICLE etc. when you try to embed them inside DIV they are not getting appended Can somebody help me.. ?? Thanks in advance |
I very important need to add custom div nodes with classes Yow I can make it? |
|
@saminlu @mdperez86 Hi guys, I'm currently facing the same issue, where I have multiple instances of Quill editor and I'd like to use in one instance and in the other. Have you found any way to reach that goal?
|
Whilst div tags are quite acceptable for most cases, there are some uses where paragraph tags are necessary over div's.
As an example: I work on an application that allows authors to write content for ePubs. For both logical structure and ePub rendering reasons we like to use paragraph tags.
From a very shallow inspection of the source it would appear this would involve changing references to the
dom.DEFAULT_BLOCK_TAG
variable with an option defined at initialisation.block_tag: 'p'
?The text was updated successfully, but these errors were encountered: