(view: EditorView)
| 47 | * Get current selection from editor view |
| 48 | */ |
| 49 | export function getSelection(view: EditorView): SerializedSelection { |
| 50 | const sel = view.state.selection; |
| 51 | return { |
| 52 | ranges: sel.ranges.map((r) => ({ from: r.from, to: r.to })), |
| 53 | mainIndex: sel.mainIndex, |
| 54 | }; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Get scroll position from editor view |