(editor: SlateEditor, at?: Location)
| 192 | marks: SlateEditor.marks as (editor: SlateEditor) => EditorMarks, |
| 193 | |
| 194 | elements(editor: SlateEditor, at?: Location) { |
| 195 | let caches = EDITOR_ACTIVE_ELEMENTS.get(editor) |
| 196 | if (caches && !at) return caches |
| 197 | const prevSelection = editor.selection |
| 198 | if (at) editor.selection = Editor.range(editor, at) |
| 199 | const editorElements: EditorElements = {} |
| 200 | editor.normalizeSelection(selection => { |
| 201 | if (selection === null) return |
| 202 | const nodeEntries = Editor.nodes<Element>(editor, { |
| 203 | at: selection, |
| 204 | match: n => !Editor.isEditor(n) && Element.isElement(n), |
| 205 | }) |
| 206 | |
| 207 | for (const entry of nodeEntries) { |
| 208 | const type = entry[0].type ?? 'paragraph' |
| 209 | if (editorElements[type]) editorElements[type].push(entry) |
| 210 | else editorElements[type] = [entry] |
| 211 | } |
| 212 | }) |
| 213 | editor.selection = prevSelection |
| 214 | if (!at) EDITOR_ACTIVE_ELEMENTS.set(editor, editorElements) |
| 215 | return editorElements |
| 216 | }, |
| 217 | } |
| 218 | |
| 219 | export * from 'slate' |
nothing calls this directly
no test coverage detected
searching dependent graphs…