fix: File uploads can remove document closeby document content, closes #5097
This commit is contained in:
@@ -83,15 +83,13 @@ const insertFiles = function (
|
|||||||
});
|
});
|
||||||
view.dispatch(tr);
|
view.dispatch(tr);
|
||||||
} else if (!attachmentPlaceholdersSet) {
|
} else if (!attachmentPlaceholdersSet) {
|
||||||
const $pos = tr.doc.resolve(pos);
|
|
||||||
const attachmentsToUpload = filesToUpload.filter(
|
const attachmentsToUpload = filesToUpload.filter(
|
||||||
(i) => i.isImage === false
|
(i) => i.isImage === false
|
||||||
);
|
);
|
||||||
|
|
||||||
view.dispatch(
|
view.dispatch(
|
||||||
view.state.tr.replaceWith(
|
tr.insert(
|
||||||
$pos.pos,
|
pos,
|
||||||
$pos.pos + ($pos.nodeAfter?.nodeSize || 0),
|
|
||||||
attachmentsToUpload.map((attachment) =>
|
attachmentsToUpload.map((attachment) =>
|
||||||
schema.nodes.attachment.create({
|
schema.nodes.attachment.create({
|
||||||
id: attachment.id,
|
id: attachment.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user