added improved delete logic in modals

This commit is contained in:
Palanikannan1437 2023-09-05 01:31:19 +05:30
parent d3a9a764dc
commit 67eeced439
2 changed files with 113 additions and 112 deletions

View File

@ -150,4 +150,4 @@ export const TiptapExtensions = (
TableHeader,
CustomTableCell,
TableRow,
];
];

View File

@ -25,7 +25,7 @@ const TrackImageDeletionPlugin = () =>
// Check if the node still exists elsewhere in the document
let nodeExists = false;
newState.doc.descendants((node) => {
if (node.attrs.id === oldNode.attrs.id) {
if (node.attrs.src === oldNode.attrs.src) {
nodeExists = true;
}
});
@ -37,6 +37,7 @@ const TrackImageDeletionPlugin = () =>
removedImages.forEach((node) => {
const src = node.attrs.src;
console.log("Image deleted: ", src, node.attrs.id)
onNodeDeleted(src);
});
});