(elem: PageNote | PageArrow, section?: NoteTextSection)
| 48 | } |
| 49 | |
| 50 | async start(elem: PageNote | PageArrow, section?: NoteTextSection) { |
| 51 | if (this.react.elemId === elem.id) { |
| 52 | return; |
| 53 | } |
| 54 | |
| 55 | if (this.react.active) { |
| 56 | this.stop(); |
| 57 | } |
| 58 | |
| 59 | if (this.page.react.readOnly || elem.react.collab.readOnly) { |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | elem.react.editing = true; |
| 64 | |
| 65 | this.react.elemId = elem.id; |
| 66 | |
| 67 | if (elem.type === 'note') { |
| 68 | if (section != null) { |
| 69 | this.react.section = section; |
| 70 | } else if (elem.react.topSection !== 'container') { |
| 71 | this.react.section = elem.react.topSection; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | this.page.selection.set(elem); |
| 76 | |
| 77 | await nextTick(); |
| 78 | await watchUntilTrue(() => elem.react.loaded); |
| 79 | |
| 80 | this.page.selection.set(elem); |
| 81 | |
| 82 | for (const editor of elem.react.editors) { |
| 83 | editor.setEditable(true); |
| 84 | } |
| 85 | |
| 86 | this.react.editor?.commands.focus('all', { scrollIntoView: false }); |
| 87 | } |
| 88 | |
| 89 | stop() { |
| 90 | if (this.react.elem == null) { |
no test coverage detected