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

saw picture saw  路  34Comments

scottfr picture scottfr  路  45Comments

che3vinci picture che3vinci  路  39Comments

sachinrekhi picture sachinrekhi  路  49Comments

sferoze picture sferoze  路  61Comments