@shotstack/shotstack-studio 2.22.5 → 2.22.6

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.
@@ -11,7 +11,7 @@ import "pixi.js/text-html";
11
11
  import "pixi.js/sprite-tiling";
12
12
  import "pixi.js/filters";
13
13
  import "pixi.js/mesh";
14
- const o8 = "2.22.4", l8 = {
14
+ const o8 = "2.22.5", l8 = {
15
15
  version: o8
16
16
  };
17
17
  function pv(e, t, i) {
@@ -71705,7 +71705,7 @@ class Qa extends xa {
71705
71705
  return;
71706
71706
  }
71707
71707
  }
71708
- n.key === "Enter" && (n.ctrlKey || n.metaKey) && (n.preventDefault(), this.textEditDebounceTimer && (clearTimeout(this.textEditDebounceTimer), this.textEditDebounceTimer = null), this.applyTextEdit(), this.closeAllPopups()), n.key === "Escape" && this.closeAllPopups();
71708
+ n.key === "Enter" && (n.ctrlKey || n.metaKey) && (n.preventDefault(), this.textEditDebounceTimer && (clearTimeout(this.textEditDebounceTimer), this.textEditDebounceTimer = null), this.applyTextEdit() && this.closeAllPopups()), n.key === "Escape" && this.closeAllPopups();
71709
71709
  }), this.setupOutsideClickHandler(), this.enableDrag(), this.appendDeleteButton(), t.style.position = "relative", t.insertBefore(this.container, t.firstChild), this.unsubFontCapabilities = this.edit.getInternalEvents().on(Et.FontCapabilitiesChanged, () => {
71710
71710
  this.container?.style.display !== "none" && this.syncState();
71711
71711
  }), this.unsubMergeFieldChanged = this.edit.getInternalEvents().on(Z.MergeFieldChanged, () => {
@@ -71929,7 +71929,7 @@ class Qa extends xa {
71929
71929
  this.togglePopup(this.textEditPopup, () => {
71930
71930
  if (this.textEditArea) {
71931
71931
  const t = this.edit.getTemplateClipText(this.selectedTrackIdx, this.selectedClipIdx), i = this.getCurrentAsset();
71932
- this.textEditArea.value = t ?? i?.text ?? "", this.textEditArea.focus();
71932
+ this.textEditArea.value = t ?? i?.text ?? "", this.textEditArea.setCustomValidity(""), this.textEditArea.focus();
71933
71933
  }
71934
71934
  });
71935
71935
  }
@@ -71942,9 +71942,16 @@ class Qa extends xa {
71942
71942
  this.applyTextEdit(), this.textEditDebounceTimer = null;
71943
71943
  }, 150);
71944
71944
  }
71945
+ validateTextEdit(t, i) {
71946
+ if (!this.textEditArea) return !1;
71947
+ const r = Math.max(t.length, i.length) > 5e3;
71948
+ return this.textEditArea.setCustomValidity(r ? "Text, including variable values, must be 5,000 characters or fewer." : ""), this.textEditArea.reportValidity();
71949
+ }
71945
71950
  applyTextEdit() {
71946
- if (!this.textEditArea) return;
71947
- const t = this.textEditArea.value, i = this.getShotstackEdit(), r = i?.mergeFields.resolve(t) ?? t, n = this.edit.getDocument(), s = this.edit.getClipId(this.selectedTrackIdx, this.selectedClipIdx);
71951
+ if (!this.textEditArea) return !1;
71952
+ const t = this.textEditArea.value, i = this.getShotstackEdit(), r = i?.mergeFields.resolve(t) ?? t;
71953
+ if (!this.validateTextEdit(t, r)) return !1;
71954
+ const n = this.edit.getDocument(), s = this.edit.getClipId(this.selectedTrackIdx, this.selectedClipIdx);
71948
71955
  if (i?.mergeFields.isMergeFieldTemplate(t)) {
71949
71956
  const a = {
71950
71957
  placeholder: t,
@@ -71952,9 +71959,9 @@ class Qa extends xa {
71952
71959
  };
71953
71960
  s && n && n.setClipBinding(s, "asset.text", a);
71954
71961
  } else s && n && n.removeClipBinding(s, "asset.text");
71955
- this.edit.updateClip(this.selectedTrackIdx, this.selectedClipIdx, {
71962
+ return this.edit.updateClip(this.selectedTrackIdx, this.selectedClipIdx, {
71956
71963
  asset: { text: r }
71957
- }), this.syncState();
71964
+ }), this.syncState(), !0;
71958
71965
  }
71959
71966
  // ─── Autocomplete for Merge Field Variables ─────────────────────────────────
71960
71967
  checkAutocomplete() {
@@ -71984,20 +71991,22 @@ class Qa extends xa {
71984
71991
  }
71985
71992
  insertVariable(t) {
71986
71993
  if (!this.textEditArea) return;
71987
- const i = this.textEditArea.value.substring(0, this.autocompleteStartPos), r = this.textEditArea.value.substring(this.textEditArea.selectionStart), n = `${i}{{ ${t} }}${r}`, a = this.getShotstackEdit()?.mergeFields.get(t)?.defaultValue ?? `{{ ${t} }}`, o = `${i}${a}${r}`;
71994
+ this.textEditDebounceTimer && (clearTimeout(this.textEditDebounceTimer), this.textEditDebounceTimer = null);
71995
+ const i = this.textEditArea.value.substring(0, this.autocompleteStartPos), r = this.textEditArea.value.substring(this.textEditArea.selectionStart), n = `${i}{{ ${t} }}${r}`, s = this.getShotstackEdit()?.mergeFields.resolve(n) ?? n;
71996
+ if (!this.validateTextEdit(n, s)) return;
71988
71997
  this.textEditArea.value = n;
71989
- const l = this.autocompleteStartPos + t.length + 6;
71990
- this.textEditArea.selectionStart = l, this.textEditArea.selectionEnd = l, this.textEditArea.focus(), this.hideAutocomplete();
71991
- const u = this.edit.getDocument(), c = this.edit.getClipId(this.selectedTrackIdx, this.selectedClipIdx);
71992
- if (c && u) {
71993
- const d = {
71998
+ const a = this.autocompleteStartPos + t.length + 6;
71999
+ this.textEditArea.selectionStart = a, this.textEditArea.selectionEnd = a, this.textEditArea.focus(), this.hideAutocomplete();
72000
+ const o = this.edit.getDocument(), l = this.edit.getClipId(this.selectedTrackIdx, this.selectedClipIdx);
72001
+ if (l && o) {
72002
+ const u = {
71994
72003
  placeholder: n,
71995
- resolvedValue: o
72004
+ resolvedValue: s
71996
72005
  };
71997
- u.setClipBinding(c, "asset.text", d);
72006
+ o.setClipBinding(l, "asset.text", u);
71998
72007
  }
71999
72008
  this.edit.updateClip(this.selectedTrackIdx, this.selectedClipIdx, {
72000
- asset: { text: o }
72009
+ asset: { text: s }
72001
72010
  }), this.syncState();
72002
72011
  }
72003
72012
  insertSelectedVariable() {