Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckeditor/ckeditor5-core

Package Overview
Dependencies
Maintainers
1
Versions
717
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-core - npm Package Compare versions

Comparing version 37.0.0-alpha.0 to 37.0.0-alpha.1

src/augmentation.d.ts

36

package.json
{
"name": "@ckeditor/ckeditor5-core",
"version": "37.0.0-alpha.0",
"version": "37.0.0-alpha.1",
"description": "The core architecture of CKEditor 5 – the best browser-based rich text editor.",

@@ -26,21 +26,21 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.1",
"lodash-es": "^4.17.15"
},
"devDependencies": {
"@ckeditor/ckeditor5-autoformat": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-essentials": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-indent": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-list": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-autoformat": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-essentials": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-indent": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-list": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.1",
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.1",
"typescript": "^4.8.4",

@@ -72,3 +72,3 @@ "webpack": "^5.58.1",

"scripts": {
"build": "tsc -p ./tsconfig.release.json",
"build": "tsc -p ./tsconfig.json",
"postversion": "npm run build"

@@ -75,0 +75,0 @@ },

@@ -167,3 +167,3 @@ /**

/**
* Event fired by the {@link ~Command#execute} method. The command action is a listener to this event so it's
* Event fired by the {@link module:core/command~Command#execute} method. The command action is a listener to this event so it's
* possible to change/cancel the behavior of the command by listening to this event.

@@ -176,5 +176,5 @@ *

*
* @eventName execute
* @eventName ~Command#execute
*/
export type CommandExecuteEvent = DecoratedMethodEvent<Command, 'execute'>;
export {};

@@ -36,3 +36,3 @@ /**

* It does not define the editor UI, which is available only if
* the specific editor implements also the {@link module:core/editor/editorwithui~EditorWithUI} interface
* the specific editor implements also the {@link ~Editor#ui} property
* (as most editor implementations do).

@@ -237,9 +237,4 @@ */

*
* Usually, not to be used directly. See the `create()` methods of the existing editor types to learn how to use them:
* Usually, not to be used directly. See the static {@link module:core/editor/editor~Editor.create `create()`} method.
*
* * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
* * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
* * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
* * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.
*
* @param config The editor configuration.

@@ -364,2 +359,15 @@ */

focus(): void;
/**
* Creates and initializes a new editor instance.
*
* This is an abstract method. Every editor type needs to implement its own initialization logic.
*
* See the `create()` methods of the existing editor types to learn how to use them:
*
* * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
* * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
* * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
* * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}
*/
static create(...args: Array<unknown>): void;
}

@@ -378,3 +386,3 @@ /**

*
* @eventName ready
* @eventName ~Editor#ready
*/

@@ -391,3 +399,3 @@ export type EditorReadyEvent = {

*
* @eventName destroy
* @eventName ~Editor#destroy
*/

@@ -394,0 +402,0 @@ export type EditorDestroyEvent = {

@@ -29,3 +29,3 @@ /**

* It does not define the editor UI, which is available only if
* the specific editor implements also the {@link module:core/editor/editorwithui~EditorWithUI} interface
* the specific editor implements also the {@link ~Editor#ui} property
* (as most editor implementations do).

@@ -37,9 +37,4 @@ */

*
* Usually, not to be used directly. See the `create()` methods of the existing editor types to learn how to use them:
* Usually, not to be used directly. See the static {@link module:core/editor/editor~Editor.create `create()`} method.
*
* * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
* * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
* * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
* * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.
*
* @param config The editor configuration.

@@ -105,5 +100,5 @@ */

/**
* The {@link #isReadOnly Editor#isReadOnly} property is read-only since version `34.0.0` and can be set only using
* {@link #enableReadOnlyMode `Editor#enableReadOnlyMode( lockId )`} and
* {@link #disableReadOnlyMode `Editor#disableReadOnlyMode( lockId )`}.
* The {@link module:core/editor/editor~Editor#isReadOnly Editor#isReadOnly} property is read-only since version `34.0.0`
* and can be set only using {@link module:core/editor/editor~Editor#enableReadOnlyMode `Editor#enableReadOnlyMode( lockId )`} and
* {@link module:core/editor/editor~Editor#disableReadOnlyMode `Editor#disableReadOnlyMode( lockId )`}.
*

@@ -289,2 +284,18 @@ * Usage before version `34.0.0`:

}
/* istanbul ignore next */
/**
* Creates and initializes a new editor instance.
*
* This is an abstract method. Every editor type needs to implement its own initialization logic.
*
* See the `create()` methods of the existing editor types to learn how to use them:
*
* * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
* * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
* * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
* * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}
*/
static create(...args) {
throw new Error('This is an abstract method.');
}
}

@@ -291,0 +302,0 @@ /**

@@ -74,4 +74,30 @@ /**

*
* See also {@link module:core/editor/editor~Editor.create Editor.create()}.
* If your editor implementation uses multiple roots, you should pass an object with keys corresponding to the editor
* roots names and values equal to the data that should be set in each root:
*
* ```ts
* MultiRootEditor.create(
* // Roots for the editor:
* {
* header: document.querySelector( '#header' ),
* content: document.querySelector( '#content' ),
* leftSide: document.querySelector( '#left-side' ),
* rightSide: document.querySelector( '#right-side' )
* },
* // Config:
* {
* initialData: {
* header: '<p>Content for header part.</p>',
* content: '<p>Content for main part.</p>',
* leftSide: '<p>Content for left-side box.</p>',
* rightSide: '<p>Content for right-side box.</p>'
* }
* }
* )
* .then( ... )
* .catch( ... );
* ```
*
* See also {@link module:core/editor/editor~Editor.create Editor.create()} documentation for the editor implementation which you use.
*
* **Note:** If initial data is passed to `Editor.create()` in the first parameter (instead of a DOM element), and,

@@ -84,3 +110,3 @@ * at the same time, `config.initialData` is set, an error will be thrown as those two options exclude themselves.

*/
initialData?: string;
initialData?: string | Record<string, string>;
/**

@@ -158,7 +184,36 @@ * The language of the editor UI and its content.

* ```ts
* const config = {
* placeholder: 'Type some text...'
* };
* ClassicEditor
* .create( document.querySelector( '#editor' ), {
* placeholder: 'Type some text...'
* } )
* .then( ... )
* .catch( ... );
* ```
*
* If your editor implementation uses multiple roots, you should pass an object with keys corresponding to the editor
* roots names and values equal to the placeholder that should be set in each root:
*
* ```ts
* MultiRootEditor.create(
* // Roots for the editor:
* {
* header: document.querySelector( '#header' ),
* content: document.querySelector( '#content' ),
* leftSide: document.querySelector( '#left-side' ),
* rightSide: document.querySelector( '#right-side' )
* },
* // Config:
* {
* placeholder: {
* header: 'Type header...',
* content: 'Type content...',
* leftSide: 'Type left-side...',
* rightSide: 'Type right-side...'
* }
* }
* )
* .then( ... )
* .catch( ... );
* ```
*
* The placeholder text is displayed as a pseudo–element of an empty paragraph in the editor content.

@@ -181,3 +236,3 @@ * The paragraph has the `.ck-placeholder` CSS class and the `data-placeholder` attribute.

*/
placeholder?: string;
placeholder?: string | Record<string, string>;
/**

@@ -423,4 +478,4 @@ * The list of plugins to load.

* Be careful, especially while using
* {@glink features/markdown Markdown}, {@glink features/general-html-support General HTML Support} or
* {@glink features/html-embed HTML embed} features.
* {@glink features/markdown Markdown}, {@glink features/html/general-html-support General HTML Support} or
* {@glink features/html/html-embed HTML embed} features.
*/

@@ -427,0 +482,0 @@ updateSourceElementOnDestroy?: boolean;

@@ -30,12 +30,19 @@ /**

*
* If your editor implementation uses multiple roots, you should pass an object with keys corresponding
* to the editor root names and values equal to the data that should be set in each root:
*
* ```ts
* editor.setData( {
* header: '<p>Content for header part.</p>',
* content: '<p>Content for main part.</p>',
* footer: '<p>Content for footer part.</p>'
* } );
* ```
*
* By default the editor accepts HTML. This can be controlled by injecting a different data processor.
* See the {@glink features/markdown Markdown output} guide for more details.
*
* Note: Not only is the format of the data configurable, but the type of the `setData()`'s parameter does not
* have to be a string either. You can e.g. accept an object or a DOM `DocumentFragment` if you consider this
* the right format for you.
*
* @param data Input data.
*/
setData(data: string): void;
setData(data: string | Record<string, string>): void;
/**

@@ -48,9 +55,11 @@ * Gets the data from the editor.

*
* If your editor implementation uses multiple roots, you should pass root name as one of the options:
*
* ```ts
* editor.getData( { rootName: 'header' } ); // -> '<p>Content for header part.</p>'
* ```
*
* By default the editor outputs HTML. This can be controlled by injecting a different data processor.
* See the {@glink features/markdown Markdown output} guide for more details.
*
* Note: Not only is the format of the data configurable, but the type of the `getData()`'s return value does not
* have to be a string either. You can e.g. return an object or a DOM `DocumentFragment` if you consider this
* the right format for you.
*
* @param options Additional configuration for the retrieved data.

@@ -57,0 +66,0 @@ * Editor features may introduce more configuration options that can be set through this parameter.

@@ -19,4 +19,4 @@ /**

*
* The {@link ~ElementApi#updateSourceElement `updateSourceElement()`} method cannot be called if you did not
* pass an element to `Editor.create()`.
* The {@link module:core/editor/utils/elementapimixin~ElementApi#updateSourceElement `updateSourceElement()`}
* method cannot be called if you did not pass an element to `Editor.create()`.
*

@@ -23,0 +23,0 @@ * @error editor-missing-sourceelement

@@ -6,3 +6,2 @@ /**

import type { default as Editor } from '../editor';
import type { ElementApi } from './elementapimixin';
/**

@@ -15,3 +14,6 @@ * Marks the source element on which the editor was initialized. This prevents other editor instances from using this element.

* @param editor Editor instance.
* @param sourceElement Element to bind with the editor instance.
*/
export default function secureSourceElement(editor: Editor & ElementApi): void;
export default function secureSourceElement(editor: Editor, sourceElement: HTMLElement & {
ckeditorInstance?: Editor;
}): void;

@@ -16,9 +16,5 @@ /**

* @param editor Editor instance.
* @param sourceElement Element to bind with the editor instance.
*/
export default function secureSourceElement(editor) {
const sourceElement = editor.sourceElement;
// If the editor was initialized without specifying an element, we don't need to secure anything.
if (!sourceElement) {
return;
}
export default function secureSourceElement(editor, sourceElement) {
if (sourceElement.ckeditorInstance) {

@@ -25,0 +21,0 @@ /**

@@ -59,1 +59,2 @@ /**

};
import './augmentation';

@@ -89,1 +89,2 @@ /**

};
import './augmentation';

@@ -107,3 +107,3 @@ /**

*
* @eventName add
* @eventName ~PendingActions#add
* @param action The added action.

@@ -115,10 +115,5 @@ */

*
* @eventName remove
* @eventName ~PendingActions#remove
* @param action The removed action.
*/
export type PendingActionsRemoveEvent = CollectionRemoveEvent<PendingAction>;
declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[PendingActions.pluginName]: PendingActions;
}
}

@@ -122,3 +122,3 @@ /**

*
* In most cases however, you will want to inherit from the {@link module:core/plugin~Plugin} class which implements the
* In most cases however, you will want to inherit from the {@link ~Plugin} class which implements the
* {@link module:utils/observablemixin~Observable} and is, therefore, more convenient:

@@ -141,10 +141,10 @@ *

*
* The plugin can also implement methods (e.g. {@link module:core/plugin~PluginInterface#init `init()`} or
* {@link module:core/plugin~PluginInterface#destroy `destroy()`}) which, when present, will be used to properly
* The plugin can also implement methods (e.g. {@link ~PluginInterface#init `init()`} or
* {@link ~PluginInterface#destroy `destroy()`}) which, when present, will be used to properly
* initialize and destroy the plugin.
*
* **Note:** When defined as a plain function, the plugin acts as a constructor and will be
* called in parallel with other plugins' {@link module:core/plugin~PluginConstructor constructors}.
* This means the code of that plugin will be executed **before** {@link module:core/plugin~PluginInterface#init `init()`} and
* {@link module:core/plugin~PluginInterface#afterInit `afterInit()`} methods of other plugins and, for instance,
* called in parallel with other plugins' {@link ~PluginConstructor constructors}.
* This means the code of that plugin will be executed **before** {@link ~PluginInterface#init `init()`} and
* {@link ~PluginInterface#afterInit `afterInit()`} methods of other plugins and, for instance,
* you cannot use it to extend other plugins' {@glink framework/architecture/editing-engine#schema schema}

@@ -158,3 +158,3 @@ * rules as they are defined later on during the `init()` stage.

*
* A plugin's `init()` method is called after its {@link module:core/plugin~PluginStaticMembers#requires dependencies} are initialized,
* A plugin's `init()` method is called after its {@link ~PluginStaticMembers#requires dependencies} are initialized,
* so in the same order as the constructors of these plugins.

@@ -166,3 +166,3 @@ *

/**
* The third (and last) stage of the plugin initialization. See also {@link ~PluginConstructor} and {@link #init}.
* The third (and last) stage of the plugin initialization. See also {@link ~PluginConstructor} and {@link ~PluginInterface#init}.
*

@@ -181,17 +181,17 @@ * **Note:** This method is optional. A plugin instance does not need to have it defined.

* Creates a new plugin instance. This is the first step of the plugin initialization.
* See also {@link #init} and {@link #afterInit}.
* See also {@link ~PluginInterface#init} and {@link ~PluginInterface#afterInit}.
*
* The plugin static properties should conform to {@link ~PluginStaticMembers `PluginStaticMembers` interface}.
*
* A plugin is always instantiated after its {@link module:core/plugin~PluginConstructor#requires dependencies} and the
* {@link #init} and {@link #afterInit} methods are called in the same order.
* A plugin is always instantiated after its {@link ~PluginStaticMembers#requires dependencies} and the
* {@link ~PluginInterface#init} and {@link ~PluginInterface#afterInit} methods are called in the same order.
*
* Usually, you will want to put your plugin's initialization code in the {@link #init} method.
* Usually, you will want to put your plugin's initialization code in the {@link ~PluginInterface#init} method.
* The constructor can be understood as "before init" and used in special cases, just like
* {@link #afterInit} serves the special "after init" scenarios (e.g.the code which depends on other
* plugins, but which does not {@link module:core/plugin~PluginStaticMembers#requires explicitly require} them).
* {@link ~PluginInterface#afterInit} serves the special "after init" scenarios (e.g.the code which depends on other
* plugins, but which does not {@link ~PluginStaticMembers#requires explicitly require} them).
*/
export type PluginConstructor<TContext = Editor> = (PluginClassConstructor<TContext> | PluginFunctionConstructor<TContext>) & PluginStaticMembers<TContext>;
/**
* In most cases, you will want to inherit from the {@link module:core/plugin~Plugin} class which implements the
* In most cases, you will want to inherit from the {@link ~Plugin} class which implements the
* {@link module:utils/observablemixin~Observable} and is, therefore, more convenient:

@@ -228,3 +228,3 @@ *

*/
export type PluginStaticMembers<TContext = Editor> = {
export interface PluginStaticMembers<TContext = Editor> {
/**

@@ -274,3 +274,3 @@ * An array of plugins required by this plugin.

readonly isContextPlugin?: boolean;
};
}
export type PluginDependencies<TContext = Editor> = Array<PluginConstructor<TContext> | string>;

@@ -277,0 +277,0 @@ /**

@@ -42,22 +42,2 @@ /**

[Symbol.iterator](): IterableIterator<PluginEntry<TContext>>;
/**
* Gets the plugin instance by its constructor or name.
*
* ```ts
* // Check if 'Clipboard' plugin was loaded.
* if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
* // Get clipboard plugin instance
* const clipboard = editor.plugins.get( 'ClipboardPipeline' );
*
* this.listenTo( clipboard, 'inputTransformation', ( evt, data ) => {
* // Do something on clipboard input.
* } );
* }
* ```
*
* **Note**: This method will throw an error if a plugin is not loaded. Use `{@link #has editor.plugins.has()}`
* to check if a plugin is available.
*
* @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.
*/
get<TConstructor extends PluginClassConstructor<TContext>>(key: TConstructor): InstanceType<TConstructor>;

@@ -64,0 +44,0 @@ get<TName extends string>(key: TName): PluginsMap[TName];

@@ -56,2 +56,22 @@ /**

}
/**
* Gets the plugin instance by its constructor or name.
*
* ```ts
* // Check if 'Clipboard' plugin was loaded.
* if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
* // Get clipboard plugin instance
* const clipboard = editor.plugins.get( 'ClipboardPipeline' );
*
* this.listenTo( clipboard, 'inputTransformation', ( evt, data ) => {
* // Do something on clipboard input.
* } );
* }
* ```
*
* **Note**: This method will throw an error if a plugin is not loaded. Use `{@link #has editor.plugins.has()}`
* to check if a plugin is available.
*
* @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.
*/
get(key) {

@@ -421,3 +441,3 @@ const plugin = this._plugins.get(key);

/**
* Two plugins with the same {@link module:core/plugin~PluginInterface.pluginName} were loaded.
* Two plugins with the same {@link module:core/plugin~PluginStaticMembers#pluginName} were loaded.
* This will lead to runtime conflicts between these plugins.

@@ -424,0 +444,0 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc