I am trying to implement a simple ckeditor conversion to wrap my image into an tag.
editor.conversion.for('downcast').add(dispatcher => {
dispatcher.on('insert:imageBlock', (evt, data, conversionApi) => {
const viewImage = viewWriter.createAttributeElement('img');
const insertPosition = conversionApi.mapper.toViewPosition(data.range.start);
conversionApi.mapper.bindElements(data.item, viewImage);
viewWriter.insert(insertPosition, viewImage);
evt.stop();
});
});
The base "insert:imageBlock" creates a element with an inside, the code above removes the figure and only binds the imageBlock model to my newly created tag and it works fine.
But I cannot find a solution to wrap that newly created tag into an tag with my desirable href.
Does anyone know a simple solution to this?
Thanks!