|
@@ -100,8 +100,8 @@ export default class SelectionObserver extends Observer {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.listenTo( domDocument, 'selectionchange', () => {
|
|
|
|
|
- this._handleSelectionChange( domDocument );
|
|
|
|
|
|
|
+ this.listenTo( domDocument, 'selectionchange', evt => {
|
|
|
|
|
+ this._handleSelectionChange( evt, domDocument );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
this._documents.add( domDocument );
|
|
this._documents.add( domDocument );
|
|
@@ -123,13 +123,18 @@ export default class SelectionObserver extends Observer {
|
|
|
* and {@link module:engine/view/document~Document#event:selectionChangeDone} when selection stop changing.
|
|
* and {@link module:engine/view/document~Document#event:selectionChangeDone} when selection stop changing.
|
|
|
*
|
|
*
|
|
|
* @private
|
|
* @private
|
|
|
|
|
+ * @param {Event} domEvent DOM event.
|
|
|
* @param {Document} domDocument DOM document.
|
|
* @param {Document} domDocument DOM document.
|
|
|
*/
|
|
*/
|
|
|
- _handleSelectionChange( domDocument ) {
|
|
|
|
|
|
|
+ _handleSelectionChange( domEvent, domDocument ) {
|
|
|
if ( !this.isEnabled ) {
|
|
if ( !this.isEnabled ) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if ( this.checkShouldIgnoreEvent( domEvent ) ) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Ensure the mutation event will be before selection event on all browsers.
|
|
// Ensure the mutation event will be before selection event on all browsers.
|
|
|
this.mutationObserver.flush();
|
|
this.mutationObserver.flush();
|
|
|
|
|
|