Skip to content

Build your personal knowledge base with Trilium Notes

chore(ckeditor5): integrate ckeditor5-mermaid

Elian Dorancdb62f43767e
diff --git a/packages/ckeditor5-mermaid/src/commands/mermaidPreviewCommand.ts b/packages/ckeditor5-mermaid/src/commands/mermaidPreviewCommand.ts
index 7936922462..420ab111ba 100644
--- a/packages/ckeditor5-mermaid/src/commands/mermaidPreviewCommand.ts
+++ b/packages/ckeditor5-mermaid/src/commands/mermaidPreviewCommand.ts
@@ -1,7 +1,5 @@
-import { Command } from 'ckeditor5/src/core.js';
-
import { checkIsOn } from '../utils.js';
-import { Element } from 'ckeditor5';
+import { Command, Element } from 'ckeditor5';
/**
* The mermaid preview command.
diff --git a/packages/ckeditor5-mermaid/src/commands/mermaidSourceViewCommand.ts b/packages/ckeditor5-mermaid/src/commands/mermaidSourceViewCommand.ts
index ed1f23dcd4..67e5e19548 100644
--- a/packages/ckeditor5-mermaid/src/commands/mermaidSourceViewCommand.ts
+++ b/packages/ckeditor5-mermaid/src/commands/mermaidSourceViewCommand.ts
@@ -1,7 +1,5 @@
-import { Command } from 'ckeditor5/src/core.js';
-
import { checkIsOn } from '../utils.js';
-import { Element } from 'ckeditor5';
+import { Command, Element } from 'ckeditor5';
/**
* The mermaid source view command.
diff --git a/packages/ckeditor5-mermaid/src/commands/mermaidSplitViewCommand.ts b/packages/ckeditor5-mermaid/src/commands/mermaidSplitViewCommand.ts
index d7579a26ab..692e707cb6 100644
--- a/packages/ckeditor5-mermaid/src/commands/mermaidSplitViewCommand.ts
+++ b/packages/ckeditor5-mermaid/src/commands/mermaidSplitViewCommand.ts
@@ -2,10 +2,8 @@
* @module mermaid/mermaidsplitviewcommand
*/
-import { Command } from 'ckeditor5/src/core.js';
-
import { checkIsOn } from '../utils.js';
-import { Element } from 'ckeditor5';
+import { Command, Element } from 'ckeditor5';
/**
* The mermaid split view command.
diff --git a/packages/ckeditor5-mermaid/src/mermaid.ts b/packages/ckeditor5-mermaid/src/mermaid.ts
index fa85b78061..e839c825be 100644
--- a/packages/ckeditor5-mermaid/src/mermaid.ts
+++ b/packages/ckeditor5-mermaid/src/mermaid.ts
@@ -1,4 +1,4 @@
-import { Plugin, ButtonView } from 'ckeditor5';
+import { Plugin } from 'ckeditor5';
import MermaidEditing from './mermaidediting.js';
import MermaidToolbar from './mermaidtoolbar.js';
diff --git a/packages/ckeditor5-mermaid/src/mermaidediting.ts b/packages/ckeditor5-mermaid/src/mermaidediting.ts
index 3ee30107df..a2524875a2 100644
--- a/packages/ckeditor5-mermaid/src/mermaidediting.ts
+++ b/packages/ckeditor5-mermaid/src/mermaidediting.ts
@@ -2,16 +2,13 @@
* @module mermaid/mermaidediting
*/
-import { Plugin } from 'ckeditor5/src/core.js';
-import { toWidget } from 'ckeditor5/src/widget.js';
-
import { debounce } from 'lodash-es';
import MermaidPreviewCommand from './commands/mermaidPreviewCommand.js';
import MermaidSourceViewCommand from './commands/mermaidSourceViewCommand.js';
import MermaidSplitViewCommand from './commands/mermaidSplitViewCommand.js';
import InsertMermaidCommand from './commands/insertMermaidCommand.js';
-import { DowncastAttributeEvent, DowncastConversionApi, Element, EventInfo, Item, Node, UpcastConversionApi, UpcastConversionData, ViewElement, ViewNode, ViewText, ViewUIElement } from 'ckeditor5';
+import { DowncastAttributeEvent, DowncastConversionApi, Element, EventInfo, Item, Node, Plugin, toWidget, UpcastConversionApi, UpcastConversionData, ViewElement, ViewNode, ViewText, ViewUIElement } from 'ckeditor5';
// Time in milliseconds.
const DEBOUNCE_TIME = 300;
diff --git a/packages/ckeditor5-mermaid/tsconfig.json b/packages/ckeditor5-mermaid/tsconfig.json
index 069e3cb16b..f53643f74d 100644
--- a/packages/ckeditor5-mermaid/tsconfig.json
+++ b/packages/ckeditor5-mermaid/tsconfig.json
@@ -17,6 +17,7 @@
],
"noImplicitAny": true,
"noImplicitOverride": true,
+ "composite": true,
"strict": true,
"target": "es2019",
"sourceMap": true,
diff --git a/packages/ckeditor5/package.json b/packages/ckeditor5/package.json
index 9f1e422899..4e69049ee2 100644
--- a/packages/ckeditor5/package.json
+++ b/packages/ckeditor5/package.json
@@ -20,7 +20,8 @@
},
"dependencies": {
"ckeditor5": "43.2.0",
- "@triliumnext/ckeditor5-keyboard-marker": "workspace:*"
+ "@triliumnext/ckeditor5-keyboard-marker": "workspace:*",
+ "@triliumnext/ckeditor5-mermaid": "workspace:*"
},
"devDependencies": {
"@types/jquery": "3.5.32"
diff --git a/packages/ckeditor5/src/plugins.ts b/packages/ckeditor5/src/plugins.ts
index 7320f824ef..edce9596bd 100644
--- a/packages/ckeditor5/src/plugins.ts
+++ b/packages/ckeditor5/src/plugins.ts
@@ -14,6 +14,7 @@ import MentionCustomization from "./plugins/mention_customization.js";
import IncludeNote from "./plugins/includenote.js";
import Uploadfileplugin from "./plugins/file_upload/uploadfileplugin.js";
import { Kbd } from "@triliumnext/ckeditor5-keyboard-marker";
+import { Mermaid } from "@triliumnext/ckeditor5-mermaid";
const TRILIUM_PLUGINS: typeof Plugin[] = [
CutToNotePlugin,
@@ -32,7 +33,8 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
];
const EXTERNAL_PLUGINS: typeof Plugin[] = [
- Kbd
+ Kbd,
+ Mermaid
];
export const COMMON_PLUGINS: typeof Plugin[] = [
@@ -99,7 +101,6 @@ export const COMMON_PLUGINS: typeof Plugin[] = [
// Math,
// AutoformatMath,
// Footnotes,
- // Mermaid,
// Admonition
];
diff --git a/packages/ckeditor5/tsconfig.json b/packages/ckeditor5/tsconfig.json
index c23e61c800..07dc88fd5a 100644
--- a/packages/ckeditor5/tsconfig.json
+++ b/packages/ckeditor5/tsconfig.json
@@ -3,6 +3,9 @@
"files": [],
"include": [],
"references": [
+ {
+ "path": "../ckeditor5-keyboard-marker"
+ },
{
"path": "./tsconfig.lib.json"
}
diff --git a/packages/ckeditor5/tsconfig.lib.json b/packages/ckeditor5/tsconfig.lib.json
index d8494503ed..d4ba9f0aa8 100644
--- a/packages/ckeditor5/tsconfig.lib.json
+++ b/packages/ckeditor5/tsconfig.lib.json
@@ -19,6 +19,9 @@
"src/**/*.ts"
],
"references": [
+ {
+ "path": "../ckeditor5-mermaid"
+ },
{
"path": "../ckeditor5-keyboard-marker"
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9e5500b124..684ed4d463 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -804,6 +804,9 @@ importers:
'@triliumnext/ckeditor5-keyboard-marker':
specifier: workspace:*
version: link:../ckeditor5-keyboard-marker
+ '@triliumnext/ckeditor5-mermaid':
+ specifier: workspace:*
+ version: link:../ckeditor5-mermaid
ckeditor5:
specifier: 43.2.0
version: 43.2.0
@@ -831,7 +834,7 @@ importers:
'@vitest/browser':
specifier: ^2.0.5
'@vitest/coverage-istanbul':
specifier: ^2.0.5
version: 2.1.9([email protected])
@@ -873,10 +876,10 @@ importers:
version: 2.0.1
vite-plugin-svgo:
specifier: ~1.4.0
vitest:
specifier: ^2.0.5
webdriverio:
specifier: ^9.0.7
@@ -907,7 +910,7 @@ importers:
'@vitest/browser':
specifier: ^2.0.5
'@vitest/coverage-istanbul':
specifier: ^2.0.5
version: 2.1.9([email protected])
@@ -949,10 +952,10 @@ importers:
version: 2.0.1
vite-plugin-svgo:
specifier: ~1.4.0
vitest:
specifier: ^2.0.5
webdriverio:
specifier: ^9.0.7
@@ -18743,7 +18746,7 @@ snapshots:
sirv: 3.0.1
tinyrainbow: 1.2.0
optionalDependencies:
playwright: 1.52.0
@@ -28736,10 +28739,10 @@ snapshots:
tsx: 4.19.4
yaml: 2.7.1
dependencies:
'@vitest/expect': 2.1.9
'@vitest/pretty-format': 2.1.9
'@vitest/runner': 2.1.9
'@vitest/snapshot': 2.1.9
@@ -28755,12 +28758,12 @@ snapshots:
tinyexec: 0.3.2
tinypool: 1.0.2
tinyrainbow: 1.2.0
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 22.15.3
'@vitest/ui': 3.1.2([email protected])
happy-dom: 17.4.6
@@ -28775,10 +28778,10 @@ snapshots:
- supports-color
- terser
dependencies:
'@vitest/expect': 2.1.9
'@vitest/pretty-format': 2.1.9
'@vitest/runner': 2.1.9
'@vitest/snapshot': 2.1.9
@@ -28794,12 +28797,12 @@ snapshots:
tinyexec: 0.3.2
tinypool: 1.0.2
tinyrainbow: 1.2.0
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 22.15.3
'@vitest/ui': 3.1.2([email protected])
happy-dom: 17.4.6
diff --git a/tsconfig.json b/tsconfig.json
index 4a96443311..4625b9b870 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -35,6 +35,9 @@
},
{
"path": "./packages/ckeditor5"
+ },
+ {
+ "path": "./packages/ckeditor5-keyboard-marker"
}
]
}