jodit-pro-react 5.5.23 → 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-5AVIC5K4.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.3";
196
+ APP_VERSION = "4.12.4";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -31547,20 +31547,46 @@ var PII = 440;
31547
31547
  var WARN = 940;
31548
31548
 
31549
31549
  // node_modules/jodit/esm/plugins/speech-recognize/helpers/sound.js
31550
- function sound({ sec = 0.1, frequency = PII, gain = 0.1, type = "sine" } = {}) {
31551
- 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) {
31552
31570
  return;
31553
31571
  }
31554
- const context = new (globalWindow.AudioContext || globalWindow.webkitAudioContext)();
31555
31572
  const vol = context.createGain();
31556
31573
  const osc = context.createOscillator();
31557
31574
  osc.type = type;
31558
31575
  osc.frequency.value = frequency;
31576
+ vol.gain.value = gain;
31559
31577
  osc.connect(vol);
31560
31578
  vol.connect(context.destination);
31561
31579
  osc.start();
31562
31580
  osc.stop(context.currentTime + sec);
31563
- 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
+ }
31564
31590
  }
31565
31591
 
31566
31592
  // node_modules/jodit/esm/plugins/speech-recognize/helpers/recognize-manager.js
@@ -31622,6 +31648,7 @@ var RecognizeManager = class _RecognizeManager extends Eventify {
31622
31648
  }
31623
31649
  destruct() {
31624
31650
  this.stop();
31651
+ closeSound(this);
31625
31652
  _RecognizeManager._instances.delete(this);
31626
31653
  super.destruct();
31627
31654
  }
@@ -31720,7 +31747,7 @@ var RecognizeManager = class _RecognizeManager extends Eventify {
31720
31747
  }
31721
31748
  _makeSound(frequency) {
31722
31749
  if (this.sound) {
31723
- sound({ frequency });
31750
+ sound(this, { frequency });
31724
31751
  }
31725
31752
  }
31726
31753
  };
@@ -31792,7 +31819,7 @@ Config.prototype.controls.speechRecognize = {
31792
31819
  api.on("result", (text) => jodit.e.fire("speechRecognizeResult", text));
31793
31820
  api.on("progress", (text) => jodit.e.fire("speechRecognizeProgressResult", text));
31794
31821
  api.on("error", (text) => jodit.message.error(text));
31795
- button.hookStatus("beforeDestruct", () => {
31822
+ jodit.hookStatus("beforeDestruct", () => {
31796
31823
  dataBind(jodit, "speech", null);
31797
31824
  api.destruct();
31798
31825
  });
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-5AVIC5K4.mjs";
5
+ } from "./chunk-SHMXLPNW.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;