@ckeditor/ckeditor5-image
Advanced tools
Comparing version 15.0.0 to 16.0.0
Changelog | ||
========= | ||
## [16.0.0](https://github.com/ckeditor/ckeditor5-image/compare/v15.0.0...v16.0.0) (2019-12-04) | ||
### Bug fixes | ||
* Improved markup operation performance of the editor with the image plugin enabled. See [ckeditor/ckeditor5#4504](https://github.com/ckeditor/ckeditor5/issues/4504). ([6c7fc94](https://github.com/ckeditor/ckeditor5-image/commit/6c7fc94)) | ||
### Other changes | ||
* Updated translations. ([01cdb59](https://github.com/ckeditor/ckeditor5-image/commit/01cdb59)) | ||
## [15.0.0](https://github.com/ckeditor/ckeditor5-image/compare/v14.0.0...v15.0.0) (2019-10-23) | ||
@@ -5,0 +16,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-image", | ||
"version": "15.0.0", | ||
"version": "16.0.0", | ||
"description": "Image feature for CKEditor 5.", | ||
@@ -13,29 +13,31 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^15.0.0", | ||
"@ckeditor/ckeditor5-engine": "^15.0.0", | ||
"@ckeditor/ckeditor5-ui": "^15.0.0", | ||
"@ckeditor/ckeditor5-upload": "^15.0.0", | ||
"@ckeditor/ckeditor5-utils": "^15.0.0", | ||
"@ckeditor/ckeditor5-widget": "^15.0.0" | ||
"@ckeditor/ckeditor5-core": "^16.0.0", | ||
"@ckeditor/ckeditor5-engine": "^16.0.0", | ||
"@ckeditor/ckeditor5-ui": "^16.0.0", | ||
"@ckeditor/ckeditor5-upload": "^16.0.0", | ||
"@ckeditor/ckeditor5-utils": "^16.0.0", | ||
"@ckeditor/ckeditor5-widget": "^16.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^15.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^15.0.0", | ||
"@ckeditor/ckeditor5-cloud-services": "^15.0.0", | ||
"@ckeditor/ckeditor5-clipboard": "^15.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^15.0.0", | ||
"@ckeditor/ckeditor5-enter": "^15.0.0", | ||
"@ckeditor/ckeditor5-easy-image": "^15.0.0", | ||
"@ckeditor/ckeditor5-heading": "^15.0.0", | ||
"@ckeditor/ckeditor5-indent": "^15.0.0", | ||
"@ckeditor/ckeditor5-link": "^15.0.0", | ||
"@ckeditor/ckeditor5-list": "^15.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^15.0.0", | ||
"@ckeditor/ckeditor5-table": "^15.0.0", | ||
"@ckeditor/ckeditor5-typing": "^15.0.0", | ||
"@ckeditor/ckeditor5-undo": "^15.0.0", | ||
"@ckeditor/ckeditor5-basic-styles": "^16.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^16.0.0", | ||
"@ckeditor/ckeditor5-cloud-services": "^16.0.0", | ||
"@ckeditor/ckeditor5-clipboard": "^16.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^16.0.0", | ||
"@ckeditor/ckeditor5-enter": "^16.0.0", | ||
"@ckeditor/ckeditor5-easy-image": "^16.0.0", | ||
"@ckeditor/ckeditor5-heading": "^16.0.0", | ||
"@ckeditor/ckeditor5-indent": "^16.0.0", | ||
"@ckeditor/ckeditor5-link": "^16.0.0", | ||
"@ckeditor/ckeditor5-list": "^16.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^16.0.0", | ||
"@ckeditor/ckeditor5-table": "^16.0.0", | ||
"@ckeditor/ckeditor5-typing": "^16.0.0", | ||
"@ckeditor/ckeditor5-undo": "^16.0.0", | ||
"eslint": "^5.5.0", | ||
"eslint-config-ckeditor5": "^2.0.0", | ||
"husky": "^1.3.1", | ||
"lint-staged": "^7.0.0" | ||
"lint-staged": "^7.0.0", | ||
"stylelint": "^11.1.1", | ||
"stylelint-config-ckeditor5": "^1.0.0" | ||
}, | ||
@@ -60,3 +62,4 @@ "engines": { | ||
"scripts": { | ||
"lint": "eslint --quiet '**/*.js'" | ||
"lint": "eslint --quiet '**/*.js'", | ||
"stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css' 'docs/**/*.css'" | ||
}, | ||
@@ -66,2 +69,5 @@ "lint-staged": { | ||
"eslint --quiet" | ||
], | ||
"**/*.css": [ | ||
"stylelint --quiet --allow-empty-input" | ||
] | ||
@@ -68,0 +74,0 @@ }, |
@@ -23,61 +23,14 @@ /** | ||
export default class ImageLoadObserver extends Observer { | ||
constructor( view ) { | ||
super( view ); | ||
/** | ||
* List of img DOM elements that are observed by this observer. | ||
* | ||
* @private | ||
* @type {Set.<HTMLElement>} | ||
*/ | ||
this._observedElements = new Set(); | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
observe( domRoot, name ) { | ||
const viewRoot = this.document.getRoot( name ); | ||
observe( domRoot ) { | ||
this.listenTo( domRoot, 'load', ( event, domEvent ) => { | ||
const domElement = domEvent.target; | ||
// When there is a change in one of the view element | ||
// we need to check if there are any new `<img/>` elements to observe. | ||
viewRoot.on( 'change:children', ( evt, node ) => { | ||
// Wait for the render to be sure that `<img/>` elements are rendered in the DOM root. | ||
this.view.once( 'render', () => this._updateObservedElements( domRoot, node ) ); | ||
} ); | ||
} | ||
/** | ||
* Updates the list of observed `<img/>` elements. | ||
* | ||
* @private | ||
* @param {HTMLElement} domRoot DOM root element. | ||
* @param {module:engine/view/element~Element} viewNode View element where children have changed. | ||
*/ | ||
_updateObservedElements( domRoot, viewNode ) { | ||
if ( !viewNode.is( 'element' ) || viewNode.is( 'attributeElement' ) ) { | ||
return; | ||
} | ||
const domNode = this.view.domConverter.mapViewToDom( viewNode ); | ||
// If there is no `domNode` it means that it was removed from the DOM in the meanwhile. | ||
if ( !domNode ) { | ||
return; | ||
} | ||
for ( const domElement of domNode.querySelectorAll( 'img' ) ) { | ||
if ( !this._observedElements.has( domElement ) ) { | ||
this.listenTo( domElement, 'load', ( evt, domEvt ) => this._fireEvents( domEvt ) ); | ||
this._observedElements.add( domElement ); | ||
if ( domElement.tagName == 'IMG' ) { | ||
this._fireEvents( domEvent ); | ||
} | ||
} | ||
// Clean up the list of observed elements from elements that has been removed from the root. | ||
for ( const domElement of this._observedElements ) { | ||
if ( !domRoot.contains( domElement ) ) { | ||
this.stopListening( domElement ); | ||
this._observedElements.delete( domElement ); | ||
} | ||
} | ||
// Use capture phase for better performance (#4504). | ||
}, { useCapture: true } ); | ||
} | ||
@@ -99,10 +52,2 @@ | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
destroy() { | ||
this._observedElements.clear(); | ||
super.destroy(); | ||
} | ||
} | ||
@@ -109,0 +54,0 @@ |
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
256598
95
21
3227
+ Added@ckeditor/ckeditor5-core@16.0.0(transitive)
+ Added@ckeditor/ckeditor5-engine@16.0.0(transitive)
+ Added@ckeditor/ckeditor5-ui@16.0.0(transitive)
+ Added@ckeditor/ckeditor5-upload@16.0.0(transitive)
+ Added@ckeditor/ckeditor5-utils@16.0.0(transitive)
+ Added@ckeditor/ckeditor5-widget@16.0.0(transitive)
- Removed@ckeditor/ckeditor5-core@15.0.0(transitive)
- Removed@ckeditor/ckeditor5-engine@15.0.0(transitive)
- Removed@ckeditor/ckeditor5-ui@15.0.0(transitive)
- Removed@ckeditor/ckeditor5-upload@15.0.0(transitive)
- Removed@ckeditor/ckeditor5-utils@15.0.0(transitive)
- Removed@ckeditor/ckeditor5-widget@15.0.0(transitive)
- Removedckeditor5@15.0.0(transitive)