@ckeditor/ckeditor5-widget
Advanced tools
Comparing version 33.0.0 to 34.0.0
{ | ||
"name": "@ckeditor/ckeditor5-widget", | ||
"version": "33.0.0", | ||
"version": "34.0.0", | ||
"description": "Widget API for CKEditor 5.", | ||
@@ -14,25 +14,25 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^33.0.0", | ||
"@ckeditor/ckeditor5-engine": "^33.0.0", | ||
"@ckeditor/ckeditor5-enter": "^33.0.0", | ||
"@ckeditor/ckeditor5-ui": "^33.0.0", | ||
"@ckeditor/ckeditor5-utils": "^33.0.0", | ||
"@ckeditor/ckeditor5-typing": "^33.0.0", | ||
"@ckeditor/ckeditor5-core": "^34.0.0", | ||
"@ckeditor/ckeditor5-engine": "^34.0.0", | ||
"@ckeditor/ckeditor5-enter": "^34.0.0", | ||
"@ckeditor/ckeditor5-ui": "^34.0.0", | ||
"@ckeditor/ckeditor5-utils": "^34.0.0", | ||
"@ckeditor/ckeditor5-typing": "^34.0.0", | ||
"lodash-es": "^4.17.15" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^33.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^33.0.0", | ||
"@ckeditor/ckeditor5-clipboard": "^33.0.0", | ||
"@ckeditor/ckeditor5-editor-balloon": "^33.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^33.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^33.0.0", | ||
"@ckeditor/ckeditor5-heading": "^33.0.0", | ||
"@ckeditor/ckeditor5-horizontal-line": "^33.0.0", | ||
"@ckeditor/ckeditor5-image": "^33.0.0", | ||
"@ckeditor/ckeditor5-link": "^33.0.0", | ||
"@ckeditor/ckeditor5-media-embed": "^33.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^33.0.0", | ||
"@ckeditor/ckeditor5-table": "^33.0.0", | ||
"@ckeditor/ckeditor5-undo": "^33.0.0" | ||
"@ckeditor/ckeditor5-basic-styles": "^34.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^34.0.0", | ||
"@ckeditor/ckeditor5-clipboard": "^34.0.0", | ||
"@ckeditor/ckeditor5-editor-balloon": "^34.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^34.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^34.0.0", | ||
"@ckeditor/ckeditor5-heading": "^34.0.0", | ||
"@ckeditor/ckeditor5-horizontal-line": "^34.0.0", | ||
"@ckeditor/ckeditor5-image": "^34.0.0", | ||
"@ckeditor/ckeditor5-link": "^34.0.0", | ||
"@ckeditor/ckeditor5-media-embed": "^34.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^34.0.0", | ||
"@ckeditor/ckeditor5-table": "^34.0.0", | ||
"@ckeditor/ckeditor5-undo": "^34.0.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "engines": { |
@@ -6,3 +6,4 @@ CKEditor 5 widget API | ||
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master) | ||
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://travis-ci.com/ckeditor/ckeditor5) | ||
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5) | ||
![Dependency Status](https://img.shields.io/librariesio/release/npm/@ckeditor/ckeditor5-widget) | ||
@@ -9,0 +10,0 @@ This package implements the widget API for CKEditor 5. |
@@ -12,2 +12,5 @@ /** | ||
import toArray from '@ckeditor/ckeditor5-utils/src/toarray'; | ||
import { | ||
findOptimalInsertionRange as engineFindOptimalInsertionRange | ||
} from '@ckeditor/ckeditor5-engine/src/model/utils/findoptimalinsertionrange'; | ||
@@ -311,29 +314,5 @@ import HighlightStack from './highlightstack'; | ||
} | ||
if ( model.schema.isObject( selectedElement ) && !model.schema.isInline( selectedElement ) ) { | ||
return model.createRangeOn( selectedElement ); | ||
} | ||
} | ||
const firstBlock = selection.getSelectedBlocks().next().value; | ||
if ( firstBlock ) { | ||
// If inserting into an empty block – return position in that block. It will get | ||
// replaced with the image by insertContent(). #42. | ||
if ( firstBlock.isEmpty ) { | ||
return model.createRange( model.createPositionAt( firstBlock, 0 ) ); | ||
} | ||
const positionAfter = model.createPositionAfter( firstBlock ); | ||
// If selection is at the end of the block - return position after the block. | ||
if ( selection.focus.isTouching( positionAfter ) ) { | ||
return model.createRange( positionAfter ); | ||
} | ||
// Otherwise return position before the block. | ||
return model.createRange( model.createPositionBefore( firstBlock ) ); | ||
} | ||
return model.createRange( selection.focus ); | ||
return engineFindOptimalInsertionRange( selection, model ); | ||
} | ||
@@ -340,0 +319,0 @@ |
@@ -124,2 +124,3 @@ /** | ||
this._enableInsertContentIntegration(); | ||
this._enableInsertObjectIntegration(); | ||
this._enableDeleteContentIntegration(); | ||
@@ -149,4 +150,7 @@ } | ||
const attributesToCopy = editor.model.schema.getAttributesWithProperty( widgetModelElement, 'copyOnReplace', true ); | ||
editor.execute( 'insertParagraph', { | ||
position: editor.model.createPositionAt( widgetModelElement, position ) | ||
position: editor.model.createPositionAt( widgetModelElement, position ), | ||
attributes: attributesToCopy | ||
} ); | ||
@@ -785,2 +789,33 @@ | ||
/** | ||
* Attaches the {@link module:engine/model/model~Model#event:insertObject} event listener that modifies `options.findOptimalPosition` | ||
* parameter to position of fake caret in relation to selected element to reflect user's intent of desired insertion position. | ||
* | ||
* The object is inserted according to the `widget-type-around` selection attribute (see {@link #_handleArrowKeyPress}). | ||
* | ||
* @private | ||
*/ | ||
_enableInsertObjectIntegration() { | ||
const editor = this.editor; | ||
const model = this.editor.model; | ||
const documentSelection = model.document.selection; | ||
this._listenToIfEnabled( editor.model, 'insertObject', ( evt, args ) => { | ||
const [ , selectable, , options = {} ] = args; | ||
if ( selectable && !selectable.is( 'documentSelection' ) ) { | ||
return; | ||
} | ||
const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition( documentSelection ); | ||
if ( !typeAroundFakeCaretPosition ) { | ||
return; | ||
} | ||
options.findOptimalPosition = typeAroundFakeCaretPosition; | ||
args[ 3 ] = options; | ||
}, { priority: 'high' } ); | ||
} | ||
/** | ||
* Attaches the {@link module:engine/model/model~Model#event:deleteContent} event listener to block the event when the fake | ||
@@ -787,0 +822,0 @@ * caret is active. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
190482
3426
18
+ Added@ckeditor/ckeditor5-core@34.2.0(transitive)
+ Added@ckeditor/ckeditor5-engine@34.2.0(transitive)
+ Added@ckeditor/ckeditor5-enter@34.2.0(transitive)
+ Added@ckeditor/ckeditor5-typing@34.2.0(transitive)
+ Added@ckeditor/ckeditor5-ui@34.2.0(transitive)
+ Added@ckeditor/ckeditor5-utils@34.2.0(transitive)
- Removed@ckeditor/ckeditor5-core@33.0.0(transitive)
- Removed@ckeditor/ckeditor5-engine@33.0.0(transitive)
- Removed@ckeditor/ckeditor5-enter@33.0.0(transitive)
- Removed@ckeditor/ckeditor5-typing@33.0.0(transitive)
- Removed@ckeditor/ckeditor5-ui@33.0.0(transitive)
- Removed@ckeditor/ckeditor5-utils@33.0.0(transitive)