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);
|
||||
} else if (!attachmentPlaceholdersSet) {
|
||||
const $pos = tr.doc.resolve(pos);
|
||||
const attachmentsToUpload = filesToUpload.filter(
|
||||
(i) => i.isImage === false
|
||||
);
|
||||
|
||||
view.dispatch(
|
||||
view.state.tr.replaceWith(
|
||||
$pos.pos,
|
||||
$pos.pos + ($pos.nodeAfter?.nodeSize || 0),
|
||||
tr.insert(
|
||||
pos,
|
||||
attachmentsToUpload.map((attachment) =>
|
||||
schema.nodes.attachment.create({
|
||||
id: attachment.id,
|
||||
|
||||
Reference in New Issue
Block a user