i want to add a link into the editor with a button. This worked in the past but it doesn’t anymore even though i am using ckeditor a fixed versio so it is not updated by npm.
i am using v5.16
let content = '<a href="#" id="1234" class="lnkGoto">a link</a> ';
const htmlDP = editor.data.processor;
const viewFragment = htmlDP.toView(content);
const modelFragment = editor.data.toModel( viewFragment );
editor.model.insertContent(modelFragment);
the problem is it cuts id and class attributes away and i get this
<a href="#">a link</a>
i solved it by putting the id in the href attribute and then before saving the document i use a regex to build the proper link with all needed properties.
window.editor.getData().replace(/<a href="([^"]+)"/g, '<a href="#" data-id="$1" class="lnkGoto"')