Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 2397719

Browse files
authored
Merge pull request #1847 from TriliumNext/feature/ckeditor_lib
Integrate CKEditor into the monorepo
2 parents 98b36e8 + ac92a41 commit 2397719

File tree

296 files changed

+25413
-1762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+25413
-1762
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ test-output
4040

4141
apps/*/data
4242
apps/*/out
43-
upload
43+
upload
44+
45+
.rollup.cache
46+
*.tsbuildinfo

apps/client/src/libraries/ckeditor/ckeditor-content.css renamed to _regroup/ckeditor5-build-trilium/ckeditor-content.css

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,3 @@
1-
/* !!!!!! TRILIUM CUSTOM CHANGES !!!!!! */
2-
3-
.printed-content .ck-widget__selection-handle, .printed-content .ck-widget__type-around { /* gets rid of triangles: https://github.com/zadam/trilium/issues/1129 */
4-
display: none;
5-
}
6-
7-
.page-break {
8-
page-break-after: always;
9-
}
10-
11-
.printed-content .page-break:after,
12-
.printed-content .page-break > * {
13-
display: none !important;
14-
}
15-
16-
.ck-content li p {
17-
margin: 0 !important;
18-
}
19-
20-
.admonition {
21-
--accent-color: var(--card-border-color);
22-
border: 1px solid var(--accent-color);
23-
box-shadow: var(--card-box-shadow);
24-
background: var(--card-background-color);
25-
border-radius: 0.5em;
26-
padding: 1em;
27-
margin: 1.25em 0;
28-
position: relative;
29-
overflow: hidden;
30-
}
31-
32-
.admonition p:last-child {
33-
margin-bottom: 0;
34-
}
35-
36-
.admonition p, h2 {
37-
margin-top: 0;
38-
}
39-
40-
.admonition.note { --accent-color: #69c7ff; }
41-
.admonition.tip { --accent-color: #40c025; }
42-
.admonition.important { --accent-color: #9839f7; }
43-
.admonition.caution { --accent-color: #ff2e2e; }
44-
.admonition.warning { --accent-color: #e2aa03; }
45-
461
/*
472
* CKEditor 5 (v41.0.0) content styles.
483
* Generated on Fri, 26 Jan 2024 10:23:49 GMT.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.ck.ck-sticky-panel > .ck-progress-bar {
2+
display: flex;
3+
flex-direction: row;
4+
justify-content: space-between;
5+
6+
border-left: 1px solid var(--ck-color-base-border);
7+
border-top: 1px solid var(--ck-color-base-border);
8+
border-right: 1px solid var(--ck-color-base-border);
9+
}
10+
11+
.ck.ck-sticky-panel > .ck-progress-bar > .ck-uploading-progress {
12+
align-self: center;
13+
padding: 3px 5px;
14+
font-weight: bold;
15+
16+
color: var(--ck-color-base-foreground);
17+
background-color: var(--ck-color-base-border);
18+
19+
transition-property: width;
20+
transition-duration: .5s;
21+
transition-timing-function: linear;
22+
23+
}
24+
25+
.ck.ck-sticky-panel > .ck-progress-bar > .ck-uploading-cancel {
26+
align-self: flex-end;
27+
padding: 0 5px;
28+
font-weight: bold;
29+
color: var(--ck-color-base-error);
30+
}

apps/client/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@mermaid-js/layout-elk": "0.1.7",
2222
"@mind-elixir/node-menu": "1.0.5",
2323
"@popperjs/core": "2.11.8",
24+
"@triliumnext/ckeditor5": "workspace:*",
2425
"@triliumnext/commons": "workspace:*",
2526
"bootstrap": "5.3.6",
2627
"dayjs": "1.11.13",
@@ -51,12 +52,14 @@
5152
"vanilla-js-wheel-zoom": "9.0.4"
5253
},
5354
"devDependencies": {
55+
"@ckeditor/ckeditor5-inspector": "4.1.0",
5456
"@types/bootstrap": "5.2.10",
5557
"@types/jquery": "3.5.32",
5658
"@types/leaflet": "1.9.17",
5759
"@types/leaflet-gpx": "1.3.7",
5860
"@types/react": "18.3.21",
5961
"@types/react-dom": "18.3.7",
62+
"copy-webpack-plugin": "13.0.0",
6063
"happy-dom": "17.4.6",
6164
"script-loader": "0.7.2"
6265
},

apps/client/src/components/app_context.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import type TypeWidget from "../widgets/type_widgets/type_widget.js";
2626
import type EditableTextTypeWidget from "../widgets/type_widgets/editable_text.js";
2727
import type { NativeImage, TouchBar } from "electron";
2828
import TouchBarComponent from "./touch_bar.js";
29+
import type { CKTextEditor } from "@triliumnext/ckeditor5";
2930

3031
interface Layout {
3132
getRootWidget: (appContext: AppContext) => RootWidget;
@@ -187,7 +188,7 @@ export type CommandMappings = {
187188
callback: (value: NoteDetailWidget | PromiseLike<NoteDetailWidget>) => void;
188189
};
189190
executeWithTextEditor: CommandData &
190-
ExecuteCommandData<TextEditor> & {
191+
ExecuteCommandData<CKTextEditor> & {
191192
callback?: GetTextEditorCallback;
192193
};
193194
executeWithCodeEditor: CommandData & ExecuteCommandData<CodeMirrorInstance>;

apps/client/src/components/note_context.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ import options from "../services/options.js";
1010
import type { ViewScope } from "../services/link.js";
1111
import type FNote from "../entities/fnote.js";
1212
import type TypeWidget from "../widgets/type_widgets/type_widget.js";
13+
import type { CKTextEditor } from "@triliumnext/ckeditor5";
1314

1415
export interface SetNoteOpts {
1516
triggerSwitchEvent?: unknown;
1617
viewScope?: ViewScope;
1718
}
1819

19-
export type GetTextEditorCallback = (editor: TextEditor) => void;
20+
export type GetTextEditorCallback = (editor: CKTextEditor) => void;
2021

2122
class NoteContext extends Component implements EventListener<"entitiesReloaded"> {
2223
ntxId: string | null;
@@ -298,7 +299,7 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
298299
}
299300

300301
async getTextEditor(callback?: GetTextEditorCallback) {
301-
return this.timeout<TextEditor>(
302+
return this.timeout<CKTextEditor>(
302303
new Promise((resolve) =>
303304
appContext.triggerCommand("executeWithTextEditor", {
304305
callback,

apps/client/src/libraries/ckeditor/ckeditor.d.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

apps/client/src/libraries/ckeditor/ckeditor.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

apps/client/src/libraries/ckeditor/ckeditor.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/client/src/libraries/ckeditor/inspector.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)