mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-09 14:24:44 +00:00
Do not fire selection changed if we are not editing (#3702)
* Do not fire selection changed if we are not editing * fire selection changed event after enter editing * fix tests * fixed trailing space
This commit is contained in:
parent
c9e50febad
commit
085a3c75fc
3 changed files with 9 additions and 5 deletions
|
|
@ -355,7 +355,7 @@
|
|||
|
||||
this._tick();
|
||||
this.fire('editing:entered');
|
||||
|
||||
this._fireSelectionChanged();
|
||||
if (!this.canvas) {
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,8 +153,10 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
this.selectionStart = newSelection;
|
||||
this.selectionEnd = newSelection;
|
||||
}
|
||||
this._fireSelectionChanged();
|
||||
this._updateTextarea();
|
||||
if (this.isEditing) {
|
||||
this._fireSelectionChanged();
|
||||
this._updateTextarea();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
iText.on('selection:changed', countSelectionChange);
|
||||
|
||||
iText.enterEditing();
|
||||
equal(selection, 0, 'should not fire on enter edit');
|
||||
equal(selection, 1, 'will fire on enter edit since the cursor is changing for the first time');
|
||||
selection = 0;
|
||||
|
||||
iText.selectAll();
|
||||
equal(selection, 1, 'should fire once on selectAll');
|
||||
|
|
@ -144,7 +145,8 @@
|
|||
iText.on('selection:changed', countSelectionChange);
|
||||
|
||||
iText.enterEditing();
|
||||
equal(selection, 0, 'should not fire on enter edit');
|
||||
equal(selection, 1, 'should fire on enter edit');
|
||||
selection = 0;
|
||||
|
||||
iText.selectAll();
|
||||
equal(selection, 1, 'should fire once on selectAll');
|
||||
|
|
|
|||
Loading…
Reference in a new issue