-
Notifications
You must be signed in to change notification settings - Fork 25
Exp Workspace - Editor feature parity #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2fe7ed1
ee50eb2
dacaeb2
46bd022
c326546
701e1e3
ccf2f0f
4873cd9
c944ac8
f441292
b5941c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,8 @@ function editorCtxFromHashState(state, fullPath) { | |
| } | ||
|
|
||
| function syncCanvasEditorsToHash({ mountRoot, header, state }) { | ||
| header.undoAvailable = false; | ||
| header.redoAvailable = false; | ||
| const fullPath = buildCanvasDocPath(state); | ||
| if (!fullPath) { | ||
| removeCanvasEditors(mountRoot); | ||
|
|
@@ -145,6 +147,12 @@ function installCanvasHeader(block) { | |
| persistCanvasEditorView(view); | ||
| notifyCanvasEditorActive(canvasHeaderApplyTarget(block), view); | ||
| }); | ||
| header.addEventListener('nx-canvas-undo', () => { | ||
| canvasEditorMountRoot(block).querySelector('nx-editor-doc')?.undo(); | ||
| }); | ||
| header.addEventListener('nx-canvas-redo', () => { | ||
| canvasEditorMountRoot(block).querySelector('nx-editor-doc')?.redo(); | ||
| }); | ||
| block.before(header); | ||
| return header; | ||
| } | ||
|
|
@@ -155,6 +163,11 @@ export default async function decorate(block) { | |
| const mountRoot = canvasEditorMountRoot(block); | ||
| mountRoot.classList.add('nx-canvas-editor-mount'); | ||
|
|
||
| mountRoot.addEventListener('nx-editor-undo-state', (e) => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For future - maybe we should move all events out to constants and reuse so we have a clear view + avoid regressions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, this would be a good refactoring task. |
||
| header.undoAvailable = e.detail?.canUndo ?? false; | ||
| header.redoAvailable = e.detail?.canRedo ?? false; | ||
| }); | ||
|
|
||
| hashChange.subscribe((state) => { | ||
| syncCanvasEditorsToHash({ mountRoot, header, state }); | ||
| }); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.