(editor: Editor, options: Partial<Image>)
| 93 | } |
| 94 | |
| 95 | export 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 | |
| 110 | export const uploadImage = (editor: Editor, path: Path, file: File | string) => { |
| 111 | const options = getOptions(editor) |
no outgoing calls
no test coverage detected
searching dependent graphs…