Я разрабатываю плагин CKEditor5, который требует, чтобы я вставил диапазон с идентификатором и некоторыми классами.
Это мой код, позволяющий:
editor.model.schema.register('span', {
inheritAllFrom: '$block',
allowIn: ['paragraph'],
allowAttributes: ['id', 'class']
});
editor.conversion.elementToElement({model: 'span', view: 'span'});
editor.conversion.attributeToAttribute({model: 'class', view: 'class'});
editor.conversion.attributeToAttribute({model: {name: 'span', key: 'id'}, view: 'id'});
Это позволяет мневставить пролет без проблем.Моя проблема заключается в том, что если я вставляю некоторый контент с диапазоном (например, текст с цветом фона, установленным в плагине FontBackGroundColor), а затем нажимаю клавишу Backspace, я получаю эту ошибку:
VM28478:5 Uncaught CKEditorError: move-operation-node-into-itself: Trying to move a range of nodes into one of nodes from that range. Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-move-operation-node-into-itself
at cc._validate (<anonymous>:5:277330)
at Jc.on.priority (<anonymous>:5:324234)
at Jc.fire (<anonymous>:5:101659)
at Jc.(anonymous function) [as applyOperation] (<anonymous>:5:115956)
at gc.move (<anonymous>:5:289708)
at gc.insert (<anonymous>:5:287384)
at t (<anonymous>:5:319802)
at <anonymous>:5:319915
at Jc.change (<anonymous>:5:324808)
at Nc (<anonymous>:5:318986)
Мой подход правильный?Я пытался прочитать документацию, но не думаю, что понял ее правильно.