Skip to content

Build your personal knowledge base with Trilium Notes

Merge remote-tracking branch 'origin/main' into feature/ckeditor-format-painter

Elian Dorancc6e89046c1b
diff --cc packages/ckeditor5/src/plugins.spec.ts
index 2d42ea99e1,c7fc3cef8a..58d20326ed
--- a/packages/ckeditor5/src/plugins.spec.ts
+++ b/packages/ckeditor5/src/plugins.spec.ts
@@@ -88,25 -86,26 +88,13 @@@ describe("plugin lists", () =>
});
describe("loadPremiumPlugins", () => {
-- it("returns a non-empty array of plugin constructors", async () => {
-- const plugins = await loadPremiumPlugins();
-- expect(Array.isArray(plugins)).toBe(true);
-- expect(plugins.length).toBeGreaterThan(0);
-- for (const plugin of plugins) {
-- expect(typeof plugin).toBe("function");
-- }
-- });
--
- it("includes Template, but not SlashCommand or FormatPainter", async () => {
- it("includes FormatPainter, but not SlashCommand or Template", async () => {
-- const { SlashCommand, Template, FormatPainter } = await import("ckeditor5-premium-features");
-- const plugins = await loadPremiumPlugins();
- expect(plugins).toContain(Template);
- expect(plugins).toContain(FormatPainter);
--
++ it("loads no premium plugins, since every one of them now has a GPL replacement", async () => {
// `SlashCommand` requires the `Mention` façade, which would load upstream's `MentionUI`
// alongside `TriliumMentionUI`; `TriliumSlashCommands` provides `/` instead.
-- expect(plugins).not.toContain(SlashCommand);
--
- // `FormatPainter` is replaced by the GPL `TriliumFormatPainter`.
- expect(plugins).not.toContain(FormatPainter);
- // `Template` is replaced by the GPL `TriliumSnippets` plugin, which additionally supports
- // live reloading of the snippet list without rebuilding the editor.
- expect(plugins).not.toContain(Template);
++ // `FormatPainter` is replaced by the GPL `TriliumFormatPainter`, and `Template` by the GPL
++ // `TriliumSnippets`, which additionally supports live reloading of the snippet list without
++ // rebuilding the editor.
++ const plugins = await loadPremiumPlugins();
++ expect(plugins).toEqual([]);
});
});
diff --cc packages/ckeditor5/src/plugins.ts
index b568bfc767,2ae2f56fa1..4e8f1e8c4a
--- a/packages/ckeditor5/src/plugins.ts
+++ b/packages/ckeditor5/src/plugins.ts
@@@ -140,18 -141,19 +142,21 @@@ export const CHAT_INPUT_PLUGINS: typeo
/**
* Dynamically loads plugins that require a premium CKEditor license key.
* This avoids loading ~6 seconds of premium features code during initial app startup.
++ *
++ * Every premium plugin Trilium used now has a GPL in-tree replacement, so this currently loads
++ * nothing at all — neither the premium bundle nor its CSS is fetched:
++ *
++ * - `SlashCommand` `requires` the `Mention` façade, which loads upstream's `MentionUI` next to
++ * `TriliumMentionUI` and leaves the two fighting over the same balloon. `TriliumSlashCommands`
++ * provides `/` instead.
++ * - `FormatPainter` is replaced by `TriliumFormatPainter`, built on the public `isFormatting`
++ * schema flag.
++ * - `Template` is replaced by `TriliumSnippets` (see `plugins/snippets/`), which additionally
++ * supports live reloading of the snippet list — the premium plugin baked its definitions in at
++ * startup, forcing an editor rebuild on any change.
*/
export async function loadPremiumPlugins(): Promise<(typeof Plugin)[]> {
-- // `SlashCommand` is deliberately not among them: it `requires` the `Mention` façade, which loads
-- // upstream's `MentionUI` next to `TriliumMentionUI` and leaves the two fighting over the same
-- // balloon. `TriliumSlashCommands` provides `/` instead, for premium and GPL builds alike.
-- //
- // `FormatPainter` is likewise gone: the GPL `TriliumFormatPainter` (built on the public
- // `isFormatting` schema flag) replaces it, so only `Template` still needs the premium licence.
- const { Template } = await import('ckeditor5-premium-features');
- // `Template` is likewise absent: the GPL `TriliumSnippets` plugin replaces it (see
- // `plugins/snippets/`), and additionally supports live reloading of the snippet list — the
- // premium plugin baked its definitions in at startup, forcing an editor rebuild on any change.
- const { FormatPainter } = await import('ckeditor5-premium-features');
-- // Also load the CSS when premium features are used
-- await import('ckeditor5-premium-features/ckeditor5-premium-features.css');
- return [Template];
- return [FormatPainter];
++ return [];
}
/**