fix: Skip unsupported node types when uploading

closes #5544
This commit is contained in:
Tom Moor
2023-07-30 15:52:08 -04:00
parent 3b43460a0a
commit d2fcd1dee6

View File

@@ -75,6 +75,11 @@ const insertFiles = function (
const { tr } = view.state;
if (upload.isImage) {
// Skip if the editor does not support images.
if (!view.state.schema.nodes.image) {
continue;
}
// insert a placeholder at this position, or mark an existing file as being
// replaced
tr.setMeta(uploadPlaceholderPlugin, {
@@ -88,6 +93,11 @@ const insertFiles = function (
});
view.dispatch(tr);
} else if (!attachmentPlaceholdersSet) {
// Skip if the editor does not support attachments.
if (!view.state.schema.nodes.attachment) {
continue;
}
const attachmentsToUpload = filesToUpload.filter(
(i) => i.isImage === false
);