0
Guys, I was creating a plugin in Ckeditor 5 and I stopped with a situation that I can not continue, I already searched the entire documentation but I find nothing, the documentation is very bad, it seems that they hide the information to be able to sell plugin.
I have this code, it should create a Section and a (link tag) inside the Section:
editor.model.schema.register('section', {
allowAttributes: ['class']
});
editor.model.schema.register('a', {
allowAttributes: ['class', 'href', 'target', 'download']
});
editor.model.change(writer => {
const section = writer.createElement('section', {
class: 'button'
});
const link = writer.createElement('a', {
href: 'https://dominio.com/file.pdf',
target: '_blank',
download: 'file.pdf'
});
writer.appendText('DOWNLOAD', link);
writer.insert(link, section);
editor.model.insertContent(section, editor.model.document.selection);
});
Only the result I get is:
<p>DOWNLOAD</p>
I can’t create Section on my own, let alone pass attributes to tags, someone already created a plugin in Ckeditor5 to help me?