jodit-pro-react 5.5.52 → 5.5.54

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-JS4ICKC5.mjs";
3
+ } from "./chunk-7DUORNPW.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.37";
196
+ APP_VERSION = "4.12.39";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -2404,6 +2404,9 @@ var init_append_script = __esm({
2404
2404
  async: true,
2405
2405
  src: completeUrl(url2)
2406
2406
  });
2407
+ if (jodit.o.nonce) {
2408
+ script.setAttribute("nonce", jodit.o.nonce);
2409
+ }
2407
2410
  jodit.e.one(script, "error", reject).one(script, "load", resolve);
2408
2411
  jodit.od.body.appendChild(script);
2409
2412
  });
@@ -2417,6 +2420,9 @@ var init_append_script = __esm({
2417
2420
  link2.rel = "stylesheet";
2418
2421
  link2.media = "all";
2419
2422
  link2.crossOrigin = "anonymous";
2423
+ if (jodit.o.nonce) {
2424
+ link2.setAttribute("nonce", jodit.o.nonce);
2425
+ }
2420
2426
  const callback = () => resolve(link2);
2421
2427
  !jodit.isInDestruct && jodit.e.on(link2, "load", callback).on(link2, "error", reject);
2422
2428
  link2.href = completeUrl(url2);
@@ -2906,6 +2912,9 @@ function getContainer(jodit, classFunc, tag = "div", createInsideEditor = false)
2906
2912
  const box = c70.element(tag, {
2907
2913
  className: `jodit jodit-${kebabCase(name)}-container jodit-box`
2908
2914
  });
2915
+ if (view.o.nonce && (tag === "style" || tag === "script")) {
2916
+ box.setAttribute("nonce", view.o.nonce);
2917
+ }
2909
2918
  box.classList.add(`jodit_theme_${view.o.theme || "default"}`);
2910
2919
  body.appendChild(box);
2911
2920
  data[key3] = box;
@@ -3652,6 +3661,7 @@ var init_config = __esm({
3652
3661
  this.ownerDocument = globalDocument;
3653
3662
  this.ownerWindow = globalWindow;
3654
3663
  this.shadowRoot = null;
3664
+ this.nonce = "";
3655
3665
  this.zIndex = 0;
3656
3666
  this.readonly = false;
3657
3667
  this.disabled = false;
@@ -4299,7 +4309,8 @@ function inView(elm, root, doc) {
4299
4309
  return false;
4300
4310
  }
4301
4311
  }
4302
- return top <= (doc.documentElement && doc.documentElement.clientHeight || 0);
4312
+ const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
4313
+ return top <= clientHeight && top + height >= 0;
4303
4314
  }
4304
4315
  function scrollIntoViewIfNeeded(elm, root, doc) {
4305
4316
  if (Dom.isHTMLElement(elm) && !inView(elm, root, doc)) {
@@ -22460,7 +22471,7 @@ function fullsize(editor) {
22460
22471
  editor.registerButton({
22461
22472
  name: "fullsize"
22462
22473
  });
22463
- let isEnabled = false, oldHeight = 0, oldWidth = 0, wasToggled = false;
22474
+ let isEnabled = false, oldHeight = 0, oldWidth = 0, savedScrollLeft = 0, savedScrollTop = 0, wasToggled = false;
22464
22475
  const resize2 = () => {
22465
22476
  const { container, events } = editor;
22466
22477
  if (!events) {
@@ -22503,12 +22514,19 @@ function fullsize(editor) {
22503
22514
  enable ? fullsizeStack.add(container) : fullsizeStack.delete(container);
22504
22515
  const shouldToggleGlobalFullsize = editor.o.globalFullSize && (fullsizeStack.size === 1 && enable || fullsizeStack.size === 0 && !enable);
22505
22516
  if (shouldToggleGlobalFullsize) {
22517
+ if (enable) {
22518
+ savedScrollLeft = editor.ow.scrollX;
22519
+ savedScrollTop = editor.ow.scrollY;
22520
+ }
22506
22521
  let node = container.parentNode;
22507
22522
  while (node && node.nodeType !== Node.DOCUMENT_NODE && node.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
22508
22523
  node.classList.toggle("jodit_fullsize-box_true", enable);
22509
22524
  node = node.parentNode;
22510
22525
  }
22511
22526
  resize2();
22527
+ if (!enable) {
22528
+ editor.ow.scrollTo(savedScrollLeft, savedScrollTop);
22529
+ }
22512
22530
  }
22513
22531
  events.fire("afterResize");
22514
22532
  };
@@ -25489,6 +25507,7 @@ Config.prototype.link = {
25489
25507
  followOnDblClick: false,
25490
25508
  processVideoLink: true,
25491
25509
  processPastedLink: true,
25510
+ deriveUrlFromText: false,
25492
25511
  noFollowCheckbox: true,
25493
25512
  openInNewTabCheckbox: true,
25494
25513
  openInNewTabCheckboxDefaultChecked: false,
@@ -25671,6 +25690,9 @@ var link = class extends Plugin {
25671
25690
  insert.textContent = i18n2("Update");
25672
25691
  } else {
25673
25692
  Dom.hide(unlink);
25693
+ if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
25694
+ url_input.value = guessUrlFromText(content_input.value);
25695
+ }
25674
25696
  if (openInNewTabCheckbox && target_checkbox) {
25675
25697
  target_checkbox.checked = openInNewTabCheckboxDefaultChecked;
25676
25698
  }
@@ -25784,6 +25806,22 @@ __decorate52([
25784
25806
  autobind
25785
25807
  ], link.prototype, "__onClickReadOnlyLink", null);
25786
25808
  pluginSystem.add("link", link);
25809
+ function guessUrlFromText(text2) {
25810
+ const value = text2.trim();
25811
+ if (!value || /\s/.test(value)) {
25812
+ return "";
25813
+ }
25814
+ if (/^(https?:|mailto:|tel:|ftp:|#|\/|\.{1,2}\/)/i.test(value)) {
25815
+ return value;
25816
+ }
25817
+ if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
25818
+ return `mailto:${value}`;
25819
+ }
25820
+ if (/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/\S*)?$/i.test(value)) {
25821
+ return `https://${value}`;
25822
+ }
25823
+ return "";
25824
+ }
25787
25825
  function writeClasses(modeClassName, className_input, className_select, a75) {
25788
25826
  var _a2;
25789
25827
  if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-JS4ICKC5.mjs";
5
+ } from "./chunk-7DUORNPW.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;