jodit-pro-react 5.5.22 → 5.5.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JoditEditor_default
3
- } from "./chunk-XL76ZVSM.mjs";
3
+ } from "./chunk-SHMXLPNW.mjs";
4
4
  export {
5
5
  JoditEditor_default as default
6
6
  };
@@ -193,7 +193,7 @@ var APP_VERSION, ES, IS_ES_MODERN, IS_ES_NEXT, IS_PROD, IS_TEST, FAT_MODE, HOMEP
193
193
  var init_constants = __esm({
194
194
  "node_modules/jodit/esm/core/constants.js"() {
195
195
  "use strict";
196
- APP_VERSION = "4.12.2";
196
+ APP_VERSION = "4.12.4";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -7878,6 +7878,7 @@ init_helpers();
7878
7878
 
7879
7879
  // node_modules/jodit/esm/core/ui/icon.js
7880
7880
  init_constants();
7881
+ init_dom();
7881
7882
  init_helpers();
7882
7883
  init_css();
7883
7884
  var Icon = class _Icon {
@@ -7935,7 +7936,7 @@ var Icon = class _Icon {
7935
7936
  } else {
7936
7937
  const svg = iconFromEvent || _Icon.get(name, "") || ((_d = jodit.o.extraIcons) === null || _d === void 0 ? void 0 : _d[name]);
7937
7938
  if (svg) {
7938
- iconElement = jodit.c.fromHTML(svg.trim());
7939
+ iconElement = _Icon.toIconElement(jodit, svg.trim());
7939
7940
  if (!/^<svg/i.test(name)) {
7940
7941
  iconElement.classList.add("jodit-icon_" + clearName);
7941
7942
  }
@@ -7951,6 +7952,19 @@ var Icon = class _Icon {
7951
7952
  }
7952
7953
  return iconElement;
7953
7954
  }
7955
+ /**
7956
+ * Turn a raw icon string into an element with a `classList`.
7957
+ *
7958
+ * A plain-text icon (e.g. an emoji/text glyph) makes `fromHTML` return a
7959
+ * Text node, which has no `classList`; wrap it in a span so classes/styles
7960
+ * can be applied and `makeIcon` never crashes on `iconElement.classList`.
7961
+ * Note: SVG icons are `SVGElement` (not `HTMLElement`) but are still Element
7962
+ * nodes with a `classList`, so we check `isElement`, not `isHTMLElement`.
7963
+ */
7964
+ static toIconElement(jodit, svg) {
7965
+ const node = jodit.c.fromHTML(svg);
7966
+ return Dom.isElement(node) ? node : jodit.c.span("jodit-icon_text", node);
7967
+ }
7954
7968
  };
7955
7969
  Icon.icons = {};
7956
7970
  Icon.__cache = /* @__PURE__ */ new Map();
@@ -31533,20 +31547,46 @@ var PII = 440;
31533
31547
  var WARN = 940;
31534
31548
 
31535
31549
  // node_modules/jodit/esm/plugins/speech-recognize/helpers/sound.js
31536
- function sound({ sec = 0.1, frequency = PII, gain = 0.1, type = "sine" } = {}) {
31537
- if (!globalWindow || typeof globalWindow.AudioContext === "undefined" && typeof globalWindow.webkitAudioContext === "undefined") {
31550
+ var contexts = /* @__PURE__ */ new WeakMap();
31551
+ function getContext(owner) {
31552
+ if (!globalWindow) {
31553
+ return null;
31554
+ }
31555
+ const existing = contexts.get(owner);
31556
+ if (existing && existing.state !== "closed") {
31557
+ return existing;
31558
+ }
31559
+ const Ctor = globalWindow.AudioContext || globalWindow.webkitAudioContext;
31560
+ if (!Ctor) {
31561
+ return null;
31562
+ }
31563
+ const context = new Ctor();
31564
+ contexts.set(owner, context);
31565
+ return context;
31566
+ }
31567
+ function sound(owner, { sec = 0.1, frequency = PII, gain = 0.1, type = "sine" } = {}) {
31568
+ const context = getContext(owner);
31569
+ if (!context) {
31538
31570
  return;
31539
31571
  }
31540
- const context = new (globalWindow.AudioContext || globalWindow.webkitAudioContext)();
31541
31572
  const vol = context.createGain();
31542
31573
  const osc = context.createOscillator();
31543
31574
  osc.type = type;
31544
31575
  osc.frequency.value = frequency;
31576
+ vol.gain.value = gain;
31545
31577
  osc.connect(vol);
31546
31578
  vol.connect(context.destination);
31547
31579
  osc.start();
31548
31580
  osc.stop(context.currentTime + sec);
31549
- vol.gain.value = gain;
31581
+ }
31582
+ function closeSound(owner) {
31583
+ const context = contexts.get(owner);
31584
+ if (context) {
31585
+ contexts.delete(owner);
31586
+ if (context.state !== "closed") {
31587
+ void context.close();
31588
+ }
31589
+ }
31550
31590
  }
31551
31591
 
31552
31592
  // node_modules/jodit/esm/plugins/speech-recognize/helpers/recognize-manager.js
@@ -31608,6 +31648,7 @@ var RecognizeManager = class _RecognizeManager extends Eventify {
31608
31648
  }
31609
31649
  destruct() {
31610
31650
  this.stop();
31651
+ closeSound(this);
31611
31652
  _RecognizeManager._instances.delete(this);
31612
31653
  super.destruct();
31613
31654
  }
@@ -31706,7 +31747,7 @@ var RecognizeManager = class _RecognizeManager extends Eventify {
31706
31747
  }
31707
31748
  _makeSound(frequency) {
31708
31749
  if (this.sound) {
31709
- sound({ frequency });
31750
+ sound(this, { frequency });
31710
31751
  }
31711
31752
  }
31712
31753
  };
@@ -31778,7 +31819,7 @@ Config.prototype.controls.speechRecognize = {
31778
31819
  api.on("result", (text) => jodit.e.fire("speechRecognizeResult", text));
31779
31820
  api.on("progress", (text) => jodit.e.fire("speechRecognizeProgressResult", text));
31780
31821
  api.on("error", (text) => jodit.message.error(text));
31781
- button.hookStatus("beforeDestruct", () => {
31822
+ jodit.hookStatus("beforeDestruct", () => {
31782
31823
  dataBind(jodit, "speech", null);
31783
31824
  api.destruct();
31784
31825
  });
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-XL76ZVSM.mjs";
5
+ } from "./chunk-SHMXLPNW.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;