Skip to content

Commit

Permalink
Update ITextBehavior.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Oct 8, 2024
1 parent d350bb6 commit 1bca0b4
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/shapes/IText/ITextBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,11 @@ export abstract class ITextBehavior<

/**
* runs the actual logic that exits from editing state, see {@link exitEditing}
* Please use exitEditingImpl, this function was kept to avoid breaking changes.
* Will be removed in fabric 7.0
* @deprecated use "exitEditingImpl"
*/
exitEditingImpl() {
protected _exitEditing() {
const hiddenTextarea = this.hiddenTextarea;
this.selected = false;
this.isEditing = false;
Expand All @@ -690,9 +693,20 @@ export abstract class ITextBehavior<
this.hiddenTextarea = null;
this.abortCursorAnimation();
this.selectionStart !== this.selectionEnd && this.clearContextTop();

}

/**
* runs the actual logic that exits from editing state, see {@link exitEditing}
* But it does not fire events
*/
exitEditingImpl() {
this._exitEditing();
this.selectionEnd = this.selectionStart;
this._restoreEditingProps();
if (this._forceClearCache) {
this.initDimensions();
this.setCoords();
}
}

/**
Expand All @@ -701,10 +715,7 @@ export abstract class ITextBehavior<
exitEditing() {
const isTextChanged = this._textBeforeEdit !== this.text;
this.exitEditingImpl();
if (this._forceClearCache) {
this.initDimensions();
this.setCoords();
}

this.fire('editing:exited');
isTextChanged && this.fire(MODIFIED);
if (this.canvas) {
Expand Down

0 comments on commit 1bca0b4

Please sign in to comment.