Voice in the Desert
Voice in the Desert

Reputation: 33

Quill custom blots: how to make Quill accept "incoming" custom code

I'm using Quill in a project where I need make Quill "understands" some custom code when it initializes and when the editor's content is updated from the API.

To keep it symple: lets say I have a database where I have, for example, a field with this content:

<p>Text</p><hr>

On page loading, during Quill'a initialization, I need my Quill editor's container "accepts" this incoming code but Quill eliminates the <hr> tag.

Reading this guide (Cloning Medium with Parchment) I understood how to create a new Quill's blot and how to add a custom control button in the toolbar to insert the custom blot (lets say the <hr> tag) in my Quill's editor. Lets call this the "outcoming flow" which I think I get it.

Unfortunately If I save the updated content (lets say <p>Text></p><hr>) in the db, refreshing the page (I'm working with PHP) the <hr> tag is not kept but is "stripped away"... I'm reading Parchment documentation and I think I should make Parchment "accepts" the new blot (am I right?) but I'm not understanding how...

Here is a symple example: Custom line blot example. You can see the "insert line" button is working ("outcoming flow" ok) but on page loading the <hr> tag is stripped away ("incoming flow" not ok).

I hope the explanation is clear ^^ Thanks for anyone is going to help me... ^^

Upvotes: 2

Views: 578

Answers (0)

Related Questions