Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-editor-classic

Package Overview
Dependencies
Maintainers
1
Versions
645
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-editor-classic - npm Package Compare versions

Comparing version 11.0.2 to 12.0.0

24

CHANGELOG.md
Changelog
=========
## [12.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.2...v12.0.0) (2019-02-28)
### Features
* Added support for the `config.placeholder` option which allows configuring the empty editor content placeholder (see [ckeditor/ckeditor5#479](https://github.com/ckeditor/ckeditor5/issues/479)). ([3450c23](https://github.com/ckeditor/ckeditor5-editor-classic/commit/3450c23))
### Bug fixes
* Fixed memory leaks during editor initialization and destruction (see [ckeditor/ckeditor5#1341](https://github.com/ckeditor/ckeditor5/issues/1341)). ([a3c5c82](https://github.com/ckeditor/ckeditor5-editor-classic/commit/a3c5c82))
### Other changes
* Adjustments to new editor initialization events. See breaking changes. ([61ccab0](https://github.com/ckeditor/ckeditor5-editor-classic/commit/61ccab0))
* Editor UI classes API refactoring. See breaking changes. ([74e27ae](https://github.com/ckeditor/ckeditor5-editor-classic/commit/74e27ae))
### BREAKING CHANGES
* Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
* The `editor#dataReady` event was removed. The `editor.data#ready` event has been introduced and should be used instead.
* The `editor#pluginsReady` event was removed. Use plugin `afterInit()` method instead.
* Removed `ClassicEditor#element` property. The `ClassicEditorUI#element` property should be used instead.
* Removed `ClassicEditorUIView#editableElement`. Instead `ClassicEditorUI#getEditableElement()` method should be used.
## [11.0.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.1...v11.0.2) (2018-12-05)

@@ -5,0 +29,0 @@

2

LICENSE.md

@@ -5,3 +5,3 @@ Software License Agreement

**Classic Editor** – https://github.com/ckeditor/ckeditor5-editor-classic <br>
Copyright (c) 2003-2018, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.
Copyright (c) 2003-2019, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.

@@ -8,0 +8,0 @@ Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).

{
"name": "@ckeditor/ckeditor5-editor-classic",
"version": "11.0.2",
"version": "12.0.0",
"description": "Classic editor implementation for CKEditor 5.",

@@ -12,28 +12,28 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-core": "^11.1.0",
"@ckeditor/ckeditor5-engine": "^12.0.0",
"@ckeditor/ckeditor5-theme-lark": "^12.0.0",
"@ckeditor/ckeditor5-ui": "^11.2.0",
"@ckeditor/ckeditor5-utils": "^11.1.0",
"@ckeditor/ckeditor5-core": "^12.0.0",
"@ckeditor/ckeditor5-engine": "^13.0.0",
"@ckeditor/ckeditor5-theme-lark": "^13.0.0",
"@ckeditor/ckeditor5-ui": "^12.0.0",
"@ckeditor/ckeditor5-utils": "^12.0.0",
"lodash-es": "^4.17.10"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^10.1.0",
"@ckeditor/ckeditor5-enter": "^10.1.3",
"@ckeditor/ckeditor5-heading": "^10.1.1",
"@ckeditor/ckeditor5-paragraph": "^10.0.4",
"@ckeditor/ckeditor5-typing": "^11.0.2",
"@ckeditor/ckeditor5-undo": "^10.0.4",
"@ckeditor/ckeditor5-basic-styles": "^11.0.0",
"@ckeditor/ckeditor5-enter": "^11.0.0",
"@ckeditor/ckeditor5-heading": "^11.0.0",
"@ckeditor/ckeditor5-paragraph": "^11.0.0",
"@ckeditor/ckeditor5-typing": "^12.0.0",
"@ckeditor/ckeditor5-undo": "^11.0.0",
"eslint": "^5.5.0",
"eslint-config-ckeditor5": "^1.0.7",
"husky": "^0.14.3",
"eslint-config-ckeditor5": "^1.0.11",
"husky": "^1.3.1",
"lint-staged": "^7.0.0"
},
"engines": {
"node": ">=6.9.0",
"npm": ">=3.0.0"
"node": ">=8.0.0",
"npm": ">=5.7.1"
},
"author": "CKSource (http://cksource.com/)",
"license": "GPL-2.0-or-later",
"homepage": "https://ckeditor.com",
"homepage": "https://ckeditor.com/ckeditor-5",
"bugs": "https://github.com/ckeditor/ckeditor5-editor-classic/issues",

@@ -50,4 +50,3 @@ "repository": {

"scripts": {
"lint": "eslint --quiet '**/*.js'",
"precommit": "lint-staged"
"lint": "eslint --quiet '**/*.js'"
},

@@ -62,3 +61,8 @@ "lint-staged": {

"packages/**"
]
],
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.

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

import ClassicEditorUIView from './classiceditoruiview';
import ElementReplacer from '@ckeditor/ckeditor5-utils/src/elementreplacer';
import getDataFromElement from '@ckeditor/ckeditor5-utils/src/dom/getdatafromelement';

@@ -70,10 +69,2 @@ import mix from '@ckeditor/ckeditor5-utils/src/mix';

/**
* The element replacer instance used to hide the editor's source element.
*
* @protected
* @member {module:utils/elementreplacer~ElementReplacer}
*/
this._elementReplacer = new ElementReplacer();
this.data.processor = new HtmlDataProcessor();

@@ -83,3 +74,3 @@

this.ui = new ClassicEditorUI( this, new ClassicEditorUIView( this.locale ) );
this.ui = new ClassicEditorUI( this, new ClassicEditorUIView( this.locale, this.editing.view ) );

@@ -90,9 +81,2 @@ attachToForm( this );

/**
* @inheritDoc
*/
get element() {
return this.ui.view.element;
}
/**
* Destroys the editor instance, releasing all resources used by it.

@@ -109,3 +93,2 @@ *

this._elementReplacer.restore();
this.ui.destroy();

@@ -175,3 +158,3 @@

* {@link module:editor-classic/classiceditor~ClassicEditor#setData loaded} to the editor on startup
* and the {@link module:core/editor/editorwithui~EditorWithUI#element editor element} will replace the passed element in the DOM
* and the {@link module:core/editor/editorui~EditorUI#getEditableElement editor element} will replace the passed element in the DOM
* (the original one will be hidden and the editor will be injected next to it).

@@ -183,4 +166,4 @@ *

*
* If the data is passed, a detached editor will be created. It means that you need to insert it into the DOM manually
* (by accessing the {@link module:editor-classic/classiceditor~ClassicEditor#element `editor.element`} property).
* If the data is passed, a detached editor will be created. It means that you need to insert it into the DOM manually (by accessing
* it via the {@link module:editor-classic/classiceditorui~ClassicEditorUI#getEditableElement `editor.ui.getEditableElement()`} method).
*

@@ -199,12 +182,4 @@ * See the examples above to learn more.

editor.initPlugins()
.then( () => editor.ui.init() )
.then( () => editor.ui.init( isElement( sourceElementOrData ) ? sourceElementOrData : null ) )
.then( () => {
if ( isElement( sourceElementOrData ) ) {
editor._elementReplacer.replace( sourceElementOrData, editor.element );
}
editor.fire( 'uiReady' );
} )
.then( () => editor.editing.view.attachDomRoot( editor.ui.view.editableElement ) )
.then( () => {
const initialData = isElement( sourceElementOrData ) ?

@@ -216,6 +191,3 @@ getDataFromElement( sourceElementOrData ) :

} )
.then( () => {
editor.fire( 'dataReady' );
editor.fire( 'ready' );
} )
.then( () => editor.fire( 'ready' ) )
.then( () => editor )

@@ -222,0 +194,0 @@ );

/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.

@@ -13,2 +13,4 @@ */

import normalizeToolbarConfig from '@ckeditor/ckeditor5-ui/src/toolbar/normalizetoolbarconfig';
import { enablePlaceholder } from '@ckeditor/ckeditor5-engine/src/view/placeholder';
import ElementReplacer from '@ckeditor/ckeditor5-utils/src/elementreplacer';

@@ -22,25 +24,122 @@ /**

/**
* @inheritDoc
* Creates an instance of the classic editor UI class.
*
* @param {module:core/editor/editor~Editor} editor The editor instance.
* @param {module:ui/editorui/editoruiview~EditorUIView} view The view of the UI.
*/
constructor( editor, view ) {
super( editor, view );
super( editor );
/**
* The main (top–most) view of the editor UI.
*
* @readonly
* @member {module:ui/editorui/editoruiview~EditorUIView} #view
*/
this.view = view;
/**
* A normalized `config.toolbar` object.
*
* @type {Object}
* @private
* @member {Object}
*/
this._toolbarConfig = normalizeToolbarConfig( editor.config.get( 'toolbar' ) );
/**
* The element replacer instance used to hide the editor's source element.
*
* @protected
* @member {module:utils/elementreplacer~ElementReplacer}
*/
this._elementReplacer = new ElementReplacer();
}
/**
* @inheritDoc
*/
get element() {
return this.view.element;
}
/**
* Initializes the UI.
*
* @param {HTMLElement|null} replacementElement The DOM element that will be the source for the created editor.
*/
init() {
init( replacementElement ) {
const editor = this.editor;
const view = this.view;
const editingView = editor.editing.view;
const editable = view.editable;
const editingRoot = editingView.document.getRoot();
// The editable UI and editing root should share the same name. Then name is used
// to recognize the particular editable, for instance in ARIA attributes.
editable.name = editingRoot.rootName;
view.render();
// The editable UI element in DOM is available for sure only after the editor UI view has been rendered.
// But it can be available earlier if a DOM element has been passed to BalloonEditor.create().
const editableElement = editable.element;
// Register the editable UI view in the editor. A single editor instance can aggregate multiple
// editable areas (roots) but the classic editor has only one.
this._editableElements.set( editable.name, editableElement );
// Let the global focus tracker know that the editable UI element is focusable and
// belongs to the editor. From now on, the focus tracker will sustain the editor focus
// as long as the editable is focused (e.g. the user is typing).
this.focusTracker.add( editableElement );
// Let the editable UI element respond to the changes in the global editor focus
// tracker. It has been added to the same tracker a few lines above but, in reality, there are
// many focusable areas in the editor, like balloons, toolbars or dropdowns and as long
// as they have focus, the editable should act like it is focused too (although technically
// it isn't), e.g. by setting the proper CSS class, visually announcing focus to the user.
// Doing otherwise will result in editable focus styles disappearing, once e.g. the
// toolbar gets focused.
view.editable.bind( 'isFocused' ).to( this.focusTracker );
// Bind the editable UI element to the editing view, making it an end– and entry–point
// of the editor's engine. This is where the engine meets the UI.
editingView.attachDomRoot( editableElement );
// If an element containing the initial data of the editor was provided, replace it with
// an editor instance's UI in DOM until the editor is destroyed. For instance, a <textarea>
// can be such element.
if ( replacementElement ) {
this._elementReplacer.replace( replacementElement, this.element );
}
this._initPlaceholder();
this._initToolbar();
this.fire( 'ready' );
}
/**
* @inheritDoc
*/
destroy() {
const view = this.view;
const editingView = this.editor.editing.view;
this._elementReplacer.restore();
editingView.detachDomRoot( view.editable.name );
view.destroy();
super.destroy();
}
/**
* Initializes the editor toolbar.
*
* @private
*/
_initToolbar() {
const editor = this.editor;
const view = this.view;
const editingView = editor.editing.view;
// Set–up the sticky panel with toolbar.

@@ -54,19 +153,35 @@ view.stickyPanel.bind( 'isActive' ).to( this.focusTracker, 'isFocused' );

// Setup the editable.
const editingRoot = editor.editing.view.document.getRoot();
view.editable.bind( 'isReadOnly' ).to( editingRoot );
view.editable.bind( 'isFocused' ).to( editor.editing.view.document );
view.editable.name = editingRoot.rootName;
view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );
this.focusTracker.add( this.view.editableElement );
this.view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );
enableToolbarKeyboardFocus( {
origin: editor.editing.view,
origin: editingView,
originFocusTracker: this.focusTracker,
originKeystrokeHandler: editor.keystrokes,
toolbar: this.view.toolbar
toolbar: view.toolbar
} );
}
/**
* Enable the placeholder text on the editing root, if any was configured.
*
* @private
*/
_initPlaceholder() {
const editor = this.editor;
const editingView = editor.editing.view;
const editingRoot = editingView.document.getRoot();
const sourceElement = editor.sourceElement;
const placeholderText = editor.config.get( 'placeholder' ) ||
sourceElement && sourceElement.tagName.toLowerCase() === 'textarea' && sourceElement.getAttribute( 'placeholder' );
if ( placeholderText ) {
enablePlaceholder( {
view: editingView,
element: editingRoot,
text: placeholderText,
isDirectHost: false
} );
}
}
}
/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.

@@ -28,4 +28,5 @@ */

* @param {module:utils/locale~Locale} locale The {@link module:core/editor/editor~Editor#locale} instance.
* @param {module:engine/view/view~View} editingView The editing view instance this view is related to.
*/
constructor( locale ) {
constructor( locale, editingView ) {
super( locale );

@@ -56,3 +57,3 @@

*/
this.editable = new InlineEditableUIView( locale );
this.editable = new InlineEditableUIView( locale, editingView );
}

@@ -72,9 +73,2 @@

}
/**
* @inheritDoc
*/
get editableElement() {
return this.editable.element;
}
}

Sorry, the diff of this file is not supported yet

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