Skip to content

Commit

Permalink
XWIKI-22218: Drag & Drop doesn't successfully create links if the act…
Browse files Browse the repository at this point in the history
…ions are performed in the same time by users
  • Loading branch information
douakli committed Sep 13, 2024
1 parent cc7fd41 commit 9fb2295
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,23 @@ define('xwiki-ckeditor-realtime-adapter', [

/** @inheritdoc */
getFilters() {
/**
* Checks if there is a node with a given node name in the given node or its children.
*/
const containsNode = function(node, nodeName) {
if (node.nodeName === nodeName) {
return true;
}
if (node.childNodes !== undefined && node.childNodes.some(child => containsNode(child, nodeName))) {
return true;
}
return false;
};
return [
// Ignore widget id changes.
change => change.diff.action === 'modifyAttribute' && change.diff.name === 'data-widget-id' &&
change.node.classList?.contains('xwiki-widget')
change.node.classList?.contains('xwiki-widget'),
change => change.diff.action === 'removeElement' && containsNode(change.diff.element, 'XWIKI-WIDGET-UPLOADFILE')
];
}

Expand Down Expand Up @@ -414,4 +427,4 @@ define('xwiki-ckeditor-realtime-adapter', [
}

return CKEditorAdapter;
});
});

0 comments on commit 9fb2295

Please sign in to comment.