chore(ckeditor5): type errors due to augmentation

This commit is contained in:
Elian Doran 2025-05-28 20:46:33 +03:00
parent 26c1cbeff1
commit 395bc372ce
No known key found for this signature in database
4 changed files with 27 additions and 27 deletions

View File

@ -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";
}
/**

View File

@ -111,7 +111,7 @@ export function buildConfig(): EditorConfig {
},
mapLanguageName: getHighlightJsNameForMime,
defaultMimeType: MIME_TYPE_AUTO,
enabled: isSyntaxHighlightEnabled
enabled: isSyntaxHighlightEnabled()
},
clipboard: {
copy: copyText

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}