MCPcopy Create free account
hub / github.com/editablejs/editable / insertImage

Function insertImage

packages/plugins/image/src/utils.ts:95–108  ·  view source on GitHub ↗
(editor: Editor, options: Partial<Image>)

Source from the content-addressed store, hash-verified

93}
94
95export const insertImage = (editor: Editor, options: Partial<Image>) => {
96 const image: Image = {
97 type: IMAGE_KEY,
98 ...options,
99 children: [{ text: '' }],
100 }
101
102 Transforms.insertNodes(editor, image)
103 const entry = Editor.above(editor, {
104 match: n => Image.isImage(n),
105 })
106 if (!entry) throw new Error('image not found')
107 return entry[1]
108}
109
110export const uploadImage = (editor: Editor, path: Path, file: File | string) => {
111 const options = getOptions(editor)

Callers 2

insertImagesFunction · 0.90
withImageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…