Skip to content
Snippets Groups Projects

Resolve #3486079 "Pasting update clipboard"

Files
9
@@ -246,27 +246,15 @@ export default class Footnotesediting extends Plugin {
);
if (isDebugMode()) {
console.log('Original view fragment:');
console.log(viewFragment);
console.log('Transformed view fragment:');
console.log(transformedViewFragment);
}
// Convert the transformed view fragment to a model fragment.
const modelFragment = this.editor.data.toModel(transformedViewFragment);
this.editor.model.change((writer) => {
const selection = this.editor.model.document.selection;
// If there is a selection, replace the selected content.
if (selection && !selection.isCollapsed) {
writer.remove(selection.getFirstRange());
}
// Insert the transformed content at the selection position.
this.editor.model.insertContent(modelFragment, selection);
});
// Prevent default content handling, as we've already updated the model.
evt.stop();
// Update `data.content` with the transformed view fragment.
// This will allow further listeners to receive the updated data.
data.content = transformedViewFragment;
},
{ priority: 'highest' },
);
Loading