I would like to wrap selected text in a div in Quilljs using custom buttons. I can then give the div a padding and background so that I can highlight certain areas in the text.
So in this image the selected text must be wrapped, but all elements must be preserved.
I have tried using Block, Inline and Embed. These were the results:
- Block replaces the tag of each element. For example all
<p>
are replaced by<div>
. - Inline adds a tag to each element. So a
<div>
is entered within the<p>
. - Embed did something similar to Inline.
Also I tried to recreate the code-block functionality but this one removes all elements and makes it plain text.
Any tips would be much appreciated!