feat: media picker and image removal
This commit is contained in:
1 parent
008b0dfbb9
commit
b3793d5dbb
54 files changed
+3769
-1412
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user