diff --git a/apps/client/src/services/syntax_highlight.ts b/apps/client/src/services/syntax_highlight.ts index bfe887b9d..cb2d4d873 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 93eea459d..5a3262a1c 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 da5e1c915..c1018db37 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; - } - - interface EditorConfig { - syntaxHighlighting?: { - loadHighlightJs: () => Promise; - 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 8dc0e3611..58e72ca6d 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; + } + + interface EditorConfig { + syntaxHighlighting?: { + loadHighlightJs: () => Promise; + mapLanguageName(mimeType: string): string; + defaultMimeType: string; + enabled: boolean; + }, + moveBlockUp?: { + keystroke: string[]; + }, + moveBlockDown?: { + keystroke: string[]; + }, + clipboard?: { + copy(text: string): void; + } + } +}