Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into t/ckeditor5-enter/40
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Jul 16, 2019
2 parents a90e102 + 7dc8710 commit 6a26a3b
Show file tree
Hide file tree
Showing 108 changed files with 1,356 additions and 873 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@ after_script:
- ckeditor5-dev-tests-notify-travis-status
env:
global:
- secure: CSFKXnTb2oQW8YIjh+SWXYSYzx1jcIg1wGcl6jWrbaOU06JHEO77YLKlhMxLfRniFtilBEksK4ugIcn+lihykhHleMxI27+kifILdLLZKvwWlZiDrtpJSzLk08SpRNDwwthSlHVKrxbHVFE1K9SYpX4s3qTpxullDMPgc13OP4c=
- secure: WGdwDEavTOIE/yw8pdpWmx3Cehm2/GN8gZMimuot8sWPbOZRuPh+2lnVWpASLe25qJUKKeLWYLRHccpMLKbyweiordSEBwzNrOGOFyUuaDPITNZZrp5ekh2vHBp1+mwhRpRekdyWdzzVsm01RkFrnJqQlaXxX9i/r9Tu4EsK54M=
- secure: BKoFnOWcfKn8zaTvilMn9UORF+gR1zBqetqai5FKfSKraJXqiBrz1AI3ecytCjJOKS1g6HoRtZHwVS4a+uG3JjK3bRERQF2NyHiyjbrsL+2HaKaRnVmox8PC/59m1PJlcRKAV9RTYJqL/oqa7N8OBegt4LpIVnEcil8WCErCF6Q=
- secure: GMesvAe0tAa8QfdhGApzmzjhf9mpfjL6jMx8aFqpRli5tuyX9JsjNjFELnU/MMlNDyySPwXAuQVrvcWkCFy9a3n705tGt/VdmStCrTdwV2oRNmNKqGgFovmiK3an+RAIts2PX2iguDjwiogqkAW0FstWAMdG0Yk4AVUxKC1niIo=
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
Changelog
=========

## [13.2.1](https://github.com/ckeditor/ckeditor5-engine/compare/v13.2.0...v13.2.1) (2019-07-10)

Internal changes only (updated dependencies, documentation, etc.).


## [13.2.0](https://github.com/ckeditor/ckeditor5-engine/compare/v13.1.1...v13.2.0) (2019-07-04)

### Features

* Added `view.Document#event:beforeinput`. ([c74c3d6](https://github.com/ckeditor/ckeditor5-engine/commit/c74c3d6))
* Introduced the `type` parameter to the `model.createBatch()` method. ([389b72e](https://github.com/ckeditor/ckeditor5-engine/commit/389b72e))

### Bug fixes

* `model.Writer#insert()` will no longer crash when the data to set contains markers that are already in the editor content. Closes [#1721](https://github.com/ckeditor/ckeditor5-engine/issues/1721). ([4ff0656](https://github.com/ckeditor/ckeditor5-engine/commit/4ff0656))
* Selection will not change during forbidden copy-paste operation inside table cell. Closes [ckeditor/ckeditor5#1380](https://github.com/ckeditor/ckeditor5/issues/1380). ([ab15b17](https://github.com/ckeditor/ckeditor5-engine/commit/ab15b17))

### Other changes

* Changed how ` `s are generated on the view->DOM rendering. Closes [#1747](https://github.com/ckeditor/ckeditor5-engine/issues/1747). ([da5670a](https://github.com/ckeditor/ckeditor5-engine/commit/da5670a))


## [13.1.1](https://github.com/ckeditor/ckeditor5-engine/compare/v13.1.0...v13.1.1) (2019-06-05)

### Bug fixes

* Prevented from losing selection attributes between operations (fixes a bug with text composition). Closes https://github.com/ckeditor/ckeditor5-typing/issues/188. ([42dcb25](https://github.com/ckeditor/ckeditor5-engine/commit/42dcb25))

### Other changes

* Added more cases of affected markers on merging in `model.Writer`. Closes [#1738](https://github.com/ckeditor/ckeditor5-engine/issues/1738). ([01ff6e6](https://github.com/ckeditor/ckeditor5-engine/commit/01ff6e6))


## [13.1.0](https://github.com/ckeditor/ckeditor5-engine/compare/v13.0.0...v13.1.0) (2019-04-10)

### Features
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CKEditor 5 editing engine
[![Join the chat at https://gitter.im/ckeditor/ckeditor5](https://badges.gitter.im/ckeditor/ckeditor5.svg)](https://gitter.im/ckeditor/ckeditor5?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-engine.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-engine)
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-engine.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-engine)
[![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-engine/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5-engine?branch=master)
<br>
[![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-engine/status.svg)](https://david-dm.org/ckeditor/ckeditor5-engine)
Expand Down Expand Up @@ -32,4 +31,4 @@ Additionally, refer to the [`@ckeditor/ckeditor5-engine` package](https://ckedit

## License

Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file.
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license).
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ckeditor/ckeditor5-engine",
"version": "13.1.0",
"version": "13.2.1",
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",
"keywords": [
"wysiwyg",
Expand All @@ -21,26 +21,26 @@
"ckeditor 5"
],
"dependencies": {
"@ckeditor/ckeditor5-utils": "^12.1.0",
"@ckeditor/ckeditor5-utils": "^13.0.1",
"lodash-es": "^4.17.10"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^11.1.0",
"@ckeditor/ckeditor5-block-quote": "^11.0.1",
"@ckeditor/ckeditor5-core": "^12.1.0",
"@ckeditor/ckeditor5-editor-classic": "^12.1.0",
"@ckeditor/ckeditor5-enter": "^11.0.1",
"@ckeditor/ckeditor5-essentials": "^11.0.1",
"@ckeditor/ckeditor5-heading": "^11.0.1",
"@ckeditor/ckeditor5-link": "^11.0.1",
"@ckeditor/ckeditor5-list": "^12.0.1",
"@ckeditor/ckeditor5-paragraph": "^11.0.1",
"@ckeditor/ckeditor5-theme-lark": "^13.0.1",
"@ckeditor/ckeditor5-typing": "^12.0.1",
"@ckeditor/ckeditor5-undo": "^11.0.1",
"@ckeditor/ckeditor5-widget": "^11.0.1",
"@ckeditor/ckeditor5-basic-styles": "^11.1.3",
"@ckeditor/ckeditor5-block-quote": "^11.1.2",
"@ckeditor/ckeditor5-core": "^12.2.1",
"@ckeditor/ckeditor5-editor-classic": "^12.1.3",
"@ckeditor/ckeditor5-enter": "^11.0.4",
"@ckeditor/ckeditor5-essentials": "^11.0.4",
"@ckeditor/ckeditor5-heading": "^11.0.4",
"@ckeditor/ckeditor5-link": "^11.1.1",
"@ckeditor/ckeditor5-list": "^12.0.4",
"@ckeditor/ckeditor5-paragraph": "^11.0.4",
"@ckeditor/ckeditor5-theme-lark": "^14.1.1",
"@ckeditor/ckeditor5-typing": "^12.1.1",
"@ckeditor/ckeditor5-undo": "^11.0.4",
"@ckeditor/ckeditor5-widget": "^11.0.4",
"eslint": "^5.5.0",
"eslint-config-ckeditor5": "^1.0.11",
"eslint-config-ckeditor5": "^2.0.0",
"husky": "^1.3.1",
"lint-staged": "^7.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions src/controller/datacontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class DataController {
*
* @error datacontroller-get-non-existent-root
*/
throw new CKEditorError( 'datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.' );
throw new CKEditorError( 'datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.', this );
}

const root = this.model.document.getRoot( rootName );
Expand Down Expand Up @@ -240,7 +240,7 @@ export default class DataController {
*
* @error datacontroller-init-document-not-empty
*/
throw new CKEditorError( 'datacontroller-init-document-not-empty: Trying to set initial data to not empty document.' );
throw new CKEditorError( 'datacontroller-init-document-not-empty: Trying to set initial data to not empty document.', this );
}

let initialData = {};
Expand All @@ -262,7 +262,7 @@ export default class DataController {
*
* @error datacontroller-init-non-existent-root
*/
throw new CKEditorError( 'datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.' );
throw new CKEditorError( 'datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.', this );
}

this.model.enqueueChange( 'transparent', writer => {
Expand Down Expand Up @@ -316,7 +316,7 @@ export default class DataController {
*
* @error datacontroller-set-non-existent-root
*/
throw new CKEditorError( 'datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.' );
throw new CKEditorError( 'datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.', this );
}

this.model.enqueueChange( 'transparent', writer => {
Expand Down
11 changes: 7 additions & 4 deletions src/conversion/conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ export default class Conversion {
*
* @error conversion-add-alias-dispatcher-not-registered
*/
throw new CKEditorError( 'conversion-add-alias-dispatcher-not-registered: ' +
'Trying to register and alias for a dispatcher that nas not been registered.' );
throw new CKEditorError(
'conversion-add-alias-dispatcher-not-registered: ' +
'Trying to register and alias for a dispatcher that nas not been registered.',
this
);
}

this._createConversionHelpers( { name: alias, dispatchers: [ dispatcher ], isDowncast } );
Expand Down Expand Up @@ -180,7 +183,7 @@ export default class Conversion {
*
* @error conversion-for-unknown-group
*/
throw new CKEditorError( 'conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.' );
throw new CKEditorError( 'conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.', this );
}

return this._helpers.get( groupName );
Expand Down Expand Up @@ -585,7 +588,7 @@ export default class Conversion {
*
* @error conversion-group-exists
*/
throw new CKEditorError( 'conversion-group-exists: Trying to register a group name that has already been registered.' );
throw new CKEditorError( 'conversion-group-exists: Trying to register a group name that has already been registered.', this );
}

const helpers = isDowncast ? new DowncastHelpers( dispatchers ) : new UpcastHelpers( dispatchers );
Expand Down
7 changes: 3 additions & 4 deletions src/conversion/downcasthelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,8 @@ function removeUIElement() {
return;
}

conversionApi.mapper.unbindElementsFromMarkerName( data.markerName );

for ( const element of elements ) {
conversionApi.mapper.unbindElementFromMarkerName( element, data.markerName );
conversionApi.writer.clear( conversionApi.writer.createRangeOn( element ), element );
}

Expand Down Expand Up @@ -1030,9 +1029,9 @@ function removeHighlight( highlightDescriptor ) {
return;
}

conversionApi.mapper.unbindElementsFromMarkerName( data.markerName );

for ( const element of elements ) {
conversionApi.mapper.unbindElementFromMarkerName( element, data.markerName );

if ( element.is( 'attributeElement' ) ) {
conversionApi.writer.unwrap( conversionApi.writer.createRangeOn( element ), viewHighlightElement );
} else {
Expand Down
15 changes: 12 additions & 3 deletions src/conversion/mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,21 @@ export default class Mapper {
}

/**
* Unbinds all elements from given marker name.
* Unbinds an element from given marker name.
*
* @param {module:engine/view/element~Element} element Element to unbind.
* @param {String} name Marker name.
*/
unbindElementsFromMarkerName( name ) {
this._markerNameToElements.delete( name );
unbindElementFromMarkerName( element, name ) {
const elements = this._markerNameToElements.get( name );

if ( elements ) {
elements.delete( element );

if ( elements.size == 0 ) {
this._markerNameToElements.delete( name );
}
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/conversion/upcastdispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default class UpcastDispatcher {
*
* @error view-conversion-dispatcher-incorrect-result
*/
throw new CKEditorError( 'view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.' );
throw new CKEditorError( 'view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.', this );
}

return { modelRange: data.modelRange, modelCursor: data.modelCursor };
Expand Down
2 changes: 1 addition & 1 deletion src/conversion/viewconsumable.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class ViewElementConsumables {
*
* @error viewconsumable-invalid-attribute
*/
throw new CKEditorError( 'viewconsumable-invalid-attribute: Classes and styles should be handled separately.' );
throw new CKEditorError( 'viewconsumable-invalid-attribute: Classes and styles should be handled separately.', this );
}

consumables.set( name, true );
Expand Down
26 changes: 26 additions & 0 deletions src/model/differ.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,32 @@ export default class Differ {
return this._changesInElement.size == 0 && this._changedMarkers.size == 0;
}

/**
* Marks given `item` in differ to be "refreshed". It means that the item will be marked as removed and inserted in the differ changes
* set, so it will be effectively re-converted when differ changes will be handled by a dispatcher.
*
* @param {module:engine/model/item~Item} item Item to refresh.
*/
refreshItem( item ) {
if ( this._isInInsertedElement( item.parent ) ) {
return;
}

this._markRemove( item.parent, item.startOffset, item.offsetSize );
this._markInsert( item.parent, item.startOffset, item.offsetSize );

const range = Range._createOn( item );

for ( const marker of this._markerCollection.getMarkersIntersectingRange( range ) ) {
const markerRange = marker.getRange();

this.bufferMarkerChange( marker.name, markerRange, markerRange, marker.affectsData );
}

// Clear cache after each buffered operation as it is no longer valid.
this._cachedChanges = null;
}

/**
* Buffers the given operation. An operation has to be buffered before it is executed.
*
Expand Down
2 changes: 2 additions & 0 deletions src/model/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default class Document {
*/
throw new CKEditorError(
'model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.',
this,
{ operation }
);
}
Expand Down Expand Up @@ -201,6 +202,7 @@ export default class Document {
*/
throw new CKEditorError(
'model-document-createRoot-name-exists: Root with specified name already exists.',
this,
{ name: rootName }
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/model/documentselection.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ class LiveSelection extends Selection {
*/
throw new CKEditorError(
'document-selection-wrong-position: Range from document selection starts or ends at incorrect position.',
this,
{ range }
);
}
Expand Down Expand Up @@ -767,6 +768,7 @@ class LiveSelection extends Selection {
*/
throw new CKEditorError(
'document-selection-gravity-wrong-restore: Attempting to restore the selection gravity for an unknown UID.',
this,
{ uid }
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/model/liveposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export default class LivePosition extends Position {
* @error liveposition-root-not-rootelement
*/
throw new CKEditorError(
'model-liveposition-root-not-rootelement: LivePosition\'s root has to be an instance of RootElement.'
'model-liveposition-root-not-rootelement: LivePosition\'s root has to be an instance of RootElement.',
root
);
}

Expand Down
12 changes: 6 additions & 6 deletions src/model/markercollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class MarkerCollection {
const marker = this._markers.get( markerName );

if ( !marker ) {
throw new CKEditorError( 'markercollection-refresh-marker-not-exists: Marker with provided name does not exists.' );
throw new CKEditorError( 'markercollection-refresh-marker-not-exists: Marker with provided name does not exists.', this );
}

const range = marker.getRange();
Expand Down Expand Up @@ -383,7 +383,7 @@ class Marker {
*/
get managedUsingOperations() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._managedUsingOperations;
Expand All @@ -396,7 +396,7 @@ class Marker {
*/
get affectsData() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._affectsData;
Expand All @@ -409,7 +409,7 @@ class Marker {
*/
getStart() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._liveRange.start.clone();
Expand All @@ -422,7 +422,7 @@ class Marker {
*/
getEnd() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._liveRange.end.clone();
Expand All @@ -442,7 +442,7 @@ class Marker {
*/
getRange() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._liveRange.toRange();
Expand Down
5 changes: 3 additions & 2 deletions src/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,11 @@ export default class Model {
* * {@link #change `change()`},
* * {@link #enqueueChange `enqueueChange()`}.
*
* @param {'transparent'|'default'} [type='default'] The type of the batch.
* @returns {module:engine/model/batch~Batch}
*/
createBatch() {
return new Batch();
createBatch( type ) {
return new Batch( type );
}

/**
Expand Down
Loading

0 comments on commit 6a26a3b

Please sign in to comment.