jodit 4.12.36 → 4.12.38

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 (65) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +57 -2
  5. package/es2015/jodit.min.js +6 -6
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +4 -4
  13. package/es2018/jodit.min.js +6 -6
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +6 -6
  18. package/es2021/jodit.js +57 -2
  19. package/es2021/jodit.min.js +8 -8
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +6 -6
  28. package/es2021.en/jodit.js +57 -2
  29. package/es2021.en/jodit.min.js +7 -7
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +57 -2
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/config.d.ts +36 -6
  51. package/esm/config.js +14 -0
  52. package/esm/core/constants.js +1 -1
  53. package/esm/core/global.js +4 -0
  54. package/esm/core/helpers/utils/append-script.js +6 -0
  55. package/esm/plugins/link/config.d.ts +8 -0
  56. package/esm/plugins/link/config.js +1 -0
  57. package/esm/plugins/link/link.js +30 -0
  58. package/esm/plugins/source/config.d.ts +14 -6
  59. package/esm/plugins/source/editor/engines/ace.js +5 -0
  60. package/esm/types/view.d.ts +6 -0
  61. package/package.json +1 -1
  62. package/types/config.d.ts +36 -6
  63. package/types/plugins/link/config.d.ts +8 -0
  64. package/types/plugins/source/config.d.ts +14 -6
  65. package/types/types/view.d.ts +6 -0
package/es5/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.12.36
4
+ * Version: v4.12.38
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -300,6 +300,19 @@ var ConfigPrototype = {};
300
300
  * editor.value = '<p>start</p>';
301
301
  * ```
302
302
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_2__._)(this, "shadowRoot", null);
303
+ /**
304
+ * CSP nonce applied to every `<style>`, `<script>` and `<link>` element
305
+ * Jodit injects at runtime (plugin styles, CDN scripts for ACE/beautify,
306
+ * downloaded stylesheets). Set it to the same nonce your server puts in the
307
+ * `Content-Security-Policy` header so a strict `style-src`/`script-src`
308
+ * policy does not block the editor.
309
+ *
310
+ * ```js
311
+ * Jodit.make('#editor', {
312
+ * nonce: 'r4nd0m'
313
+ * });
314
+ * ```
315
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_2__._)(this, "nonce", '');
303
316
  /**
304
317
  * Base CSS `z-index` for the editor UI (toolbar, popups, dialogs).
305
318
  * Set to a higher value when other page elements overlap the editor.
@@ -2074,7 +2087,7 @@ __webpack_require__.r(__webpack_exports__);
2074
2087
  * @packageDocumentation
2075
2088
  * @module constants
2076
2089
  */
2077
- var APP_VERSION = "4.12.36";
2090
+ var APP_VERSION = "4.12.38";
2078
2091
  // prettier-ignore
2079
2092
  var ES = "es5";
2080
2093
  var IS_ES_MODERN = false;
@@ -5674,6 +5687,10 @@ var boxes = new WeakMap();
5674
5687
  var box = c.element(tag, {
5675
5688
  className: "jodit jodit-".concat((0,jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_3__.kebabCase)(name), "-container jodit-box")
5676
5689
  });
5690
+ // Let a strict CSP accept the injected <style>/<script> box
5691
+ if (view.o.nonce && (tag === 'style' || tag === 'script')) {
5692
+ box.setAttribute('nonce', view.o.nonce);
5693
+ }
5677
5694
  box.classList.add("jodit_theme_".concat(view.o.theme || 'default'));
5678
5695
  body.appendChild(box);
5679
5696
  data[key] = box;
@@ -8599,6 +8616,9 @@ var cacheLoaders = function cacheLoaders(loader) {
8599
8616
  async: true,
8600
8617
  src: (0,_complete_url__WEBPACK_IMPORTED_MODULE_1__.completeUrl)(url)
8601
8618
  });
8619
+ if (jodit.o.nonce) {
8620
+ script.setAttribute('nonce', jodit.o.nonce);
8621
+ }
8602
8622
  jodit.e.one(script, 'error', reject).one(script, 'load', resolve);
8603
8623
  jodit.od.body.appendChild(script);
8604
8624
  });
@@ -8614,6 +8634,9 @@ var cacheLoaders = function cacheLoaders(loader) {
8614
8634
  link.rel = 'stylesheet';
8615
8635
  link.media = 'all';
8616
8636
  link.crossOrigin = 'anonymous';
8637
+ if (jodit.o.nonce) {
8638
+ link.setAttribute('nonce', jodit.o.nonce);
8639
+ }
8617
8640
  var callback = function callback() {
8618
8641
  return resolve(link);
8619
8642
  };
@@ -42266,6 +42289,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
42266
42289
  followOnDblClick: false,
42267
42290
  processVideoLink: true,
42268
42291
  processPastedLink: true,
42292
+ deriveUrlFromText: false,
42269
42293
  noFollowCheckbox: true,
42270
42294
  openInNewTabCheckbox: true,
42271
42295
  openInNewTabCheckboxDefaultChecked: false,
@@ -42505,6 +42529,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
42505
42529
  insert.textContent = i18n('Update');
42506
42530
  } else {
42507
42531
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.hide(unlink);
42532
+ if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
42533
+ url_input.value = guessUrlFromText(content_input.value);
42534
+ }
42508
42535
  if (openInNewTabCheckbox && target_checkbox) {
42509
42536
  target_checkbox.checked = openInNewTabCheckboxDefaultChecked;
42510
42537
  }
@@ -42634,6 +42661,29 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
42634
42661
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.autobind
42635
42662
  ], link.prototype, "__onClickReadOnlyLink", null);
42636
42663
  jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('link', link);
42664
+ /**
42665
+ * Guess a usable `href` from the selected text for the link dialog.
42666
+ * Returns an empty string when the text is not a plausible URL/email,
42667
+ * so plain text (e.g. "click here") is left untouched.
42668
+ */ function guessUrlFromText(text) {
42669
+ var value = text.trim();
42670
+ if (!value || /\s/.test(value)) {
42671
+ return '';
42672
+ }
42673
+ // already an explicit scheme, an anchor or a relative path
42674
+ if (/^(https?:|mailto:|tel:|ftp:|#|\/|\.{1,2}\/)/i.test(value)) {
42675
+ return value;
42676
+ }
42677
+ // email address -> mailto:
42678
+ if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
42679
+ return "mailto:".concat(value);
42680
+ }
42681
+ // bare domain like example.com or www.example.com/path -> https://
42682
+ if (/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/\S*)?$/i.test(value)) {
42683
+ return "https://".concat(value);
42684
+ }
42685
+ return '';
42686
+ }
42637
42687
  function writeClasses(modeClassName, className_input, className_select, a) {
42638
42688
  if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
42639
42689
  if (modeClassName === 'input') {
@@ -48391,6 +48441,11 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
48391
48441
  _this.instance.setOption('rtlText', true);
48392
48442
  _this.instance.setOption('rtl', true);
48393
48443
  }
48444
+ // Forward every native ACE option the user provided (theme,
48445
+ // mode, fontSize, tabSize, …). Without this only the handful of
48446
+ // keys explicitly wired below were applied and extras such as
48447
+ // `fontSize` were silently ignored. See #1285
48448
+ _this.instance.setOptions(editor.o.sourceEditorNativeOptions);
48394
48449
  _this.instance.setTheme(editor.o.sourceEditorNativeOptions.theme);
48395
48450
  _this.instance.renderer.setShowGutter(editor.o.sourceEditorNativeOptions.showGutter);
48396
48451
  _this.instance.getSession().setMode(editor.o.sourceEditorNativeOptions.mode);
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.12.36
4
+ * Version: v4.12.38
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.12.36
11
+ * Version: v4.12.38
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */