@anu3ev/fabric-image-editor 0.8.23 → 0.8.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +32 -21
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -10785,11 +10785,14 @@ var pa = {
10785
10785
  });
10786
10786
  }
10787
10787
  _applyPostStyleLayout({ textbox: e, placement: t, style: n, styleMaps: r, contentUpdate: i, contentPlacement: a, syncLineStylesWithText: o }) {
10788
- let s = e.text ?? "", c = this._hasBackgroundStyleUpdate({ style: n }), l = this._resolveShouldAutoExpand({
10788
+ let s = e.text ?? "", c = this._hasBackgroundStyleUpdate({ style: n }), l = this._shouldRefreshDimensions({
10789
+ contentUpdate: i,
10790
+ styleMaps: r
10791
+ }), u = this._resolveShouldAutoExpand({
10789
10792
  textbox: e,
10790
10793
  style: n,
10791
10794
  styleMaps: r,
10792
- contentUpdate: i
10795
+ shouldRefreshDimensions: l
10793
10796
  });
10794
10797
  c && (e.dirty = !0), this._applyAutoExpandPreference({
10795
10798
  textbox: e,
@@ -10802,7 +10805,8 @@ var pa = {
10802
10805
  }), this.runtime.normalizeTextboxAfterContentChange({
10803
10806
  textbox: e,
10804
10807
  placement: t,
10805
- shouldAutoExpand: l
10808
+ shouldAutoExpand: u,
10809
+ shouldRefreshDimensions: l
10806
10810
  }), a && this.runtime.restoreTextboxContentPlacement({
10807
10811
  textbox: e,
10808
10812
  contentPlacement: a
@@ -10822,14 +10826,16 @@ var pa = {
10822
10826
  e.radiusBottomLeft
10823
10827
  ].some((e) => e !== void 0);
10824
10828
  }
10825
- _resolveShouldAutoExpand({ textbox: e, style: t, styleMaps: n, contentUpdate: r }) {
10826
- let i = t.autoExpand ?? e.autoExpand, a = aa({ stylesList: [
10827
- n.updates,
10828
- n.selectionStyles,
10829
- n.lineSelectionStyles,
10830
- n.wholeTextStyles
10829
+ _resolveShouldAutoExpand({ textbox: e, style: t, styleMaps: n, shouldRefreshDimensions: r }) {
10830
+ return (t.autoExpand ?? e.autoExpand) !== !1 && !Object.prototype.hasOwnProperty.call(n.updates, "width") && r;
10831
+ }
10832
+ _shouldRefreshDimensions({ contentUpdate: e, styleMaps: t }) {
10833
+ return e.hasTextUpdate || e.uppercaseChanged || aa({ stylesList: [
10834
+ t.updates,
10835
+ t.selectionStyles,
10836
+ t.lineSelectionStyles,
10837
+ t.wholeTextStyles
10831
10838
  ] });
10832
- return i !== !1 && !Object.prototype.hasOwnProperty.call(n.updates, "width") && (r.hasTextUpdate || r.uppercaseChanged || a);
10833
10839
  }
10834
10840
  _applyAutoExpandPreference({ textbox: e, autoExpand: t }) {
10835
10841
  if (t !== void 0) {
@@ -11176,11 +11182,12 @@ var Wa = class {
11176
11182
  this._syncLineStylesWithText({ textbox: n });
11177
11183
  return;
11178
11184
  }
11179
- this._normalizeTextboxAfterContentChange({
11185
+ this._syncLineStylesWithText({ textbox: n }), this._normalizeTextboxAfterContentChange({
11180
11186
  textbox: n,
11181
11187
  placement: u,
11182
- shouldAutoExpand: c
11183
- }), this._syncLineStylesWithText({ textbox: n });
11188
+ shouldAutoExpand: c,
11189
+ shouldRefreshDimensions: !0
11190
+ });
11184
11191
  }, this._handleTextEditingExited = (t) => {
11185
11192
  let { target: n } = t;
11186
11193
  if (!e._isTextbox(n)) return;
@@ -11371,19 +11378,23 @@ var Wa = class {
11371
11378
  let n = t.split("\n").length, { textLines: r } = e;
11372
11379
  return Array.isArray(r) && r.length > n;
11373
11380
  }
11374
- _normalizeTextboxAfterContentChange({ textbox: e, placement: t, shouldAutoExpand: n, clampToMontage: r = !0 }) {
11375
- let i = !1;
11376
- n && (i = this._autoExpandTextboxWidth(e, {
11381
+ _normalizeTextboxAfterContentChange({ textbox: e, placement: t, shouldAutoExpand: n, clampToMontage: r = !0, shouldRefreshDimensions: i = !1 }) {
11382
+ let a = !1;
11383
+ n && (a = this._autoExpandTextboxWidth(e, {
11377
11384
  placement: t ?? void 0,
11378
11385
  clampToMontage: r
11379
11386
  }));
11380
- let a = !1;
11381
- i || (a = oa({ textbox: e }));
11382
- let o = !1;
11383
- return !i && t && (this.editor.canvasManager.applyObjectPlacement({
11387
+ let o = !1, s = !1;
11388
+ if (!a && i) {
11389
+ let t = e.width ?? 0, n = e.height ?? 0;
11390
+ e.initDimensions(), o = Math.abs((e.width ?? 0) - t) > .01 || Math.abs((e.height ?? 0) - n) > .01;
11391
+ }
11392
+ a || (s = oa({ textbox: e }));
11393
+ let c = !1;
11394
+ return !a && t && (this.editor.canvasManager.applyObjectPlacement({
11384
11395
  object: e,
11385
11396
  placement: t
11386
- }), o = !0), (i || a) && (e.dirty = !0), (i || a || o) && e.setCoords(), i || a;
11397
+ }), c = !0), (a || o || s) && (e.dirty = !0), (a || o || s || c) && e.setCoords(), a || o || s;
11387
11398
  }
11388
11399
  _restoreTextboxContentPlacement({ textbox: e, contentPlacement: t }) {
11389
11400
  let n = na({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anu3ev/fabric-image-editor",
3
- "version": "0.8.23",
3
+ "version": "0.8.24",
4
4
  "description": "TypeScript image editor library built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
5
5
  "module": "dist/main.js",
6
6
  "files": [