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
@@ -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 @@ let ConfigPrototype = {};
300
300
  * editor.value = '<p>start</p>';
301
301
  * ```
302
302
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(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_0__._)(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.
@@ -1810,7 +1823,7 @@ __webpack_require__.r(__webpack_exports__);
1810
1823
  * ```
1811
1824
  * @packageDocumentation
1812
1825
  * @module constants
1813
- */ const APP_VERSION = "4.12.36";
1826
+ */ const APP_VERSION = "4.12.38";
1814
1827
  // prettier-ignore
1815
1828
  const ES = "es2021";
1816
1829
  const IS_ES_MODERN = true;
@@ -4758,6 +4771,10 @@ const boxes = new WeakMap();
4758
4771
  const box = c.element(tag, {
4759
4772
  className: `jodit jodit-${(0,jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_3__.kebabCase)(name)}-container jodit-box`
4760
4773
  });
4774
+ // Let a strict CSP accept the injected <style>/<script> box
4775
+ if (view.o.nonce && (tag === 'style' || tag === 'script')) {
4776
+ box.setAttribute('nonce', view.o.nonce);
4777
+ }
4761
4778
  box.classList.add(`jodit_theme_${view.o.theme || 'default'}`);
4762
4779
  body.appendChild(box);
4763
4780
  data[key] = box;
@@ -7576,6 +7593,9 @@ const cacheLoaders = (loader)=>{
7576
7593
  async: true,
7577
7594
  src: (0,_complete_url__WEBPACK_IMPORTED_MODULE_1__.completeUrl)(url)
7578
7595
  });
7596
+ if (jodit.o.nonce) {
7597
+ script.setAttribute('nonce', jodit.o.nonce);
7598
+ }
7579
7599
  jodit.e.one(script, 'error', reject).one(script, 'load', resolve);
7580
7600
  jodit.od.body.appendChild(script);
7581
7601
  });
@@ -7591,6 +7611,9 @@ const cacheLoaders = (loader)=>{
7591
7611
  link.rel = 'stylesheet';
7592
7612
  link.media = 'all';
7593
7613
  link.crossOrigin = 'anonymous';
7614
+ if (jodit.o.nonce) {
7615
+ link.setAttribute('nonce', jodit.o.nonce);
7616
+ }
7594
7617
  const callback = ()=>resolve(link);
7595
7618
  !jodit.isInDestruct && jodit.e.on(link, 'load', callback).on(link, 'error', reject);
7596
7619
  link.href = (0,_complete_url__WEBPACK_IMPORTED_MODULE_1__.completeUrl)(url);
@@ -34841,6 +34864,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
34841
34864
  followOnDblClick: false,
34842
34865
  processVideoLink: true,
34843
34866
  processPastedLink: true,
34867
+ deriveUrlFromText: false,
34844
34868
  noFollowCheckbox: true,
34845
34869
  openInNewTabCheckbox: true,
34846
34870
  openInNewTabCheckboxDefaultChecked: false,
@@ -35040,6 +35064,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
35040
35064
  insert.textContent = i18n('Update');
35041
35065
  } else {
35042
35066
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.hide(unlink);
35067
+ if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
35068
+ url_input.value = guessUrlFromText(content_input.value);
35069
+ }
35043
35070
  if (openInNewTabCheckbox && target_checkbox) {
35044
35071
  target_checkbox.checked = openInNewTabCheckboxDefaultChecked;
35045
35072
  }
@@ -35166,6 +35193,29 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
35166
35193
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
35167
35194
  ], link.prototype, "__onClickReadOnlyLink", null);
35168
35195
  jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
35196
+ /**
35197
+ * Guess a usable `href` from the selected text for the link dialog.
35198
+ * Returns an empty string when the text is not a plausible URL/email,
35199
+ * so plain text (e.g. "click here") is left untouched.
35200
+ */ function guessUrlFromText(text) {
35201
+ const value = text.trim();
35202
+ if (!value || /\s/.test(value)) {
35203
+ return '';
35204
+ }
35205
+ // already an explicit scheme, an anchor or a relative path
35206
+ if (/^(https?:|mailto:|tel:|ftp:|#|\/|\.{1,2}\/)/i.test(value)) {
35207
+ return value;
35208
+ }
35209
+ // email address -> mailto:
35210
+ if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
35211
+ return `mailto:${value}`;
35212
+ }
35213
+ // bare domain like example.com or www.example.com/path -> https://
35214
+ if (/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/\S*)?$/i.test(value)) {
35215
+ return `https://${value}`;
35216
+ }
35217
+ return '';
35218
+ }
35169
35219
  function writeClasses(modeClassName, className_input, className_select, a) {
35170
35220
  if (modeClassName && (className_input ?? className_select)) {
35171
35221
  if (modeClassName === 'input') {
@@ -39821,6 +39871,11 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
39821
39871
  this.instance.setOption('rtlText', true);
39822
39872
  this.instance.setOption('rtl', true);
39823
39873
  }
39874
+ // Forward every native ACE option the user provided (theme,
39875
+ // mode, fontSize, tabSize, …). Without this only the handful of
39876
+ // keys explicitly wired below were applied and extras such as
39877
+ // `fontSize` were silently ignored. See #1285
39878
+ this.instance.setOptions(editor.o.sourceEditorNativeOptions);
39824
39879
  this.instance.setTheme(editor.o.sourceEditorNativeOptions.theme);
39825
39880
  this.instance.renderer.setShowGutter(editor.o.sourceEditorNativeOptions.showGutter);
39826
39881
  this.instance.getSession().setMode(editor.o.sourceEditorNativeOptions.mode);