Skip to content

feat(editor): add Save & Close next to Save in the embedded editor - #131

Merged
erseco merged 1 commit into
chore/tests-tooling-docsfrom
feat/editor-save-and-close
Sep 26, 2026
Merged

erseco merged 1 commit into
chore/tests-tooling-docsfrom
feat/editor-save-and-close

Conversation

@erseco

@erseco erseco commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Stack 6/6, based on #129.

What

  • Save saves the package and keeps the embedded editor open (unchanged).
  • Save & Close, next to Save, runs the same 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.
  • No double saves: save() now resolves true/false and 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:

  • Save: primary, existing content-save icon.
  • Save & Close: outline style, MDI logout icon. No standalone X icon.

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.ts checks that:

  • Save keeps the editor open.
  • Save & Close closes only after the save resolves.
  • Save & Close stays open when the save fails.
  • Repeated or concurrent saves call the editor once.

Vitest now loads .vue files through @vitejs/plugin-vue. It was already installed via @nextcloud/vite-config and is now an explicit dev dependency.

Compatibility with open PRs

Verification

composer install                 exit 0
npm install                      exit 0
npm run typecheck                exit 0
npm test                         Tests 147 passed (147)
npm run lint                     exit 0
npm run lint:biome               9 warnings, 1 info (same as on main)
npm run build                    ✓ built
npx vitest run --coverage        All files 98.58 % lines, 93.54 % branches
make architecture-check          Architecture records OK — 3 records, 0 changes.
make -n download-editor … typecheck   exit 0
vendor/bin/phpunit               OK (115 tests, 311 assertions)
composer cs:check                Found 0 of 32 files that can be fixed
git diff --check                 clean

Not yet exercised in a live Nextcloud.

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.
@github-actions

Copy link
Copy Markdown
Contributor

Preview this PR in the Nextcloud Playground

Open this PR in the Nextcloud Playground

A fresh Nextcloud boots in your browser with this branch's exelearning app installed and enabled (log in as admin / admin). Two sample .elpx are seeded under exelearning-samples/ in Files — click one to open the viewer.

eXeLearning editor: v4.0.5 (overlaid at boot from the upstream release).

@erseco
erseco added this pull request to stack #130 September 26, 2026 06:31
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.81%. Comparing base (52fc162) to head (383884b).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erseco
erseco merged commit d038c85 into main Sep 26, 2026
16 checks passed
@erseco
erseco deleted the feat/editor-save-and-close branch September 26, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants