Skip to content

Commit

Permalink
Merge pull request #13708 from ckeditor/ck/13707
Browse files Browse the repository at this point in the history
Other (editor-*): Exposed Context, EditorWatchdog, and ContextWatchdog as static editor properties. Closes #13707.

MINOR BREAKING CHANGE: The Watchdog package is no longer available as a standalone DLL build. It is now included in the main ckeditor5-dll.js build. See #13707.
  • Loading branch information
arkflpc authored Mar 21, 2023
2 parents 7273b6a + 201a059 commit 8933c86
Show file tree
Hide file tree
Showing 33 changed files with 244 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ modified_at: 2022-02-21

A DLL build of the editor consists of the following parts:

* **Base DLL build**. It is a single JavaScript file that combines the contents of several core CKEditor 5 packages: `utils`, `core`, `engine`, `ui`, `clipboard`, `enter`, `paragraph`, `select-all`, `typing`, `undo`, `upload`, and `widget`. These packages are either the framework core, or are features used by nearly all editor installations. The build is available on NPM in `ckeditor5` package.
* **Base DLL build**. It is a single JavaScript file that combines the contents of several core CKEditor 5 packages: `utils`, `core`, `engine`, `ui`, `clipboard`, `enter`, `paragraph`, `select-all`, `typing`, `undo`, `upload`, `widget`, and `watchdog`. These packages are either the framework core, or are features used by nearly all editor installations. The build is available on NPM in `ckeditor5` package.
* **Base DLL build for CKEditor 5 Collaboration Features**. It is a single JavaScript file that includes all necessary files for the collaboration features packages and extends the base DLL for CKEditor 5. The build is available on NPM in `ckeditor5-collaboration` package.
* **DLL-compatible package builds**. Every package that is not a part of the base DLL builds, is built into a DLL-compatible JavaScript file. The CKEditor 5 Collaboration Features DLL builds are available in this format as well. These DLLs are available on NPM in `@ckeditor/ckeditor5-[FEATURE_NAME]` packages.

Expand Down Expand Up @@ -68,7 +68,6 @@ Below is an example of an integration:
<script src="path/to/node_modules/@ckeditor/ckeditor5-paste-from-office/build/paste-from-office.js"></script>
<script src="path/to/node_modules/@ckeditor/ckeditor5-table/build/table.js"></script>
<script src="path/to/node_modules/@ckeditor/ckeditor5-cloud-services/build/cloud-services.js"></script>
<script src="path/to/node_modules/@ckeditor/ckeditor5-watchdog/build/watchdog.js"></script>

<!-- Base DLL build for Collaboration features -->
<script src="path/to/node_modules/ckeditor5-collaboration/build/ckeditor5-collaboration-dll.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/advanced/dll-builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CKEditor 5 comes with ready-to-use DLL builds. These builds are added to the NPM

A DLL build of the editor consists of two parts:

* **Base DLL build**. It is a single JavaScript file that combines the contents of several core CKEditor 5 packages: `utils`, `core`, `engine`, `ui`, `clipboard`, `enter`, `paragraph`, `select-all`, `typing`, `undo`, `upload`, and `widget`. These packages are either the framework core, or are features used by nearly all editor installations. The build is available on NPM in `ckeditor5` package.
* **Base DLL build**. It is a single JavaScript file that combines the contents of several core CKEditor 5 packages: `utils`, `core`, `engine`, `ui`, `clipboard`, `enter`, `paragraph`, `select-all`, `typing`, `undo`, `upload`, `widget`, and `watchdog`. These packages are either the framework core, or are features used by nearly all editor installations. The build is available on NPM in `ckeditor5` package.
* **DLL-compatible package builds**. Every package that is not part of the base DLL build is built into a DLL-compatible JavaScript file. These DLLs are available on NPM in `@ckeditor/ckeditor5-[FEATURE_NAME]` packages.

In order to load an editor, you need to use the base DLL build plus several DLL-compatible package builds. You will see how to do that later on.
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-editor-balloon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@ckeditor/ckeditor5-ui": "^36.0.1",
"@ckeditor/ckeditor5-undo": "^36.0.1",
"@ckeditor/ckeditor5-utils": "^36.0.1",
"@ckeditor/ckeditor5-watchdog": "^36.0.1",
"typescript": "^4.8.4",
"webpack": "^5.58.1",
"webpack-cli": "^4.9.0"
Expand Down
24 changes: 24 additions & 0 deletions packages/ckeditor5-editor-balloon/src/ballooneditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import {
Editor,
Context,
DataApiMixin,
ElementApiMixin,
attachToForm,
Expand All @@ -20,6 +21,8 @@ import {
import { BalloonToolbar } from 'ckeditor5/src/ui';
import { CKEditorError, getDataFromElement } from 'ckeditor5/src/utils';

import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';

import BalloonEditorUI from './ballooneditorui';
import BalloonEditorUIView from './ballooneditoruiview';

Expand Down Expand Up @@ -237,6 +240,27 @@ export default class BalloonEditor extends DataApiMixin( ElementApiMixin( Editor
);
} );
}

/**
* The {@link module:core/context~Context} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static Context = Context;

/**
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static EditorWatchdog = EditorWatchdog;

/**
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static ContextWatchdog = ContextWatchdog;
}

function getInitialData( sourceElementOrData: HTMLElement | string ): string {
Expand Down
19 changes: 18 additions & 1 deletion packages/ckeditor5-editor-balloon/tests/ballooneditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@

/* globals document, console */

import BalloonEditor from '../src/ballooneditor';
import BalloonEditorUI from '../src/ballooneditorui';
import BalloonEditorUIView from '../src/ballooneditoruiview';

import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';

import BalloonEditor from '../src/ballooneditor';
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import Context from '@ckeditor/ckeditor5-core/src/context';
import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog';
import ContextWatchdog from '@ckeditor/ckeditor5-watchdog/src/contextwatchdog';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import BalloonToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/balloon/balloontoolbar';
Expand Down Expand Up @@ -392,6 +395,20 @@ describe( 'BalloonEditor', () => {
} );
} );

describe( 'static fields', () => {
it( 'BalloonEditor.Context', () => {
expect( BalloonEditor.Context ).to.equal( Context );
} );

it( 'BalloonEditor.EditorWatchdog', () => {
expect( BalloonEditor.EditorWatchdog ).to.equal( EditorWatchdog );
} );

it( 'BalloonEditor.ContextWatchdog', () => {
expect( BalloonEditor.ContextWatchdog ).to.equal( ContextWatchdog );
} );
} );

describeMemoryUsage( () => {
testMemoryUsage(
'should not grow on multiple create/destroy',
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-editor-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@ckeditor/ckeditor5-ui": "^36.0.1",
"@ckeditor/ckeditor5-undo": "^36.0.1",
"@ckeditor/ckeditor5-utils": "^36.0.1",
"@ckeditor/ckeditor5-watchdog": "^36.0.1",
"typescript": "^4.8.4",
"webpack": "^5.58.1",
"webpack-cli": "^4.9.0"
Expand Down
24 changes: 24 additions & 0 deletions packages/ckeditor5-editor-classic/src/classiceditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ClassicEditorUIView from './classiceditoruiview';

import {
Editor,
Context,
DataApiMixin,
ElementApiMixin,
attachToForm,
Expand All @@ -20,6 +21,8 @@ import {
} from 'ckeditor5/src/core';
import { getDataFromElement, CKEditorError } from 'ckeditor5/src/utils';

import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';

import { isElement as _isElement } from 'lodash-es';

/**
Expand Down Expand Up @@ -222,6 +225,27 @@ export default class ClassicEditor extends DataApiMixin( ElementApiMixin( Editor
);
} );
}

/**
* The {@link module:core/context~Context} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static Context = Context;

/**
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static EditorWatchdog = EditorWatchdog;

/**
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static ContextWatchdog = ContextWatchdog;
}

function getInitialData( sourceElementOrData: HTMLElement | string ): string {
Expand Down
19 changes: 18 additions & 1 deletion packages/ckeditor5-editor-classic/tests/classiceditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@

/* globals document, Event, console */

import ClassicEditor from '../src/classiceditor';
import ClassicEditorUI from '../src/classiceditorui';
import ClassicEditorUIView from '../src/classiceditoruiview';

import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';

import ClassicEditor from '../src/classiceditor';
import Context from '@ckeditor/ckeditor5-core/src/context';
import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog';
import ContextWatchdog from '@ckeditor/ckeditor5-watchdog/src/contextwatchdog';
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
Expand Down Expand Up @@ -386,6 +389,20 @@ describe( 'ClassicEditor', () => {
} );
} );

describe( 'static fields', () => {
it( 'ClassicEditor.Context', () => {
expect( ClassicEditor.Context ).to.equal( Context );
} );

it( 'ClassicEditor.EditorWatchdog', () => {
expect( ClassicEditor.EditorWatchdog ).to.equal( EditorWatchdog );
} );

it( 'ClassicEditor.ContextWatchdog', () => {
expect( ClassicEditor.ContextWatchdog ).to.equal( ContextWatchdog );
} );
} );

describeMemoryUsage( () => {
testMemoryUsage(
'should not grow on multiple create/destroy',
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-editor-decoupled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@ckeditor/ckeditor5-ui": "^36.0.1",
"@ckeditor/ckeditor5-undo": "^36.0.1",
"@ckeditor/ckeditor5-utils": "^36.0.1",
"@ckeditor/ckeditor5-watchdog": "^36.0.1",
"typescript": "^4.8.4",
"webpack": "^5.58.1",
"webpack-cli": "^4.9.0"
Expand Down
24 changes: 24 additions & 0 deletions packages/ckeditor5-editor-decoupled/src/decouplededitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import {
Editor,
Context,
ElementApiMixin,
DataApiMixin,
secureSourceElement,
Expand All @@ -20,6 +21,8 @@ import {
getDataFromElement
} from 'ckeditor5/src/utils';

import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';

import DecoupledEditorUI from './decouplededitorui';
import DecoupledEditorUIView from './decouplededitoruiview';

Expand Down Expand Up @@ -271,6 +274,27 @@ export default class DecoupledEditor extends DataApiMixin( ElementApiMixin( Edit
);
} );
}

/**
* The {@link module:core/context~Context} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static Context = Context;

/**
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static EditorWatchdog = EditorWatchdog;

/**
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static ContextWatchdog = ContextWatchdog;
}

function getInitialData( sourceElementOrData: HTMLElement | string ): string {
Expand Down
19 changes: 18 additions & 1 deletion packages/ckeditor5-editor-decoupled/tests/decouplededitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@

/* globals document, setTimeout, console */

import DecoupledEditor from '../src/decouplededitor';
import DecoupledEditorUI from '../src/decouplededitorui';
import DecoupledEditorUIView from '../src/decouplededitoruiview';

import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';

import DecoupledEditor from '../src/decouplededitor';
import Context from '@ckeditor/ckeditor5-core/src/context';
import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog';
import ContextWatchdog from '@ckeditor/ckeditor5-watchdog/src/contextwatchdog';
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
Expand Down Expand Up @@ -432,6 +435,20 @@ describe( 'DecoupledEditor', () => {
}
} );

describe( 'static fields', () => {
it( 'DecoupledEditor.Context', () => {
expect( DecoupledEditor.Context ).to.equal( Context );
} );

it( 'DecoupledEditor.EditorWatchdog', () => {
expect( DecoupledEditor.EditorWatchdog ).to.equal( EditorWatchdog );
} );

it( 'DecoupledEditor.ContextWatchdog', () => {
expect( DecoupledEditor.ContextWatchdog ).to.equal( ContextWatchdog );
} );
} );

describeMemoryUsage( () => {
testMemoryUsage(
'should not grow on multiple create/destroy',
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-editor-inline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@ckeditor/ckeditor5-ui": "^36.0.1",
"@ckeditor/ckeditor5-undo": "^36.0.1",
"@ckeditor/ckeditor5-utils": "^36.0.1",
"@ckeditor/ckeditor5-watchdog": "^36.0.1",
"typescript": "^4.8.4",
"webpack": "^5.58.1",
"webpack-cli": "^4.9.0"
Expand Down
26 changes: 25 additions & 1 deletion packages/ckeditor5-editor-inline/src/inlineeditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import {
Editor,
Context,
DataApiMixin,
ElementApiMixin,
attachToForm,
Expand All @@ -18,11 +19,13 @@ import {
} from 'ckeditor5/src/core';
import { getDataFromElement, CKEditorError } from 'ckeditor5/src/utils';

import { isElement as _isElement } from 'lodash-es';
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';

import InlineEditorUI from './inlineeditorui';
import InlineEditorUIView from './inlineeditoruiview';

import { isElement as _isElement } from 'lodash-es';

/**
* The {@glink installation/getting-started/predefined-builds#inline-editor inline editor} implementation.
* It uses an inline editable and a floating toolbar.
Expand Down Expand Up @@ -231,6 +234,27 @@ export default class InlineEditor extends DataApiMixin( ElementApiMixin( Editor
);
} );
}

/**
* The {@link module:core/context~Context} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static Context = Context;

/**
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static EditorWatchdog = EditorWatchdog;

/**
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
*
* Exposed as static editor field for easier access in editor builds.
*/
public static ContextWatchdog = ContextWatchdog;
}

function getInitialData( sourceElementOrData: HTMLElement | string ): string {
Expand Down
19 changes: 18 additions & 1 deletion packages/ckeditor5-editor-inline/tests/inlineeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@

/* globals document, console */

import InlineEditor from '../src/inlineeditor';
import InlineEditorUI from '../src/inlineeditorui';
import InlineEditorUIView from '../src/inlineeditoruiview';

import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';

import InlineEditor from '../src/inlineeditor';
import Context from '@ckeditor/ckeditor5-core/src/context';
import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog';
import ContextWatchdog from '@ckeditor/ckeditor5-watchdog/src/contextwatchdog';
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
Expand Down Expand Up @@ -401,6 +404,20 @@ describe( 'InlineEditor', () => {
} );
} );

describe( 'static fields', () => {
it( 'InlineEditor.Context', () => {
expect( InlineEditor.Context ).to.equal( Context );
} );

it( 'InlineEditor.EditorWatchdog', () => {
expect( InlineEditor.EditorWatchdog ).to.equal( EditorWatchdog );
} );

it( 'InlineEditor.ContextWatchdog', () => {
expect( InlineEditor.ContextWatchdog ).to.equal( ContextWatchdog );
} );
} );

describeMemoryUsage( () => {
testMemoryUsage(
'should not grow on multiple create/destroy',
Expand Down
Loading

0 comments on commit 8933c86

Please sign in to comment.