@ckeditor/ckeditor5-widget
Advanced tools
Comparing version 10.0.0 to 10.1.0
Changelog | ||
========= | ||
## [10.1.0](https://github.com/ckeditor/ckeditor5-widget/compare/v10.0.0...v10.1.0) (2018-06-21) | ||
### Features | ||
* Creating a paragraph next to the selected widget is possible using the (<kbd>Shift</kbd>+)<kbd>Enter</kbd> key (see [ckeditor/ckeditor5#407](https://github.com/ckeditor/ckeditor5/issues/407)). ([d68b7d0](https://github.com/ckeditor/ckeditor5-widget/commit/d68b7d0)) | ||
## [10.0.0](https://github.com/ckeditor/ckeditor5-widget/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25) | ||
@@ -5,0 +12,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-widget", | ||
"version": "10.0.0", | ||
"version": "10.1.0", | ||
"description": "Widget API for CKEditor 5.", | ||
@@ -12,9 +12,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^10.0.0", | ||
"@ckeditor/ckeditor5-engine": "^10.0.0", | ||
"@ckeditor/ckeditor5-utils": "^10.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^10.0.0" | ||
"@ckeditor/ckeditor5-core": "^10.1.0", | ||
"@ckeditor/ckeditor5-engine": "^10.1.0", | ||
"@ckeditor/ckeditor5-utils": "^10.1.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^10.1.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-typing": "^10.0.0", | ||
"@ckeditor/ckeditor5-typing": "^10.0.1", | ||
"eslint": "^4.15.0", | ||
@@ -21,0 +21,0 @@ "eslint-config-ckeditor5": "^1.0.7", |
@@ -6,4 +6,4 @@ CKEditor 5 widget API | ||
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-widget.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-widget) | ||
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-widget.svg)](https://travis-ci.org/ckeditor/ckeditor5-widget) | ||
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)](https://www.browserstack.com/automate/public-build/d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0) | ||
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-widget.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-widget) | ||
[![BrowserStack Status](https://automate.browserstack.com/automate/badge.svg?badge_key=d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)](https://automate.browserstack.com/public-build/d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0) | ||
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5-widget/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5-widget?branch=master) | ||
@@ -10,0 +10,0 @@ <br> |
@@ -122,3 +122,3 @@ /** | ||
* @param {module:engine/view/element~Element} element | ||
* @return {String} | ||
* @returns {String} | ||
*/ | ||
@@ -125,0 +125,0 @@ export function getLabel( element ) { |
@@ -157,2 +157,4 @@ /** | ||
wasHandled = this._selectAllNestedEditableContent() || this._selectAllContent(); | ||
} else if ( keyCode === keyCodes.enter ) { | ||
wasHandled = this._handleEnterKey( domEventData.shiftKey ); | ||
} | ||
@@ -211,2 +213,3 @@ | ||
* | ||
* @private | ||
* @param {Boolean} isForward Set to true if arrow key should be handled in forward direction. | ||
@@ -252,2 +255,30 @@ * @returns {Boolean|undefined} Returns `true` if keys were handled correctly. | ||
/** | ||
* Handles the enter key, giving users and access to positions in the editable directly before | ||
* (<kbd>Shift</kbd>+<kbd>Enter</kbd>) or after (<kbd>Enter</kbd>) the selected widget. | ||
* It improves the UX, mainly when the widget is the first or last child of the root editable | ||
* and there's no other way to type after or before it. | ||
* | ||
* @private | ||
* @param {Boolean} isBackwards Set to true if the new paragraph is to be inserted before | ||
* the selected widget (<kbd>Shift</kbd>+<kbd>Enter</kbd>). | ||
* @returns {Boolean|undefined} Returns `true` if keys were handled correctly. | ||
*/ | ||
_handleEnterKey( isBackwards ) { | ||
const model = this.editor.model; | ||
const modelSelection = model.document.selection; | ||
const objectElement = modelSelection.getSelectedElement(); | ||
if ( objectElement && model.schema.isObject( objectElement ) ) { | ||
model.change( writer => { | ||
const paragraph = writer.createElement( 'paragraph' ); | ||
writer.insert( paragraph, objectElement, isBackwards ? 'before' : 'after' ); | ||
writer.setSelection( paragraph, 'in' ); | ||
} ); | ||
return true; | ||
} | ||
} | ||
/** | ||
* Extends the {@link module:engine/model/selection~Selection document's selection} to span the entire | ||
@@ -254,0 +285,0 @@ * content of the nested editable if already anchored in one. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34684
661