feat: media picker and image removal

This commit is contained in:
fsylvain committed 2026-10-01 05:04:58 +02:00
1 parent 008b0dfbb9
commit b3793d5dbb
54 files changed
+3769 -1412

No files matched your search

+12
View File
@@ -208,6 +208,18 @@ defineExpose({
insertImage(src: string, alt: string, imageId: number) {
editorInstance.value?.commands.setArticleImage({ src, alt, imageId })
},
imageSrc(imageId: number): string | null {
const editor = editorInstance.value
if (!editor) {
return null
}
const pos = findArticleImagePos(editor, imageId)
if (pos === null) {
return null
}
const src = editor.state.doc.nodeAt(pos)?.attrs.src
return typeof src === 'string' ? src : null
},
removeImage(imageId: number) {
const editor = editorInstance.value
if (!editor) {