Skip to content

Build your personal knowledge base with Trilium Notes

chore(ckeditor5): type errors due to augmentation

Elian Doran395bc372ce3c
diff --git a/apps/client/src/services/syntax_highlight.ts b/apps/client/src/services/syntax_highlight.ts
index bfe887b9d2..cb2d4d8731 100644
--- a/apps/client/src/services/syntax_highlight.ts
+++ b/apps/client/src/services/syntax_highlight.ts
@@ -97,7 +97,7 @@ export function loadHighlightingTheme(themeName: string) {
*/
export function isSyntaxHighlightEnabled() {
const theme = options.get("codeBlockTheme");
- return theme && theme !== "none";
+ return !!theme && theme !== "none";
}
/**
diff --git a/apps/client/src/widgets/type_widgets/ckeditor/config.ts b/apps/client/src/widgets/type_widgets/ckeditor/config.ts
index 93eea459d4..5a3262a1c3 100644
--- a/apps/client/src/widgets/type_widgets/ckeditor/config.ts
+++ b/apps/client/src/widgets/type_widgets/ckeditor/config.ts
@@ -111,7 +111,7 @@ export function buildConfig(): EditorConfig {
},
mapLanguageName: getHighlightJsNameForMime,
defaultMimeType: MIME_TYPE_AUTO,
- enabled: isSyntaxHighlightEnabled
+ enabled: isSyntaxHighlightEnabled()
},
clipboard: {
copy: copyText
diff --git a/packages/ckeditor5/src/augmentation.ts b/packages/ckeditor5/src/augmentation.ts
index da5e1c9155..c1018db375 100644
--- a/packages/ckeditor5/src/augmentation.ts
+++ b/packages/ckeditor5/src/augmentation.ts
@@ -22,28 +22,3 @@ declare global {
importMarkdownInline(): void;
}
}
-
-declare module "ckeditor5" {
- interface Editor {
- getSelectedHtml(): string;
- removeSelection(): Promise<void>;
- }
-
- interface EditorConfig {
- syntaxHighlighting?: {
- loadHighlightJs: () => Promise<any>;
- mapLanguageName(mimeType: string): string;
- defaultMimeType: string;
- enabled: boolean;
- },
- moveBlockUp?: {
- keystroke: string[];
- },
- moveBlockDown?: {
- keystroke: string[];
- },
- clipboard?: {
- copy(text: string): void;
- }
- }
-}
diff --git a/packages/ckeditor5/src/index.ts b/packages/ckeditor5/src/index.ts
index 8dc0e36118..58e72ca6df 100644
--- a/packages/ckeditor5/src/index.ts
+++ b/packages/ckeditor5/src/index.ts
@@ -43,3 +43,28 @@ export class PopupEditor extends BalloonEditor {
return POPUP_EDITOR_PLUGINS;
}
}
+
+declare module "ckeditor5" {
+ interface Editor {
+ getSelectedHtml(): string;
+ removeSelection(): Promise<void>;
+ }
+
+ interface EditorConfig {
+ syntaxHighlighting?: {
+ loadHighlightJs: () => Promise<any>;
+ mapLanguageName(mimeType: string): string;
+ defaultMimeType: string;
+ enabled: boolean;
+ },
+ moveBlockUp?: {
+ keystroke: string[];
+ },
+ moveBlockDown?: {
+ keystroke: string[];
+ },
+ clipboard?: {
+ copy(text: string): void;
+ }
+ }
+}