|
@@ -85,6 +85,10 @@ export default class SelectionObserver extends Observer {
|
|
|
|
|
|
|
|
this._clearInfiniteLoopInterval = setInterval( () => this._clearInfiniteLoop(), 2000 );
|
|
this._clearInfiniteLoopInterval = setInterval( () => this._clearInfiniteLoop(), 2000 );
|
|
|
|
|
|
|
|
|
|
+ this.on( 'selectionChangeHandling', ( evt, data ) => {
|
|
|
|
|
+ this._handleSelectionChange( data.domDocument );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Private property to store the last selection, to check if the code does not enter infinite loop.
|
|
* Private property to store the last selection, to check if the code does not enter infinite loop.
|
|
|
*
|
|
*
|
|
@@ -119,7 +123,7 @@ export default class SelectionObserver extends Observer {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.listenTo( domDocument, 'selectionchange', () => {
|
|
this.listenTo( domDocument, 'selectionchange', () => {
|
|
|
- this._handleSelectionChange( domDocument );
|
|
|
|
|
|
|
+ this.fire( 'selectionChangeHandling', { domDocument } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
this._documents.add( domDocument );
|
|
this._documents.add( domDocument );
|
|
@@ -270,3 +274,12 @@ export default class SelectionObserver extends Observer {
|
|
|
* @param {module:engine/view/selection~Selection} data.newSelection New View selection which is converted DOM selection.
|
|
* @param {module:engine/view/selection~Selection} data.newSelection New View selection which is converted DOM selection.
|
|
|
* @param {Selection} data.domSelection Native DOM selection.
|
|
* @param {Selection} data.domSelection Native DOM selection.
|
|
|
*/
|
|
*/
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Fired when selection change is being handled.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @event module:engine/view/observer/selectionobserver~SelectionObserver#event:selectionChangeHandling
|
|
|
|
|
+ * @param {Object} data
|
|
|
|
|
+ * @param {Document} domDocument DOM document on which selectionchange event was fired.
|
|
|
|
|
+ */
|
|
|
|
|
+
|