diff --git a/ui/src/components/editor/extensions/audio/AudioView.vue b/ui/src/components/editor/extensions/audio/AudioView.vue index a35531ed5..39a18134c 100644 --- a/ui/src/components/editor/extensions/audio/AudioView.vue +++ b/ui/src/components/editor/extensions/audio/AudioView.vue @@ -39,13 +39,9 @@ const handleSetExternalLink = (attachment: AttachmentAttr) => { }; const resetUpload = () => { - const canUpdateAttributes = props.editor.can().updateAttributes(Audio.name, { - width: undefined, - height: undefined, - file: undefined, - }); - if (canUpdateAttributes && props.getPos()) { - props.editor.commands.updateAttributes(Audio.name, { + const { file } = props.node.attrs; + if (file) { + props.updateAttributes({ width: undefined, height: undefined, file: undefined, diff --git a/ui/src/components/editor/extensions/image/ImageView.vue b/ui/src/components/editor/extensions/image/ImageView.vue index 4654ea409..2b1529602 100644 --- a/ui/src/components/editor/extensions/image/ImageView.vue +++ b/ui/src/components/editor/extensions/image/ImageView.vue @@ -80,13 +80,9 @@ const resetUpload = () => { fileBase64.value = undefined; uploadProgress.value = undefined; - const canUpdateAttributes = props.editor.can().updateAttributes(Image.name, { - width: undefined, - height: undefined, - file: undefined, - }); - if (canUpdateAttributes && props.getPos()) { - props.editor.commands.updateAttributes(Image.name, { + const { file } = props.node.attrs; + if (file) { + props.updateAttributes({ width: undefined, height: undefined, file: undefined, diff --git a/ui/src/components/editor/extensions/video/VideoView.vue b/ui/src/components/editor/extensions/video/VideoView.vue index cb2214417..1e567be81 100644 --- a/ui/src/components/editor/extensions/video/VideoView.vue +++ b/ui/src/components/editor/extensions/video/VideoView.vue @@ -6,7 +6,6 @@ import RiVideoAddLine from "~icons/ri/video-add-line"; import { EditorLinkObtain } from "../../components"; import InlineBlockBox from "../../components/InlineBlockBox.vue"; import type { AttachmentAttr } from "../../utils/attachment"; -import Video from "./index"; const props = defineProps(); @@ -44,13 +43,9 @@ const handleSetExternalLink = (attachment: AttachmentAttr) => { }; const resetUpload = () => { - const canUpdateAttributes = props.editor.can().updateAttributes(Video.name, { - width: undefined, - height: undefined, - file: undefined, - }); - if (canUpdateAttributes && props.getPos()) { - props.editor.commands.updateAttributes(Video.name, { + const { file } = props.node.attrs; + if (file) { + props.updateAttributes({ width: undefined, height: undefined, file: undefined,