mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 10:01:00 +01:00
* perf(frontend): load md-editor on demand instead of with the app md-editor's config() ran from the app entry, which kept the library in the entry's import graph. A Vite and Vitest alias now routes every bare md-editor-v3 import, v1 included, through plugins/mdeditor.ts, which applies the XSS config as a side effect of the first load. The sanitizer stays on for every caller without an entry import. ChangelogDialog (mounted on every v2 page) and NotesTab imported MdPreview and MdEditor statically. They now load them through small MarkdownPreview and MarkdownEditor wrappers with defineAsyncComponent, so md-editor and CodeMirror download when a note or the changelog is shown, and the editor only when editing starts. Based on the lazy-loading approach from #4988 by @andest01. * fix(storybook): keep the app's alias array when adding @ and @v2 Addresses Greptile: spreading the app's alias array into an object turned it into numeric keys, so Storybook lost the md-editor-v3 alias and with it the XSS config. * refactor(frontend): address code-review findings - Share one alias list between vite, vitest and (through vite.config.js) Storybook. - Re-export MdEditor and MdPreview from typed modules instead of wrapper SFCs, so callers keep prop and v-model type checks. - Block deep md-editor-v3 imports in ESLint, since they would skip the XSS config. - Pass no-echarts where notes and the changelog render, so md-editor does not fetch echarts from unpkg. * refactor(frontend): simplify the shared md-editor module Simplify pass: - Merge the editor and preview re-exports into one shared/markdown module; both pulled the same md-editor chunk and stylesheet. - MarkdownViewer imports MdPreview from it too, and gets no-echarts like the other v2 previews. - Drop the ESLint ignore for mdeditor-dist.d.ts, which has no deep import. * style(frontend): trim the shared md-editor module comment (review-polish) * fix(frontend): keep the md-editor preview and editor in separate modules The simplify pass merged them into one module, which put MdEditor and CodeMirror in the preview's chunk: the changelog and note previews went from 78 KB to 290 KB gzip. MarkdownViewer keeps using the shared preview module. * feat(frontend): show a spinner while the note editor loads * fix(frontend): cover md-editor chunk loads with the existing spinners (code-review) ChangelogDialog waits on the renderer chunk with the releases fetch, so a load failure lands in the dialog's error state instead of blank bodies. NotesTab's preview gets the same loading spinner as the editor. Document the @v2 and md-editor-v3 aliases. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(frontend): share the async md-editor components (simplify) Define the async MdPreview/MdEditor wrappers and their attr-dropping spinner once in shared/asyncMarkdown.ts instead of per NotesTab instance and again in ChangelogDialog. Keep the md-editor alias out of the tsconfig paths block in the architecture doc. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(frontend): let TypeScript follow the md-editor-v3 alias Only Vite knew about the alias, so go-to-definition on md-editor-v3 opened the package types instead of src/plugins/mdeditor.ts, where the sanitizer config lives. A tsconfig path now points there too. * refactor(frontend): turn off md-editor's CDN renderers once for v2 The shared markdownPreview/markdownEditor modules wrap the components with noHighlight, noKatex, noMermaid and noEcharts, so v2 call sites no longer repeat the flags and a new one cannot miss them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>