Conversation
Vite wraps every dynamic import() in its preload helper, whose failure fires vite:preloadError and, through the app shell, the "New version released" reload prompt. The notes editor imported TinyMCE from azgaar.github.io that way, so any failed fetch showed the prompt. In the desktop app the CSP blocks remote scripts, so it showed on every note and the editor silently degraded to a plain textarea. TinyMCE already ships in public/libs. Load that copy with a classic script through the shared loadScript util, which cloud.ts and export.ts each carried their own copy of. TinyMCE infers a ".min" suffix from its own file name and doubles it onto theme and plugin names, so the pre-init hook sets the base and an empty suffix instead of _setBaseUrl. Fixes #1660
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@barrulus, why not just |
|
Alternatively - if you know a better and mush more lightweight WYSIWYG editor - replace tinymce with it. |
because this was a fix not refactor :) I will have a look at that today - will let you know what I think/find before I do anythign further on this one |
|
Maybe Quill 2 or something less known |
From Quill:
This is very interesting, especially at the electron level... Local LLM to populate edit and update notes.... |
Fixes #1660.
Root cause
vite buildwraps every dynamicimport(), including the/* @vite-ignore */one the notes editor used to fetch TinyMCE from azgaar.github.io, in its preload helper. When that import fails the helper firesvite:preloadError, andapp-shell.tshas answered that event with the "New version released" reload prompt since #1560. So the prompt appears whenever the TinyMCE fetch fails, not only after a release.In the desktop app the fetch always fails: the CSP added in 1.149.0 allows scripts from the app itself only. Hence the prompt on every note, and the rich editor silently falling back to a plain textarea. On the web the same prompt shows whenever azgaar.github.io is unreachable.
Fix
public/libs. Load that copy with a classic<script>through the sharedloadScriptutil, whichcloud.tsandexport.tseach carried a private copy of. A script tag failure stays local to the notes editor, and the desktop CSP allows it..minsuffix from its own file name and requeststheme.min.min.js. ItstinyMCEPreInithook sets the base and an empty suffix up front, replacing the old_setBaseUrlcall. The retry-with-random-hash workaround only made sense for a cached module import and is gone.Tests
tests/e2e/notes-editor.spec.ts: one test aborts the TinyMCE request and asserts no reload prompt and a working plain editor (fails before this change), the other asserts the rich editor renders from the bundled copy. Note the first only exercises the bug on a built bundle, since the dev server does not wrap imports; the CI suite runs on a preview build.Verified on the production web build. The packaged desktop app itself was not launched; its path differs only by the CSP the bundled copy now satisfies.