I’m trying to add some data "<div title="" + parts[0]+ "" id="" + parts[1]+ "" class="galleryPlaceholder"><p> </p></div><p></p>"
with a custom plugin button in ckeditor5. What I want to achieve is to add the data where the cursor is, then move the cursor to the end of immitted data (the last <p>
).
Is it possible?
my code so far is:
this.listenTo( this.gallerySelect, 'execute', evt => {
const whole = evt.source.val;
let parts = whole.split(' ');
editor.data.set("<div title="" + parts[0] + "" id="" + parts[1] + "" class="galleryPlaceholder"><p> </p></div><p></p>");
} );
but this code replaces the existing content, I haven’t find yet a function fitting my needings in CKEditor5 docs.