diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 0f2ac1d49b..4671bb7bc8 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -160,7 +160,7 @@ module.exports = { * ESLint Plugin: Import * ===================================================================== */ - "import/no-extraneous-dependencies": ["error", { optionalDependencies: false }], + "import/no-extraneous-dependencies": ["error", { optionalDependencies: false, devDependencies: true }], /* * ===================================================================== * ESLint Plugin: JSDoc diff --git a/app/package.json b/app/package.json index d0d92b8409..af013a7445 100644 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,7 @@ { "name": "@coremedia/ckeditor5-app", "description": "A custom CKEditor 5 build made by the CKEditor 5 online builder.", - "version": "21.0.0", + "version": "20.1.0", "author": { "name": "CoreMedia GmbH", "email": "info@coremedia.com", @@ -15,60 +15,35 @@ "license": "Apache-2.0", "private": true, "dependencies": { - "@ckeditor/ckeditor5-alignment": "43.2.0", - "@ckeditor/ckeditor5-autoformat": "43.2.0", - "@ckeditor/ckeditor5-autosave": "43.2.0", - "@ckeditor/ckeditor5-basic-styles": "43.2.0", - "@ckeditor/ckeditor5-block-quote": "43.2.0", - "@ckeditor/ckeditor5-clipboard": "43.2.0", - "@ckeditor/ckeditor5-code-block": "43.2.0", - "@ckeditor/ckeditor5-core": "43.2.0", - "@ckeditor/ckeditor5-editor-classic": "43.2.0", - "@ckeditor/ckeditor5-engine": "43.2.0", - "@ckeditor/ckeditor5-essentials": "43.2.0", - "@ckeditor/ckeditor5-find-and-replace": "43.2.0", - "@ckeditor/ckeditor5-font": "43.2.0", - "@ckeditor/ckeditor5-heading": "43.2.0", - "@ckeditor/ckeditor5-highlight": "43.2.0", - "@ckeditor/ckeditor5-image": "43.2.0", - "@ckeditor/ckeditor5-indent": "43.2.0", - "@ckeditor/ckeditor5-language": "43.2.0", - "@ckeditor/ckeditor5-link": "43.2.0", - "@ckeditor/ckeditor5-list": "43.2.0", - "@ckeditor/ckeditor5-paragraph": "43.2.0", - "@ckeditor/ckeditor5-paste-from-office": "43.2.0", - "@ckeditor/ckeditor5-remove-format": "43.2.0", - "@ckeditor/ckeditor5-source-editing": "43.2.0", - "@ckeditor/ckeditor5-table": "43.2.0", - "@ckeditor/ckeditor5-typing": "43.2.0", - "@ckeditor/ckeditor5-ui": "43.2.0", - "@ckeditor/ckeditor5-upload": "43.2.0", - "@ckeditor/ckeditor5-utils": "43.2.0", + "ckeditor5": "43.3.1", "@coremedia-internal/ckeditor5-coremedia-example-data": "^1.0.0", - "@coremedia/ckeditor5-bbcode": "^21.0.0", - "@coremedia/ckeditor5-coremedia-blocklist": "^21.0.0", - "@coremedia/ckeditor5-coremedia-content-clipboard": "^21.0.0", - "@coremedia/ckeditor5-coremedia-differencing": "^21.0.0", - "@coremedia/ckeditor5-coremedia-images": "^21.0.0", - "@coremedia/ckeditor5-coremedia-link": "^21.0.0", - "@coremedia/ckeditor5-coremedia-richtext": "^21.0.0", - "@coremedia/ckeditor5-coremedia-studio-essentials": "^21.0.0", - "@coremedia/ckeditor5-coremedia-studio-integration-mock": "^21.0.0", - "@coremedia/ckeditor5-data-facade": "^21.0.0", - "@coremedia/ckeditor5-dataprocessor-support": "^21.0.0", - "@coremedia/ckeditor5-dialog-visibility": "^21.0.0", - "@coremedia/ckeditor5-dom-converter": "^21.0.0", - "@coremedia/ckeditor5-font-mapper": "^21.0.0", - "@coremedia/ckeditor5-link-common": "^21.0.0", - "@coremedia/service-agent": "^2.0.1", + "@coremedia/ckeditor5-bbcode": "^20.1.0", + "@coremedia/ckeditor5-coremedia-blocklist": "^20.1.0", + "@coremedia/ckeditor5-coremedia-content-clipboard": "^20.1.0", + "@coremedia/ckeditor5-coremedia-differencing": "^20.1.0", + "@coremedia/ckeditor5-coremedia-images": "^20.1.0", + "@coremedia/ckeditor5-coremedia-link": "^20.1.0", + "@coremedia/ckeditor5-coremedia-richtext": "^20.1.0", + "@coremedia/ckeditor5-coremedia-studio-essentials": "^20.1.0", + "@coremedia/ckeditor5-coremedia-studio-integration-mock": "workspace:*", + "@coremedia/ckeditor5-data-facade": "^20.1.0", + "@coremedia/ckeditor5-dataprocessor-support": "^20.1.0", + "@coremedia/ckeditor5-dialog-visibility": "^20.1.0", + "@coremedia/ckeditor5-dom-converter": "^20.1.0", + "@coremedia/ckeditor5-font-mapper": "^20.1.0", + "@coremedia/ckeditor5-link-common": "^20.1.0", + "@coremedia/service-agent": "^1.1.5", "xml-formatter": "^3.6.2" }, "devDependencies": { - "@ckeditor/ckeditor5-dev-translations": "^40.3.1", - "@ckeditor/ckeditor5-dev-utils": "^40.3.1", + "@babel/core": "^7.25.2", + "@babel/plugin-transform-runtime": "^7.25.4", + "@ckeditor/ckeditor5-dev-translations": "^43.0.1", + "@ckeditor/ckeditor5-dev-utils": "^43.0.1", "@ckeditor/ckeditor5-inspector": "^4.1.0", - "@ckeditor/ckeditor5-theme-lark": "43.2.0", + "@ckeditor/ckeditor5-theme-lark": "43.3.1", "@types/node": "^20.14.10", + "babel-loader": "^8.3.0", "circular-dependency-plugin": "^5.2.2", "css-loader": "^7.1.2", "esbuild-loader": "^3.2.0", @@ -79,7 +54,7 @@ "rimraf": "^6.0.1", "style-loader": "^4.0.0", "terser-webpack-plugin": "^5.3.10", - "typescript": "^5.4.5", + "typescript": "5.4.5", "webpack": "^5.93.0", "webpack-cli": "^5.1.4" }, diff --git a/app/src/CKEditorInstanceFactory.ts b/app/src/CKEditorInstanceFactory.ts index 7629a576d0..8d05f944b2 100644 --- a/app/src/CKEditorInstanceFactory.ts +++ b/app/src/CKEditorInstanceFactory.ts @@ -1,4 +1,3 @@ import { ApplicationState } from "./ApplicationState"; -import { ClassicEditor } from "@ckeditor/ckeditor5-editor-classic"; - +import { ClassicEditor } from "ckeditor5"; export type CKEditorInstanceFactory = (sourceElement: HTMLElement, state: ApplicationState) => Promise; diff --git a/app/src/DataFormatter.ts b/app/src/DataFormatter.ts index e36f9f4bc5..56328cbf33 100644 --- a/app/src/DataFormatter.ts +++ b/app/src/DataFormatter.ts @@ -13,6 +13,6 @@ export const dataFormatter: { collapseContent: false, whiteSpaceAtEndOfSelfclosingTag: true, }) - : empty ?? "", - text: (data, empty) => (data ? data : empty ?? ""), + : (empty ?? ""), + text: (data, empty) => (data ? data : (empty ?? "")), }; diff --git a/app/src/createCKEditorInstance.ts b/app/src/createCKEditorInstance.ts index d852c8d34e..5b7abc789f 100644 --- a/app/src/createCKEditorInstance.ts +++ b/app/src/createCKEditorInstance.ts @@ -1,6 +1,5 @@ import { ApplicationState } from "./ApplicationState"; -import { ClassicEditor } from "@ckeditor/ckeditor5-editor-classic"; -import { Command, Editor } from "@ckeditor/ckeditor5-core"; +import { ClassicEditor, Command, Editor } from "ckeditor5"; import { CKEditorInstanceFactory } from "./CKEditorInstanceFactory"; import { Differencing } from "@coremedia/ckeditor5-coremedia-differencing"; import { initReadOnlyToggle } from "./ReadOnlySwitch"; @@ -17,21 +16,22 @@ import { initExamplesAndBindTo } from "./example-data"; // 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, options?: { isCollapsed?: boolean }): string[]; + static attach( + editorOrConfig: Editor | Record, + options?: { + isCollapsed?: boolean; + }, + ): string[]; } - export const editorElementId = "editor"; - export interface CKEditorInstanceFactories { bbcode: CKEditorInstanceFactory; richtext: CKEditorInstanceFactory; } - export const ckEditorInstanceFactories: CKEditorInstanceFactories = { bbcode: createBBCodeEditor, richtext: createRichTextEditor, }; - const attachInspector = (editor: Editor, { dataType, inspector }: ApplicationState): string[] => CKEditorInspector.attach( { @@ -43,7 +43,6 @@ const attachInspector = (editor: Editor, { dataType, inspector }: ApplicationSta isCollapsed: inspector === "collapsed", }, ); - const optionallyActivateDifferencing = (editor: Editor): void => { if (editor.plugins.has(Differencing)) { editor.plugins.get(Differencing).activateDifferencing(); @@ -57,7 +56,6 @@ const optionallyActivateDifferencing = (editor: Editor): void => { */ const registerResetUndo = (editor: Editor): void => { const undoCommand: Command | undefined = editor.commands.get("undo"); - if (undoCommand) { //@ts-expect-error Editor extension, no typing available. // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return @@ -98,14 +96,11 @@ const initializePreviewData = (editor: ClassicEditor, { dataType }: ApplicationS updatePreview(editor.getData(), "text"); } }; - export const createCKEditorInstance = async (state: ApplicationState): Promise => { const sourceElement = document.getElementById(editorElementId); - if (!sourceElement) { throw new Error(`Required element with id ${editorElementId} not defined in HTML.`); } - const { dataType, uiLanguage, readOnlyMode } = state; let factory: CKEditorInstanceFactory; switch (dataType) { @@ -118,29 +113,22 @@ export const createCKEditorInstance = async (state: ApplicationState): Promise { @@ -152,9 +140,7 @@ export const createCKEditorInstance = async (state: ApplicationState): Promise | V10CoreMediaRichTextConfig => { @@ -147,7 +169,6 @@ const getRichTextConfig = ( rules: richTextRuleConfigurations, }; }; - export const createRichTextEditor: CKEditorInstanceFactory = ( sourceElement: HTMLElement, state: ApplicationState, @@ -259,16 +280,49 @@ export const createRichTextEditor: CKEditorInstanceFactory = ( }, ], }, - heading: { options: [ - { model: "paragraph", title: "Paragraph", class: "ck-heading_paragraph" }, - { model: "heading1", view: "h1", title: "Heading 1", class: "ck-heading_heading1" }, - { model: "heading2", view: "h2", title: "Heading 2", class: "ck-heading_heading2" }, - { model: "heading3", view: "h3", title: "Heading 3", class: "ck-heading_heading3" }, - { model: "heading4", view: "h4", title: "Heading 4", class: "ck-heading_heading4" }, - { model: "heading5", view: "h5", title: "Heading 5", class: "ck-heading_heading5" }, - { model: "heading6", view: "h6", title: "Heading 6", class: "ck-heading_heading6" }, + { + model: "paragraph", + title: "Paragraph", + class: "ck-heading_paragraph", + }, + { + model: "heading1", + view: "h1", + title: "Heading 1", + class: "ck-heading_heading1", + }, + { + model: "heading2", + view: "h2", + title: "Heading 2", + class: "ck-heading_heading2", + }, + { + model: "heading3", + view: "h3", + title: "Heading 3", + class: "ck-heading_heading3", + }, + { + model: "heading4", + view: "h4", + title: "Heading 4", + class: "ck-heading_heading4", + }, + { + model: "heading5", + view: "h5", + title: "Heading 5", + class: "ck-heading_heading5", + }, + { + model: "heading6", + view: "h6", + title: "Heading 6", + class: "ck-heading_heading6", + }, ], }, link: { @@ -365,7 +419,10 @@ export const createRichTextEditor: CKEditorInstanceFactory = ( // that the same attributes are kept as is from CMS. For example, the // dir-attribute, which is valid for `` must not be removed just // because CKEditor is not configured to handle it. - { name: "mark", inherit: "span" }, + { + name: "mark", + inherit: "span", + }, ], }, // @ts-expect-error - TODO: Typing issues as it seems. @@ -379,7 +436,13 @@ export const createRichTextEditor: CKEditorInstanceFactory = ( }, [COREMEDIA_MOCK_CONTENT_PLUGIN]: { // Demonstrates, how you may add more contents on the fly. - contents: [{ id: 2, name: "Some Example Document", type: "document" }], + contents: [ + { + id: 2, + name: "Some Example Document", + type: "document", + }, + ], }, }).then((newEditor: ClassicEditor) => { initInputExampleContent(newEditor); diff --git a/app/src/example-data.ts b/app/src/example-data.ts index c2d64da8bd..1ae9e0557d 100644 --- a/app/src/example-data.ts +++ b/app/src/example-data.ts @@ -1,13 +1,12 @@ // noinspection HttpUrlsUsage -import { PREDEFINED_MOCK_LINK_DATA } from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/PredefinedMockContents"; -import { EditingView } from "@ckeditor/ckeditor5-engine"; +import { PREDEFINED_MOCK_LINK_DATA } from "@coremedia/ckeditor5-coremedia-studio-integration-mock"; import { bbCodeData, ExampleData, initExamples, richTextData, } from "@coremedia-internal/ckeditor5-coremedia-example-data"; -import { Editor } from "@ckeditor/ckeditor5-core"; +import { EditingView, Editor } from "ckeditor5"; import { DataFacade } from "@coremedia/ckeditor5-data-facade"; const exampleData: { @@ -20,9 +19,7 @@ const exampleData: { }, bbcode: bbCodeData, }; - export type ExampleDataType = keyof typeof exampleData; - const dumpEditingViewOnRender = (editor: Editor): void => { const { editing: { view }, @@ -45,7 +42,6 @@ const dumpEditingViewOnRender = (editor: Editor): void => { }, ); }; - const dumpDataViewOnRender = (editor: Editor): void => { const { data } = editor; data.once( @@ -54,14 +50,13 @@ const dumpDataViewOnRender = (editor: Editor): void => { console.log("CKEditor's Data-Controller received data via 'set'.", { event, // eslint-disable-next-line - data: details[0], + data: details[0] }), { priority: "lowest", }, ); }; - export const initExamplesAndBindTo = (editor: Editor, examplesType: ExampleDataType = "richtext"): void => { initExamples({ id: "examples", diff --git a/app/src/index.ts b/app/src/index.ts index 21002cc99b..e4a153533f 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -1,6 +1,7 @@ import { createCKEditorInstance } from "./createCKEditorInstance"; import { ApplicationState } from "./ApplicationState"; import { getHashParams } from "./HashParams"; +import "ckeditor5/ckeditor5.css"; // setup input example content IFrame const showHideExampleContentButton = document.querySelector("#inputExampleContentButton"); diff --git a/app/src/inputExampleContents.ts b/app/src/inputExampleContents.ts index dd26208e4e..40c2635f15 100644 --- a/app/src/inputExampleContents.ts +++ b/app/src/inputExampleContents.ts @@ -1,11 +1,11 @@ -import MockContentPlugin from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockContentPlugin"; -import { ClassicEditor } from "@ckeditor/ckeditor5-editor-classic"; -import MockInputExamplePlugin, { +import { + MockContentPlugin, + MockInputExamplePlugin, InputExampleElement, -} from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockInputExamplePlugin"; +} from "@coremedia/ckeditor5-coremedia-studio-integration-mock"; +import { ClassicEditor } from "ckeditor5"; const INPUT_EXAMPLE_CONTENT_DIV_CLASS = "inputExampleContentDiv"; - const initInputExampleContent = (editor: ClassicEditor) => { const mockContentPlugin = editor.plugins.get(MockContentPlugin); const mockInputExamplePlugin = editor.plugins.get(MockInputExamplePlugin); @@ -21,7 +21,6 @@ const initInputExampleContent = (editor: ClassicEditor) => { name: "Not insertable Content Type", linkable: false, }); - const singleInputDocuments: InputExampleElement[] = [ { label: "Document 1", @@ -96,7 +95,6 @@ const initInputExampleContent = (editor: ClassicEditor) => { items: [requireExplicitContent(906)], }, ]; - const singleInputs = [ { label: "Root", @@ -220,53 +218,82 @@ const initInputExampleContent = (editor: ClassicEditor) => { }, { label: `Insertable Documents (incl. Slow)`, - tooltip: `${singleInputDocuments.length + slowDocuments.length} including ${ - slowDocuments.length - } documents at the start which load slowly.`, + tooltip: `${singleInputDocuments.length + slowDocuments.length} including ${slowDocuments.length} documents at the start which load slowly.`, classes: ["linkable", "type-collection"], items: slowDocuments.concat(singleInputDocuments).flatMap((item) => item.items), }, ]; - const externalContents: InputExampleElement[] = [ { label: "Insertable external content", tooltip: "Insertable External Content", classes: ["linkable"], - items: [{ externalId: 2000 }], + items: [ + { + externalId: 2000, + }, + ], }, { label: "Already imported external content", tooltip: "Already imported external Content", classes: ["linkable"], - items: [{ externalId: 2002 }], + items: [ + { + externalId: 2002, + }, + ], }, { label: "Not insertable external content", tooltip: "Not droppable external content (Unknown type)", classes: ["non-linkable"], - items: [{ externalId: 2004 }], + items: [ + { + externalId: 2004, + }, + ], }, { label: "Multiple insertable external contents", tooltip: "Multiple insertable external contents", classes: ["linkable"], - items: [{ externalId: 2000 }, { externalId: 2002 }], + items: [ + { + externalId: 2000, + }, + { + externalId: 2002, + }, + ], }, { label: "Multiple external contents (including not insertable)", tooltip: "Multiple external contents (including not insertable)", classes: ["non-linkable"], - items: [{ externalId: 2000 }, { externalId: 2002 }, { externalId: 2004 }], + items: [ + { + externalId: 2000, + }, + { + externalId: 2002, + }, + { + externalId: 2004, + }, + ], }, { label: "External content - error", tooltip: "External content - error", classes: ["linkable"], - items: [{ externalId: 2006 }], + items: [ + { + externalId: 2006, + }, + ], }, ]; - const allData: InputExampleElement[] = [ ...singleInputs, ...singleInputsNotInsertable, @@ -277,25 +304,28 @@ const initInputExampleContent = (editor: ClassicEditor) => { ...createBulkOf50Contents(), ...externalContents, ]; - const main = () => { const examplesEl = document.getElementById(INPUT_EXAMPLE_CONTENT_DIV_CLASS); if (!examplesEl) { console.error(`Required element missing: ${INPUT_EXAMPLE_CONTENT_DIV_CLASS}`); return; } - allData.forEach((data) => { const insertDiv: HTMLDivElement = mockInputExamplePlugin.createInsertElement(data); examplesEl.appendChild(insertDiv); }); console.log(`Initialized ${allData.length} insert examples.`); }; - main(); }; - -const createBulkOf50Contents = (): [{ classes: string[]; tooltip: string; label: string; items: number[] }] => { +const createBulkOf50Contents = (): [ + { + classes: string[]; + tooltip: string; + label: string; + items: number[]; + }, +] => { const ids = []; for (let i = 13000; i < 13100; i = i + 2) { ids.push(i); diff --git a/app/tsconfig.json b/app/tsconfig.json index 36aefa2d39..96b2a467a8 100644 --- a/app/tsconfig.json +++ b/app/tsconfig.json @@ -1,7 +1,19 @@ { "extends": "../tsconfig.json", + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "moduleResolution": "Bundler", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, "include": [ "./sample", - "./src", + "./src" + ], + "exclude": [ + "node_modules" ] } diff --git a/itest/jest.local.js b/itest/jest.local.js index 8d195c1158..7cbca0fdaf 100644 --- a/itest/jest.local.js +++ b/itest/jest.local.js @@ -1,4 +1,4 @@ -const jestConfig = require("./jest.config.js"); +const jestConfig = require("./jest.config.cjs"); const localPlaywrightConfig = require("./jest-playwright.local.js"); module.exports = { diff --git a/itest/package.json b/itest/package.json index 64f412d389..ca4da04656 100644 --- a/itest/package.json +++ b/itest/package.json @@ -1,6 +1,6 @@ { "name": "@coremedia/ckeditor5-coremedia-itest", - "version": "21.0.0", + "version": "20.1.0", "description": "Integration Tests for CKEditor 5", "author": { "name": "CoreMedia GmbH", @@ -17,17 +17,14 @@ }, "license": "Apache-2.0", "devDependencies": { - "@ckeditor/ckeditor5-core": "^43.2.0", - "@ckeditor/ckeditor5-editor-classic": "^43.2.0", - "@ckeditor/ckeditor5-engine": "^43.2.0", - "@ckeditor/ckeditor5-link": "^43.2.0", - "@ckeditor/ckeditor5-ui": "^43.2.0", + "ckeditor5": "43.3.1", "@coremedia-internal/ckeditor5-coremedia-example-data": "^1.0.0", "@coremedia-internal/ckeditor5-jest-test-helpers": "^1.0.0", - "@coremedia/ckeditor5-coremedia-link": "^21.0.0", - "@coremedia/ckeditor5-coremedia-richtext": "^21.0.0", - "@coremedia/ckeditor5-coremedia-studio-integration": "^21.0.0", - "@coremedia/ckeditor5-coremedia-studio-integration-mock": "^21.0.0", + "@coremedia/ckeditor5-coremedia-link": "^20.1.0", + "@coremedia/ckeditor5-coremedia-richtext": "^20.1.0", + "@coremedia/ckeditor5-coremedia-studio-integration": "^20.1.0", + "@coremedia/ckeditor5-coremedia-studio-integration-mock": "^20.1.0", + "@jest/globals": "^29.7.0", "@types/express": "^4.17.21", "@types/jest": "^29.5.12", "@types/node": "^20.14.10", @@ -44,7 +41,7 @@ "playwright-core": "^1.45.1", "rimraf": "^6.0.1", "tslib": "^2.6.3", - "typescript": "^5.4.5", + "typescript": "5.4.5", "wait-for-expect": "^3.0.2" }, "scripts": { diff --git a/itest/src/Blocklist.test.ts b/itest/src/Blocklist.test.ts index 2a5c64ed9f..b6c1492d52 100644 --- a/itest/src/Blocklist.test.ts +++ b/itest/src/Blocklist.test.ts @@ -1,5 +1,5 @@ import { ApplicationWrapper } from "./aut/ApplicationWrapper"; -import { richtext, p } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichTextBase"; +import { richtext, p } from "@coremedia-internal/ckeditor5-coremedia-example-data"; import "./expect/Expectations"; import { ctrlOrMeta } from "./browser/UserAgent"; import { clickModifiers } from "./aria/KeyboardUtils"; diff --git a/itest/src/BlocklistCollapsed.test.ts b/itest/src/BlocklistCollapsed.test.ts index 1e44f991ea..d7d267baf1 100644 --- a/itest/src/BlocklistCollapsed.test.ts +++ b/itest/src/BlocklistCollapsed.test.ts @@ -1,5 +1,4 @@ -import { MockServiceAgentPluginWrapper } from "./aut/services/MockServiceAgentPluginWrapper"; -import { p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichTextBase"; +import { p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; import { ApplicationWrapper } from "./aut/ApplicationWrapper"; import { clickModifiers } from "./aria/KeyboardUtils"; import "./expect/Expectations"; @@ -29,7 +28,7 @@ describe("Blocklist", () => { describe("Blocklist", () => { it("Collapsed selection shows balloon", async () => { const blockedWord = "thisisablockedword"; - const serviceAgent: MockServiceAgentPluginWrapper = application.mockServiceAgent; + const serviceAgent = application.mockServiceAgent; await serviceAgent.getBlocklistServiceWrapper().addWord(blockedWord); const data = richtext(`${p("Hello World!")}${p(blockedWord)}${p("This is an example text for test purposes.")}`); diff --git a/itest/src/BlocklistExpandedKeyboard.test.ts b/itest/src/BlocklistExpandedKeyboard.test.ts index 4468bf9df9..0e03d1357d 100644 --- a/itest/src/BlocklistExpandedKeyboard.test.ts +++ b/itest/src/BlocklistExpandedKeyboard.test.ts @@ -1,8 +1,9 @@ import "./expect/Expectations"; import { ApplicationWrapper } from "./aut/ApplicationWrapper"; import { MockServiceAgentPluginWrapper } from "./aut/services/MockServiceAgentPluginWrapper"; -import { p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichTextBase"; +import { p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; import { ctrlOrMeta } from "./browser/UserAgent"; + describe("Blocklist", () => { let application: ApplicationWrapper; diff --git a/itest/src/BlocklistExpandedToolbar.test.ts b/itest/src/BlocklistExpandedToolbar.test.ts index 88189317aa..4868a32f40 100644 --- a/itest/src/BlocklistExpandedToolbar.test.ts +++ b/itest/src/BlocklistExpandedToolbar.test.ts @@ -1,6 +1,6 @@ import { ApplicationWrapper } from "./aut/ApplicationWrapper"; import { MockServiceAgentPluginWrapper } from "./aut/services/MockServiceAgentPluginWrapper"; -import { p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichTextBase"; +import { p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; import { ctrlOrMeta } from "./browser/UserAgent"; import "./expect/Expectations"; diff --git a/itest/src/ContentLink.test.ts b/itest/src/ContentLink.test.ts index 48ee83dc32..5d42b713df 100644 --- a/itest/src/ContentLink.test.ts +++ b/itest/src/ContentLink.test.ts @@ -1,7 +1,7 @@ import "./expect/Expectations"; import { ApplicationWrapper } from "./aut/ApplicationWrapper"; -import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration/src/content/UriPath"; -import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichTextBase"; +import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration"; +import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; import { ctrlOrMeta } from "./browser/UserAgent"; import { expectFocusedElementHasAriaText, tabToAriaLabel } from "./aria/AriaUtils"; diff --git a/itest/src/Differencing.test.ts b/itest/src/Differencing.test.ts index 2e320f6f81..6b02c9da7a 100644 --- a/itest/src/Differencing.test.ts +++ b/itest/src/Differencing.test.ts @@ -1,9 +1,14 @@ import { ApplicationWrapper } from "./aut/ApplicationWrapper"; -import { richtext, p, strong } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichText"; -import { Differencing, EOD } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/Differencing"; +import { + richtext, + p, + strong, + Differencing, + EOD, + blobReference, +} from "@coremedia-internal/ckeditor5-coremedia-example-data"; import "./expect/Expectations"; -import { PNG_BLUE_240x135 } from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockFixtures"; -import { blobReference } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/Images"; +import { PNG_BLUE_240x135 } from "./MockFixtures"; const xdiff = new Differencing(); diff --git a/itest/src/DocumentLists.test.ts b/itest/src/DocumentLists.test.ts index 3bacf07424..72072f53b7 100644 --- a/itest/src/DocumentLists.test.ts +++ b/itest/src/DocumentLists.test.ts @@ -17,9 +17,9 @@ import { td, tr, ul, -} from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichText"; + blobReference, +} from "@coremedia-internal/ckeditor5-coremedia-example-data"; import "./expect/Expectations"; -import { blobReference } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/Images"; const olString = "ol"; const ulString = "ul"; diff --git a/itest/src/DragDrop.test.ts b/itest/src/DragDrop.test.ts index f17a737f65..9f86488d5f 100644 --- a/itest/src/DragDrop.test.ts +++ b/itest/src/DragDrop.test.ts @@ -1,18 +1,18 @@ import { ApplicationWrapper } from "./aut/ApplicationWrapper"; -import { richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichText"; +import { richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; import "./expect/Expectations"; -import { InputExampleElement } from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockInputExamplePlugin"; +import type { + InputExampleElement, + MockContentConfig, + MockExternalContent, +} from "@coremedia/ckeditor5-coremedia-studio-integration-mock"; +import { PNG_BLUE_240x135, PNG_GREEN_240x135, PNG_RED_240x135 } from "./MockFixtures"; import waitForExpect from "wait-for-expect"; -import { MockContentConfig } from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockContent"; -import { - PNG_BLUE_240x135, - PNG_GREEN_240x135, - PNG_RED_240x135, -} from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockFixtures"; -import { IsDroppableEvaluationResult } from "@coremedia/ckeditor5-coremedia-studio-integration/src/content/IsDroppableInRichtext"; -import { MockExternalContent } from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockExternalContentPlugin"; +import type { + IsDroppableEvaluationResult, + IsLinkableEvaluationResult, +} from "@coremedia/ckeditor5-coremedia-studio-integration"; import WindowBrowserAccessor from "./browser/WindowBrowserAccessor"; -import { IsLinkableEvaluationResult } from "@coremedia/ckeditor5-coremedia-studio-integration/src/content/IsLinkableDragAndDrop"; const oneLink: MockContentConfig[] = [ { diff --git a/itest/src/HelloEditor.test.ts b/itest/src/HelloEditor.test.ts index 662e31b01d..9a7d63d9af 100644 --- a/itest/src/HelloEditor.test.ts +++ b/itest/src/HelloEditor.test.ts @@ -1,7 +1,7 @@ import { ApplicationWrapper } from "./aut/ApplicationWrapper"; import "./expect/Expectations"; -import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration/src/content/UriPath"; -import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichText"; +import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration"; +import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; /** * Provides some first test mainly for demonstration purpose of the test API. diff --git a/itest/src/Images.test.ts b/itest/src/Images.test.ts index 4eea8f76e2..bdaa3672b8 100644 --- a/itest/src/Images.test.ts +++ b/itest/src/Images.test.ts @@ -1,22 +1,23 @@ import { ApplicationWrapper } from "./aut/ApplicationWrapper"; -import { - PNG_EMPTY_24x24, - PNG_LOCK_24x24, - PNG_RED_240x135, -} from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockFixtures"; +import type { MockContentConfig } from "@coremedia/ckeditor5-coremedia-studio-integration-mock"; +import { PNG_EMPTY_24x24, PNG_LOCK_24x24, PNG_RED_240x135 } from "./MockFixtures"; import "./expect/Expectations"; import { ElementHandle } from "playwright-core"; -import { blobReference } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/Images"; -import { a, img, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichText"; +import { + blobReference, + a, + img, + p, + richtext, + linkReference, +} from "@coremedia-internal/ckeditor5-coremedia-example-data"; import { MockServiceAgentPluginWrapper } from "./aut/services/MockServiceAgentPluginWrapper"; -import { linkReference } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/Links"; import { ClassicEditorWrapper } from "./aut/ClassicEditorWrapper"; import ToolbarViewWrapper from "./aut/components/ToolbarViewWrapper"; import ImageContextualBalloonToolbar from "./aut/components/balloon/ImageContextualBalloonToolbar"; import LinkActionsViewWrapper from "./aut/components/balloon/LinkActionsViewWrapper"; import ContentLinkViewWrapper from "./aut/components/balloon/ContentLinkViewWrapper"; import waitForExpect from "wait-for-expect"; -import { MockContentConfig } from "@coremedia/ckeditor5-coremedia-studio-integration-mock/src/content/MockContent"; describe("Image Features", () => { let application: ApplicationWrapper; diff --git a/itest/src/LinkBalloon.test.ts b/itest/src/LinkBalloon.test.ts index 56f04ad301..5ede6728df 100644 --- a/itest/src/LinkBalloon.test.ts +++ b/itest/src/LinkBalloon.test.ts @@ -1,7 +1,7 @@ import "./expect/Expectations"; import { ApplicationWrapper } from "./aut/ApplicationWrapper"; -import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration/src/content/UriPath"; -import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichTextBase"; +import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration"; +import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; describe("Link Balloon", () => { let application: ApplicationWrapper; diff --git a/itest/src/LinkUserInteraction.test.ts b/itest/src/LinkUserInteraction.test.ts index b9a09c0dab..fbd07c29a2 100644 --- a/itest/src/LinkUserInteraction.test.ts +++ b/itest/src/LinkUserInteraction.test.ts @@ -1,6 +1,6 @@ import { ApplicationWrapper } from "./aut/ApplicationWrapper"; -import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration/src/content/UriPath"; -import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data/src/RichTextBase"; +import { contentUriPath } from "@coremedia/ckeditor5-coremedia-studio-integration"; +import { a, p, richtext } from "@coremedia-internal/ckeditor5-coremedia-example-data"; import { MockServiceAgentPluginWrapper } from "./aut/services/MockServiceAgentPluginWrapper"; import "./expect/Expectations"; import { Page } from "playwright"; diff --git a/itest/src/MockFixtures.ts b/itest/src/MockFixtures.ts new file mode 100644 index 0000000000..08309eef02 --- /dev/null +++ b/itest/src/MockFixtures.ts @@ -0,0 +1,70 @@ +/* eslint @typescript-eslint/naming-convention: off */ + +/** + * Example Blob Fixture for 10×10 Red PNG. + */ +export const PNG_RED_10x10 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAQMAAAC3/F3+AAAAA1BMVEX/AAAZ4gk3AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAACklEQVQIHWPACwAAHgAB95hMXAAAAABJRU5ErkJggg=="; +/** + * Example Blob Fixture for 240×135 Red PNG. + */ +export const PNG_RED_240x135 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAACHCAIAAACnEEO8AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACB0RVh0VGl0bGUAUmVkIEltYWdlIEZpeHR1cmUgMjQww5cxMzV/6oVFAAABEklEQVR42u3SAQkAAAgEMbV/5zeGIFuE4zoFf4wEGBoMDYYGQ2NoMDQYGgwNhsbQYGgwNBgaDI2hwdBgaDA0GBpDg6HB0GBoMDSGBkODocHQYGgMDYYGQ4OhwdAYGgwNhgZDY2gwNBgaDA2GxtBgaDA0GBoMjaHB0GBoMDQYGkODocHQYGgwNIYGQ4OhwdBgaAwNhgZDg6HB0BgaDA2GBkODoTE0GBoMDYbG0GBoMDQYGgyNocHQYGgwNBgaQ4OhwdBgaDA0hgZDg6HB0GBoDA2GBkODocHQGBoMDYYGQ4OhMTQYGgwNhsbQYGgwNBgaDI2hwdBgaDA0GBpDg6HB0GBoMDSGBkODocHQYGgMDYaGMwvY/gIN7U7I3gAAAABJRU5ErkJggg=="; +/** + * Example Blob Fixture for 10×10 Green PNG. + */ +export const PNG_GREEN_10x10 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAQMAAAC3/F3+AAAAA1BMVEUA/wA0XsCoAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAACklEQVQIHWPACwAAHgAB95hMXAAAAABJRU5ErkJggg=="; +/** + * Example Blob Fixture for 240×135 Green PNG. + */ +export const PNG_GREEN_240x135 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAACHCAIAAACnEEO8AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACJ0RVh0VGl0bGUAR3JlZW4gSW1hZ2UgRml4dHVyZSAyNDDDlzEzNeoCT9oAAAESSURBVHja7dIBCQAACASx1/6dNYYgW4TjKhN4oyXA0GBoMDQYGkODocHQYGgwNIYGQ4OhwdBgaAwNhgZDg6HB0BgaDA2GBkODoTE0GBoMDYYGQ2NoMDQYGgwNhsbQYGgwNBgaQ4OhwdBgaDA0hgZDg6HB0GBoDA2GBkODocHQGBoMDYYGQ4OhMTQYGgwNhgZDY2gwNBgaDA2GxtBgaDA0GBoMjaHB0GBoMDSGBkODocHQYGgMDYYGQ4OhwdAYGgwNhgZDg6ExNBgaDA2GBkNjaDA0GBoMDYbG0GBoMDQYGgyNocHQYGgwNIYGQ4OhwdBgaAwNhgZDg6HB0BgaDA2GBkODoTE0GBoMDYYGQ2NoMDScWdf/Ag1zS0U/AAAAAElFTkSuQmCC"; +/** + * Example Blob Fixture for 10×10 Blue PNG. + */ +export const PNG_BLUE_10x10 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAQMAAAC3/F3+AAAAA1BMVEUAAP+KeNJXAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAACklEQVQIHWPACwAAHgAB95hMXAAAAABJRU5ErkJggg=="; +/** + * Example Blob Fixture for 240×135 Blue PNG. + */ +export const PNG_BLUE_240x135 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAACHCAIAAACnEEO8AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACF0RVh0VGl0bGUAQmx1ZSBJbWFnZSBGaXh0dXJlIDI0MMOXMTM1kw6skwAAARNJREFUeNrt0gEJAAAIBLHX/p01hiBbhOMqmcAXLQGGBkODocHQGBoMDYYGQ4OhMTQYGgwNhgZDY2gwNBgaDA2GxtBgaDA0GBoMjaHB0GBoMDQYGkODocHQYGgwNIYGQ4OhwdAYGgwNhgZDg6ExNBgaDA2GBkNjaDA0GBoMDYbG0GBoMDQYGgyNocHQYGgwNBgaQ4OhwdBgaDA0hgZDg6HB0GBoDA2GBkODoTE0GBoMDYYGQ2NoMDQYGgwNhsbQYGgwNBgaDI2hwdBgaDA0GBpDg6HB0GBoMDSGBkODocHQYGgMDYYGQ4OhMTQYGgwNhgZDY2gwNBgaDA2GxtBgaDA0GBoMjaHB0GBoMDQYGkODoeHMAtcAAg2/P7w5AAAAAElFTkSuQmCC"; +/** + * Example Blob Fixture for 10×10 Gray PNG. + */ +export const PNG_GRAY_10x10 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKBAMAAAB/HNKOAAAAMFBMVEXIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMgyCeFrAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAC0lEQVQIHWOgAAAAADwAAZFvo9AAAAAASUVORK5CYII="; +/** + * Example Blob Fixture for unreadable state as 24×24 lock-symbol PNG. + */ +export const PNG_LOCK_24x24 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAB90RVh0VGl0bGUATG9jayBJbWFnZSBGaXh0dXJlIDI0w5cyND+RntEAAAFYSURBVEiJ7ZUxq4JQGIYfL2kRBUK0tDZY0C9pcmlMpCIa+ymtTUKr0OCU/6ExCIuoxYZAcLMMvHe6LabhJYcLvdPhnPO+D+f7PjjCer3+Jkd95RkOUHh1IQxDlsslq9WKw+EAQLPZpNvtoqoqkiSl+oW0El0uF6bTKbvdDlmW6XQ6AGw2G3zfR1EUZrMZ9Xo9O+B+v6PrOvv9nslkQr/fRxTFx9lisWA+n6MoCoZhUCg8L0ZiDyzLwnEcxuMxg8HgEQ4giiLD4ZDRaMR2u8WyrMQXJAJs26ZaraJpWqJZ13UqlQq2bWcHnE4n2u12ahMlSaLVanE8HrMDgiCgVColGn9VLpcJgiA74F3KHRAb0zAM6fV6nM9nisUitVotNcDzPG63G41GA9M0Yz2LDW8URbiuC8D1en2sX8l1XaIoiu3//x58AB9ADgBBEP4c9syb+mW+Q7mX6AcWeH9EMzKhnwAAAABJRU5ErkJggg=="; +/** + * Example Blob Fixture for empty state as 24×24 symbol PNG. + */ +export const PNG_EMPTY_24x24 = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACB0RVh0VGl0bGUARW1wdHkgSW1hZ2UgRml4dHVyZSAyNMOXMjRSzyF5AAABjklEQVRIidWUsYrCQBRFz0osJIiViKCIFv5AwEZSpLRMo1jkEyyENGKjtWBj5Q+k9QOsRCSIWitioSgWgoKmd7dYtFkTE0mKvdUMb949M+/NzNd8Pv8mQIWCNAcQ7AKXywXTNJlOp+x2O06nE+fzmWg0Si6XQ1EUVFUlEok4Ar7sStTtdjEMwzE5nU7T6/VIpVLeT/CQJEkUi0UymQyCIHA8HhkMBqzXa/b7PfV6HcMwCIfD3k4wHo9JJBLk8/k/sfv9TrPZZDgcAtDpdFAU5SXAtsmyLL80BwiFQqiq+pyvVis7m89vUTwed7XuY8Bms3mOs9msvwDLsuj3+wDEYjFkWfYPcL1e0XWd7XYLgK7riKLoD8A0TarVKovFAkEQaDQalEolx5y37wDgdrvRbrcZjUYAJJNJWq0WkiS9zXUFOBwOT/NyuUytVnv7RTzkuQeVSsW1+UcAr3JVIlEUKRQKAJ52Dw5/kV8KvESuALPZDE3T0DSNyWTiCeCqB5ZlsVwugd+X7EWBl+j/N/kHBzKDUUt0TnMAAAAASUVORK5CYII="; + +/** + * A content name containing several entities. + */ +export const CONTENT_NAME_CHALLENGE_ENTITIES = "<br>&"Ɯ"; +/** + * A content name with various charsets. + */ +export const CONTENT_NAME_CHALLENGE_CHARSETS = "年Ϩ"; +/** + * A content name with RTL characters. + */ +export const CONTENT_NAME_CHALLENGE_RTL = "عامعام"; +/** + * A content name, which challenges possible Cross-Site-Scripting-Attacks. + */ +export const CONTENT_NAME_CHALLENGE_XSS = `