feat(editor): add Save & Close next to Save in the embedded editor - #131
Merged
Merged
Conversation
Save keeps the editor open as before. Save & Close runs the same save() and returns to Files only once the write succeeded; a failed save keeps the editor open. save() now reports success and ignores calls while one is in flight, which covers repeated clicks, Ctrl/Cmd+S and Save & Close alike. The editor protocol exposes no dirty state, so no unsaved-changes guard is added on close. Vitest now loads .vue files (@vitejs/plugin-vue, previously only a transitive dependency) so the page's save actions are component-tested.
Contributor
Preview this PR in the Nextcloud PlaygroundA fresh Nextcloud boots in your browser with this branch's eXeLearning editor: |
erseco
added this pull request to stack #130
September 26, 2026 06:31
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## chore/tests-tooling-docs #131 +/- ##
===========================================================
Coverage 93.81% 93.81%
Complexity 149 149
===========================================================
Files 25 25
Lines 776 776
Branches 89 89
===========================================================
Hits 728 728
Misses 35 35
Partials 13 13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 6/6, based on #129.
What
save()and waits for it. It returns to Files (the same place as the "←" link) only after the write succeeded. A failed save shows the usual alert and keeps the editor open.save()now resolvestrue/falseand ignores calls while a save is in flight. That one guard covers repeated clicks, Ctrl/Cmd+S (fix(editor): make Ctrl/Cmd+S save from inside the embedded editor #126) and Save & Close. Both buttons are disabled during a save.UI
The toolbar uses plain buttons with inline MDI icons and has no dropdown component, so this adds two adjacent buttons instead of a split button:
content-saveicon.logouticon. No standaloneXicon.Closing with unsaved changes
There was no protection before, and the editor's postMessage protocol exposes no dirty/unsaved state. Adding one would need new state tracking, so it's left out.
Tests
tests/js/elpx-view-page.test.tschecks that:Vitest now loads
.vuefiles through@vitejs/plugin-vue. It was already installed via@nextcloud/vite-configand is now an explicit dev dependency.Compatibility with open PRs
save()) and refactor: drop the unreachable standalone editor page and dead fields #127 (single save path inElpxViewPage).src/viewer/ElpxViewer.vueon the frontend, so no overlap.Verification
Not yet exercised in a live Nextcloud.