Commit 0c85ba6
committed
fix(ccb): make toolbar undo/redo work when an external surface owns focus in design mode
In design mode the active document can sit behind a surface that owns
DOM focus instead of a CodeMirror editor — e.g. the markdown viewer's
iframe when it's in edit mode. EditorManager.getFocusedEditor() returns
null in that case, so the CCB undo/redo buttons (and anything else
routing through EDIT_UNDO / EDIT_REDO) silently no-op'd even though the
underlying Phoenix document had perfectly good history.
When design mode is active and no editor is focused, fall back to
EditorManager.getCurrentFullEditor() so toolbar undo/redo drives the
active document. External surfaces that sync their edits back to that
document (like the md viewer) will re-render to reflect the rolled-back
text. Outside design mode the pre-existing no-op behavior is preserved.1 parent d2c14ce commit 0c85ba6
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
1185 | 1186 | | |
1186 | 1187 | | |
1187 | 1188 | | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
1188 | 1199 | | |
1189 | 1200 | | |
1190 | 1201 | | |
| |||
0 commit comments