jodit 4.12.41 → 4.12.44

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 (71) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +99 -6
  5. package/es2015/jodit.min.js +4 -4
  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 +4 -4
  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 +99 -6
  19. package/es2021/jodit.min.js +6 -6
  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 +99 -6
  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 +99 -6
  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 +22 -0
  51. package/esm/config.js +21 -0
  52. package/esm/core/constants.js +1 -1
  53. package/esm/core/storage/async-storage.d.ts +2 -2
  54. package/esm/core/storage/async-storage.js +19 -1
  55. package/esm/core/storage/engines/local-storage-provider.js +6 -1
  56. package/esm/core/view/view.js +1 -1
  57. package/esm/plugins/clean-html/helpers/index.d.ts +1 -0
  58. package/esm/plugins/clean-html/helpers/index.js +1 -0
  59. package/esm/plugins/clean-html/helpers/is-allowed-media-embed.d.ts +15 -0
  60. package/esm/plugins/clean-html/helpers/is-allowed-media-embed.js +28 -0
  61. package/esm/plugins/clean-html/helpers/visitor/filters/sandbox-iframes-in-content.js +7 -0
  62. package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +9 -1
  63. package/esm/types/storage.d.ts +15 -0
  64. package/esm/types/view.d.ts +8 -1
  65. package/package.json +1 -1
  66. package/types/config.d.ts +22 -0
  67. package/types/core/storage/async-storage.d.ts +2 -2
  68. package/types/plugins/clean-html/helpers/index.d.ts +1 -0
  69. package/types/plugins/clean-html/helpers/is-allowed-media-embed.d.ts +15 -0
  70. package/types/types/storage.d.ts +15 -0
  71. package/types/types/view.d.ts +8 -1
package/es2021/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.41
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -378,6 +378,26 @@ let ConfigPrototype = {};
378
378
  /**
379
379
  * if set true, then the current mode is saved in a cookie, and is restored after a reload of the page
380
380
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "saveModeInStorage", false);
381
+ /**
382
+ * Configure the provider that backs {@link IViewBased.asyncStorage}.
383
+ *
384
+ * By default the editor's `asyncStorage` uses persistent `IndexedDB` (with an
385
+ * in-memory fallback when it is unavailable). Set `defaultProvider` to override it:
386
+ * - `'local'` — persist in `localStorage`;
387
+ * - `'memory'` — keep everything in memory (nothing survives a reload);
388
+ * - a custom {@link IAsyncStorage} implementation — plug in your own backend.
389
+ *
390
+ * ```javascript
391
+ * Jodit.make('#editor', {
392
+ * asyncStorage: { defaultProvider: 'local' }
393
+ * });
394
+ *
395
+ * // or a fully custom backend
396
+ * Jodit.make('#editor', {
397
+ * asyncStorage: { defaultProvider: myAsyncStorage }
398
+ * });
399
+ * ```
400
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "asyncStorage", {});
381
401
  /**
382
402
  * Class name that can be appended to the editable area
383
403
  *
@@ -1823,7 +1843,7 @@ __webpack_require__.r(__webpack_exports__);
1823
1843
  * ```
1824
1844
  * @packageDocumentation
1825
1845
  * @module constants
1826
- */ const APP_VERSION = "4.12.41";
1846
+ */ const APP_VERSION = "4.12.44";
1827
1847
  // prettier-ignore
1828
1848
  const ES = "es2021";
1829
1849
  const IS_ES_MODERN = true;
@@ -13031,9 +13051,23 @@ class AsyncStorage {
13031
13051
  await provider.close();
13032
13052
  }
13033
13053
  }
13034
- static makeStorage(persistentOrStrategy = false, suffix) {
13054
+ static makeStorage(persistentOrStrategy = false, suffix, options) {
13035
13055
  let provider = undefined;
13036
13056
  let storage = null;
13057
+ // An explicit `defaultProvider` overrides the strategy-based selection
13058
+ // below and decides which provider backs the storage.
13059
+ const defaultProvider = options?.defaultProvider;
13060
+ if (defaultProvider != null) {
13061
+ if (defaultProvider === 'local') {
13062
+ provider = (0,_engines_local_storage_provider__WEBPACK_IMPORTED_MODULE_3__.canUsePersistentStorage)('localStorage') ? new _engines_local_storage_provider__WEBPACK_IMPORTED_MODULE_3__.LocalStorageProvider(_storage__WEBPACK_IMPORTED_MODULE_5__.StorageKey + (suffix || '')) : new _engines_memory_storage_provider__WEBPACK_IMPORTED_MODULE_4__.MemoryStorageProvider();
13063
+ } else if (defaultProvider === 'memory') {
13064
+ provider = new _engines_memory_storage_provider__WEBPACK_IMPORTED_MODULE_4__.MemoryStorageProvider();
13065
+ } else {
13066
+ // A custom IAsyncStorage implementation, used as-is.
13067
+ provider = defaultProvider;
13068
+ }
13069
+ return new AsyncStorage(Promise.resolve(provider), suffix);
13070
+ }
13037
13071
  if (persistentOrStrategy === 'localStorage' || persistentOrStrategy === 'sessionStorage') {
13038
13072
  if ((0,_engines_local_storage_provider__WEBPACK_IMPORTED_MODULE_3__.canUsePersistentStorage)(persistentOrStrategy)) {
13039
13073
  provider = new _engines_local_storage_provider__WEBPACK_IMPORTED_MODULE_3__.LocalStorageProvider(_storage__WEBPACK_IMPORTED_MODULE_5__.StorageKey + (suffix || ''), persistentOrStrategy);
@@ -13321,7 +13355,12 @@ function clearUseIndexedDBCache() {
13321
13355
  }
13322
13356
  delete(key) {
13323
13357
  try {
13324
- this.storage.removeItem(this.rootKey);
13358
+ const buffer = this.storage.getItem(this.rootKey);
13359
+ if (buffer) {
13360
+ const json = JSON.parse(buffer);
13361
+ delete json[key];
13362
+ this.storage.setItem(this.rootKey, JSON.stringify(json));
13363
+ }
13325
13364
  } catch {}
13326
13365
  return this;
13327
13366
  }
@@ -16686,7 +16725,7 @@ class View extends jodit_core_component_component__WEBPACK_IMPORTED_MODULE_3__.C
16686
16725
  /**
16687
16726
  * Container for persistent set/get value
16688
16727
  */ get asyncStorage() {
16689
- return jodit_core_storage_async_storage__WEBPACK_IMPORTED_MODULE_14__.AsyncStorage.makeStorage(true, this.id);
16728
+ return jodit_core_storage_async_storage__WEBPACK_IMPORTED_MODULE_14__.AsyncStorage.makeStorage(true, this.id, this.o.asyncStorage);
16690
16729
  }
16691
16730
  /**
16692
16731
  * Short alias for `create`
@@ -27839,6 +27878,43 @@ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__.Icon.set('eraser', (_eraser_svg_
27839
27878
 
27840
27879
 
27841
27880
 
27881
+
27882
+ /***/ }),
27883
+
27884
+ /***/ 28665:
27885
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27886
+
27887
+ "use strict";
27888
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27889
+ /* harmony export */ isAllowedMediaEmbed: function() { return /* binding */ isAllowedMediaEmbed; }
27890
+ /* harmony export */ });
27891
+ /*!
27892
+ * Jodit Editor (https://xdsoft.net/jodit/)
27893
+ * Released under MIT see LICENSE.txt in the project root for license information.
27894
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
27895
+ */ /**
27896
+ * @module plugins/clean-html
27897
+ */ // The embed URLs produced by the built-in Video button (see
27898
+ // `convertMediaUrlToVideoEmbed`): `//www.youtube.com/embed/<id>` and
27899
+ // `//player.vimeo.com/video/<id>`. `youtube-nocookie.com` is the privacy
27900
+ // variant YouTube offers for the same `/embed/` player. The `/embed/` and
27901
+ // `/video/` path prefixes are required so a bare provider link
27902
+ // (`youtube.com/@somebody`) is not treated as a player.
27903
+ const YOUTUBE_EMBED = /^(https?:)?\/\/(www\.|m\.|music\.)?youtube(-nocookie)?\.com\/embed\//i;
27904
+ const VIMEO_EMBED = /^(https?:)?\/\/player\.vimeo\.com\/video\//i;
27905
+ /**
27906
+ * Whether an `<iframe>` `src` points at a recognized YouTube/Vimeo video
27907
+ * player. Such iframes are inserted intentionally through the Video button, so
27908
+ * clean-html must not strip them (`denyTags` includes `iframe` by default) or
27909
+ * neutralize them with an empty `sandbox=""` (#1381). Arbitrary/bare iframes
27910
+ * are still removed.
27911
+ *
27912
+ * @private
27913
+ */ function isAllowedMediaEmbed(src) {
27914
+ return YOUTUBE_EMBED.test(src) || VIMEO_EMBED.test(src);
27915
+ }
27916
+
27917
+
27842
27918
  /***/ }),
27843
27919
 
27844
27920
  /***/ 37431:
@@ -28327,6 +28403,7 @@ __webpack_require__.r(__webpack_exports__);
28327
28403
  /* harmony export */ });
28328
28404
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
28329
28405
  /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7909);
28406
+ /* harmony import */ var _is_allowed_media_embed__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28665);
28330
28407
  /*!
28331
28408
  * Jodit Editor (https://xdsoft.net/jodit/)
28332
28409
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28335,6 +28412,7 @@ __webpack_require__.r(__webpack_exports__);
28335
28412
  * @module plugins/clean-html
28336
28413
  */
28337
28414
 
28415
+
28338
28416
  /**
28339
28417
  * Add `sandbox=""` attribute to all `<iframe>` elements in the editor content
28340
28418
  * @private
@@ -28343,6 +28421,12 @@ __webpack_require__.r(__webpack_exports__);
28343
28421
  return hadEffect;
28344
28422
  }
28345
28423
  const elm = nodeElm;
28424
+ // A trusted YouTube/Vimeo player (inserted via the Video button) must not
28425
+ // get an empty `sandbox=""` — that blocks scripts and stops playback. It
28426
+ // is served in its own third-party origin, so leave it as-is (#1381).
28427
+ if ((0,_is_allowed_media_embed__WEBPACK_IMPORTED_MODULE_2__.isAllowedMediaEmbed)((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'src') || '')) {
28428
+ return hadEffect;
28429
+ }
28346
28430
  if (!elm.hasAttribute('sandbox')) {
28347
28431
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'sandbox', '');
28348
28432
  return true;
@@ -28479,6 +28563,8 @@ function filterStyleProperties(style, allowed) {
28479
28563
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
28480
28564
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23211);
28481
28565
  /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4040);
28566
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7909);
28567
+ /* harmony import */ var _is_allowed_media_embed__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28665);
28482
28568
  /*!
28483
28569
  * Jodit Editor (https://xdsoft.net/jodit/)
28484
28570
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28488,6 +28574,8 @@ function filterStyleProperties(style, allowed) {
28488
28574
  */
28489
28575
 
28490
28576
 
28577
+
28578
+
28491
28579
  /**
28492
28580
  * @private
28493
28581
  */ function tryRemoveNode(jodit, nodeElm, hadEffect, allowTags, denyTags, currentSelectionNode) {
@@ -28504,7 +28592,12 @@ function filterStyleProperties(style, allowed) {
28504
28592
  if (allow && !allow[node.nodeName]) {
28505
28593
  return true;
28506
28594
  }
28507
- if (!allow && deny && deny[node.nodeName]) {
28595
+ // A YouTube/Vimeo player inserted through the Video button is trusted
28596
+ // editor content, so keep it even though `iframe` is denied by default
28597
+ // — otherwise the embed is stripped ~300ms after insertion (#1381).
28598
+ // Arbitrary/bare iframes stay denied.
28599
+ const isTrustedEmbed = node.nodeName === 'IFRAME' && (0,_is_allowed_media_embed__WEBPACK_IMPORTED_MODULE_4__.isAllowedMediaEmbed)((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__.attr)(node, 'src') || '');
28600
+ if (!allow && deny && deny[node.nodeName] && !isTrustedEmbed) {
28508
28601
  return true;
28509
28602
  }
28510
28603
  }