Quill: Embeds/BlockEmbeds with Attributes using insertEmbed

Created on 16 Nov 2016  路  2Comments  路  Source: quilljs/quill

Hi,

We're trying to create a couple custom formats that require multiple attributes for them to be useful.

For instance, imagine we wanted to change the way the Image embed works to be able to specify a particular size (or alt text) at the time of creation. We can't do this with insertEmbed because the value argument is expected to be a string, and there is no attributes argument.

What would be the correct way of instantiating an embed that has associated attributes? Would I just generate my own Delta and use updateContents instead of doing insertEmbed?

Would love some guidance, thanks!

Most helpful comment

The value argument for insertEmbed can be any type. But the default Image blot understands its value to be a string. If you create your own blot or extend an existing one, you do not have to a use a string as the value.

For size specifically, the Image blot actually understands width and height: http://codepen.io/quill/pen/VmbKdm

All 2 comments

The value argument for insertEmbed can be any type. But the default Image blot understands its value to be a string. If you create your own blot or extend an existing one, you do not have to a use a string as the value.

For size specifically, the Image blot actually understands width and height: http://codepen.io/quill/pen/VmbKdm

@jhchen thanks for the confirmation on this. Makes total sense.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kivylius picture Kivylius  路  3Comments

lustoykov picture lustoykov  路  3Comments

ouhman picture ouhman  路  3Comments

visore picture visore  路  3Comments

markstewie picture markstewie  路  3Comments