slab / parchment

Generalized state model for rich-text editors to interface with browser DOM
BSD 3-Clause "New" or "Revised" License
628 stars 143 forks source link

[Question] Is it possible to define how a blot is serialized ? #117

Open farhat-h opened 2 years ago

farhat-h commented 2 years ago

Context: I'm trying to define a custom inline embed blot to display something similar to repo shields. The way, I'm currently implementing it as an IMG tag and setting an alt attribute that has a description of the image. Is it possible to make the blot be serialized to the value of the alt attribute when calling quill.getText()

ramarivera commented 1 year ago

You can override the instance method value and lengths, to match what you expect to get from getText or getContents IIRC