Skip to content

Commit

Permalink
refactor(app): Add Typings for CKEditorInspector
Browse files Browse the repository at this point in the history
As stated in ckeditor/ckeditor5-inspector#173, `CKEditorInspector`
does not ship with typings yet. Providing some adhoc typings
instead.
  • Loading branch information
mmichaelis committed Apr 18, 2023
1 parent e6cd8b5 commit b74eb4d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/src/ckeditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import CoreMediaStudioEssentials, {
import { initInputExampleContent } from "./inputExampleContents";
import { COREMEDIA_MOCK_CONTENT_PLUGIN } from "@coremedia/ckeditor5-coremedia-studio-integration-mock/content/MockContentPlugin";

import { Command, icons, PluginConstructor } from "@ckeditor/ckeditor5-core";
import { Command, Editor, icons, PluginConstructor } from "@ckeditor/ckeditor5-core";
import { saveData } from "./dataFacade";
import MockInputExamplePlugin from "@coremedia/ckeditor5-coremedia-studio-integration-mock/content/MockInputExamplePlugin";
import PasteContentPlugin from "@coremedia/ckeditor5-coremedia-content-clipboard/paste/PasteContentPlugin";
Expand All @@ -57,6 +57,15 @@ import { COREMEDIA_LINK_CONFIG_KEY } from "@coremedia/ckeditor5-coremedia-link/c
import { LinkAttributesConfig } from "@coremedia/ckeditor5-link-common/LinkAttributesConfig";
import { LinkAttributes } from "@coremedia/ckeditor5-link-common/LinkAttributes";

/**
* Typings for CKEditorInspector, as it does not ship with typings yet.
*/
// See https://github.com/ckeditor/ckeditor5-inspector/issues/173
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
declare class CKEditorInspector {
static attach(editorOrConfig: Editor | Record<string, Editor>, options?: { isCollapsed?: boolean }): string[];
}

const {
objectInline: withinTextIcon,
objectLeft: alignLeftIcon,
Expand Down Expand Up @@ -371,8 +380,6 @@ ClassicEditor.create(sourceElement, {
},
})
.then((newEditor: ClassicEditor) => {
// @ts-expect-error imported in html
// eslint-disable-next-line
CKEditorInspector.attach(
{
"main-editor": newEditor,
Expand Down

0 comments on commit b74eb4d

Please sign in to comment.