Skip to content

Build your personal knowledge base with Trilium Notes

chore(ckeditor5): integrate basic plugins

Elian Doran8cc8dc25822b
diff --git a/apps/client/src/widgets/type_widgets/editable_text.ts b/apps/client/src/widgets/type_widgets/editable_text.ts
index 8d99da6061..3afda133a3 100644
--- a/apps/client/src/widgets/type_widgets/editable_text.ts
+++ b/apps/client/src/widgets/type_widgets/editable_text.ts
@@ -18,7 +18,7 @@ import { buildSelectedBackgroundColor } from "../../components/touch_bar.js";
import { buildConfig, buildToolbarConfig } from "./ckeditor/config.js";
import type FNote from "../../entities/fnote.js";
import { getMermaidConfig } from "../../services/mermaid.js";
-import { BalloonEditor, DecoupledEditor, EditorWatchdog } from "@triliumnext/ckeditor5";
+import { BalloonEditor, COMMON_PLUGINS, DecoupledEditor, EditorWatchdog } from "@triliumnext/ckeditor5";
const ENABLE_INSPECTOR = false;
@@ -317,7 +317,8 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
mermaid: {
lazyLoad: async () => (await import("mermaid")).default, // FIXME
config: getMermaidConfig()
- }
+ },
+ plugins: COMMON_PLUGINS
});
}
diff --git a/packages/ckeditor5/src/ckeditor_balloon.ts b/packages/ckeditor5/src/ckeditor_balloon.ts
deleted file mode 100644
index 091a375d65..0000000000
--- a/packages/ckeditor5/src/ckeditor_balloon.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-// The editor creator to use.
-import { BalloonEditor as BalloonEditorBase } from "ckeditor5";
-import { BlockToolbar } from "ckeditor5";
-import './theme/theme.css';
-import { COMMON_PLUGINS } from './config.js';
-
-export default class BalloonEditor extends BalloonEditorBase {
- public static override builtinPlugins = [
- ...COMMON_PLUGINS,
- BlockToolbar
- ];
-}
diff --git a/packages/ckeditor5/src/ckeditor_decoupled.ts b/packages/ckeditor5/src/ckeditor_decoupled.ts
deleted file mode 100644
index e74b3e9509..0000000000
--- a/packages/ckeditor5/src/ckeditor_decoupled.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-// The editor creator to use.
-import { DecoupledEditor as DecoupledEditorBase } from "ckeditor5";
-import './theme/theme.css';
-import { COMMON_PLUGINS } from './config.js';
-
-export default class DecoupledEditor extends DecoupledEditorBase {
- public static override builtinPlugins = [
- ...COMMON_PLUGINS,
- ];
-}
diff --git a/packages/ckeditor5/src/index.ts b/packages/ckeditor5/src/index.ts
index 2cdadb1214..c1e30588ca 100644
--- a/packages/ckeditor5/src/index.ts
+++ b/packages/ckeditor5/src/index.ts
@@ -1,3 +1,2 @@
-export { EditorWatchdog } from "ckeditor5";
-export { default as BalloonEditor } from "./ckeditor_balloon.js";
-export { default as DecoupledEditor } from "./ckeditor_decoupled.js";
+export { EditorWatchdog, BalloonEditor, DecoupledEditor } from "ckeditor5";
+export * from "./plugins.js";
diff --git a/packages/ckeditor5/src/config.ts b/packages/ckeditor5/src/plugins.ts
similarity index 100%
rename from packages/ckeditor5/src/config.ts
rename to packages/ckeditor5/src/plugins.ts