jodit 4.15.7 → 4.15.8

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 (57) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +50 -22
  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 +5 -5
  18. package/es2021/jodit.js +49 -21
  19. package/es2021/jodit.min.js +5 -5
  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 +5 -5
  28. package/es2021.en/jodit.js +49 -21
  29. package/es2021.en/jodit.min.js +5 -5
  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 +50 -22
  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 +2 -1
  51. package/esm/core/constants.js +1 -1
  52. package/esm/plugins/clean-html/config.d.ts +2 -1
  53. package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +10 -0
  54. package/esm/plugins/mobile/mobile.js +25 -4
  55. package/package.json +1 -1
  56. package/types/config.d.ts +2 -1
  57. package/types/plugins/clean-html/config.d.ts +2 -1
@@ -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.15.7
4
+ * Version: v4.15.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1779,7 +1779,7 @@ __webpack_require__.r(__webpack_exports__);
1779
1779
  * ```
1780
1780
  * @packageDocumentation
1781
1781
  * @module constants
1782
- */ const APP_VERSION = "4.15.7";
1782
+ */ const APP_VERSION = "4.15.8";
1783
1783
  // prettier-ignore
1784
1784
  const ES = "es2021";
1785
1785
  const IS_ES_MODERN = true;
@@ -29312,7 +29312,14 @@ function filterStyleProperties(style, allowed) {
29312
29312
  // a pending-format marker the user is about to type into (#1291). `current`
29313
29313
  // is captured before a click moves the caret, so also check the live caret.
29314
29314
  const liveCaret = jodit.s.isCollapsed() ? jodit.s.range.startContainer : null;
29315
- return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTemporary(node) && (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimInv)(node.innerHTML).length === 0 && (current == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, current)) && (liveCaret == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, liveCaret));
29315
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTemporary(node) && !isFragmentTarget(node) && (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimInv)(node.innerHTML).length === 0 && (current == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, current)) && (liveCaret == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, liveCaret));
29316
+ }
29317
+ /**
29318
+ * An element with an `id`, or an `<a>` with a `name`, is where an in-page link
29319
+ * (`#fragment`) lands. It is usually empty (`<a name="top"></a>`), and removing
29320
+ * it silently breaks every link that points at it.
29321
+ */ function isFragmentTarget(element) {
29322
+ return element.hasAttribute('id') || element.nodeName === 'A' && element.hasAttribute('name');
29316
29323
  }
29317
29324
 
29318
29325
 
@@ -36613,10 +36620,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.dots = {
36613
36620
 
36614
36621
  "use strict";
36615
36622
  /* unused harmony export mobile */
36616
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28077);
36617
- /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
36618
- /* harmony import */ var jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2496);
36619
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3244);
36623
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
36624
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28077);
36625
+ /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65946);
36626
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85932);
36627
+ /* harmony import */ var jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2496);
36628
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3244);
36620
36629
  /*!
36621
36630
  * Jodit Editor (https://xdsoft.net/jodit/)
36622
36631
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -36629,6 +36638,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.dots = {
36629
36638
 
36630
36639
 
36631
36640
 
36641
+
36642
+
36632
36643
  const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n';
36633
36644
  /**
36634
36645
  * Constrain a responsive breakpoint set (`buttonsMD/SM/XS`) to the buttons the
@@ -36642,13 +36653,13 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
36642
36653
  * the standard grouped mobile layout — groups, separators and `dots` — is
36643
36654
  * preserved. See #1389.
36644
36655
  */ function fitToButtons(list, editor) {
36645
- const allowed = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_2__.flatButtonsSet)((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.splitArray)(editor.o.buttons), editor);
36656
+ const allowed = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_4__.flatButtonsSet)((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttons), editor);
36646
36657
  const groups = editor.getRegisteredButtonGroups();
36647
36658
  let changed = false;
36648
36659
  let hadDots = false;
36649
36660
  const flat = [];
36650
36661
  for (const item of list){
36651
- if ((0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_2__.isButtonGroup)(item)) {
36662
+ if ((0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_4__.isButtonGroup)(item)) {
36652
36663
  const members = [
36653
36664
  ...item.buttons,
36654
36665
  ...groups[item.group] ?? []
@@ -36685,17 +36696,31 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
36685
36696
  // Keep the "show all" overflow button only if some requested button is still
36686
36697
  // hidden at this breakpoint.
36687
36698
  if (hadDots) {
36688
- const shown = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_2__.flatButtonsSet)(cleaned, editor);
36689
- if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.toArray)(allowed).some((button)=>!shown.has(button))) {
36699
+ const shown = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_4__.flatButtonsSet)(cleaned, editor);
36700
+ if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.toArray)(allowed).some((button)=>!shown.has(button))) {
36690
36701
  cleaned.push('dots');
36691
36702
  }
36692
36703
  }
36693
36704
  return cleaned;
36694
36705
  }
36706
+ /**
36707
+ * The width that decides which breakpoint set the toolbar uses. A toolbar
36708
+ * rendered into an external container (`toolbar` set to an element or a
36709
+ * selector) lays out in that container, so its width is what matters there.
36710
+ */ function adaptiveWidth(editor) {
36711
+ const { toolbar } = editor.o;
36712
+ if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__.isString)(toolbar) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(toolbar)) {
36713
+ const width = editor.toolbarContainer.offsetWidth;
36714
+ if (width) {
36715
+ return width;
36716
+ }
36717
+ }
36718
+ return (editor.container.parentElement ?? editor.container).offsetWidth;
36719
+ }
36695
36720
  /**
36696
36721
  * Rebuild toolbar in depends on editor's width
36697
36722
  */ function mobile(editor) {
36698
- let timeout = 0, store = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.splitArray)(editor.o.buttons);
36723
+ let timeout = 0, store = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttons);
36699
36724
  if (editor.o.mobileTapTimeout) {
36700
36725
  // Emulate double tap
36701
36726
  editor.e.on('touchend', (e)=>{
@@ -36712,8 +36737,8 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
36712
36737
  }
36713
36738
  editor.e.on('getDiffButtons.mobile', (toolbar)=>{
36714
36739
  if (toolbar === editor.toolbar) {
36715
- const buttons = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_2__.flatButtonsSet)((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.splitArray)(editor.o.buttons), editor), flatStore = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_2__.flatButtonsSet)(store, editor);
36716
- return (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.toArray)(buttons).reduce((acc, item)=>{
36740
+ const buttons = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_4__.flatButtonsSet)((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttons), editor), flatStore = (0,jodit_core_ui_helpers_buttons__WEBPACK_IMPORTED_MODULE_4__.flatButtonsSet)(store, editor);
36741
+ return (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.toArray)(buttons).reduce((acc, item)=>{
36717
36742
  if (!flatStore.has(item)) {
36718
36743
  acc.push(item);
36719
36744
  }
@@ -36726,18 +36751,21 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
36726
36751
  if (!editor.o.toolbar) {
36727
36752
  return;
36728
36753
  }
36729
- const width = (editor.container.parentElement ?? editor.container).offsetWidth;
36730
36754
  const newStore = (()=>{
36731
- if (editor.isFullSize || width >= editor.o.sizeLG) {
36732
- return (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.splitArray)(editor.o.buttons);
36755
+ if (editor.isFullSize) {
36756
+ return (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttons);
36757
+ }
36758
+ const width = adaptiveWidth(editor);
36759
+ if (width >= editor.o.sizeLG) {
36760
+ return (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttons);
36733
36761
  }
36734
36762
  if (width >= editor.o.sizeMD) {
36735
- return fitToButtons((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.splitArray)(editor.o.buttonsMD), editor);
36763
+ return fitToButtons((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttonsMD), editor);
36736
36764
  }
36737
36765
  if (width >= editor.o.sizeSM) {
36738
- return fitToButtons((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.splitArray)(editor.o.buttonsSM), editor);
36766
+ return fitToButtons((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttonsSM), editor);
36739
36767
  }
36740
- return fitToButtons((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.splitArray)(editor.o.buttonsXS), editor);
36768
+ return fitToButtons((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.splitArray)(editor.o.buttonsXS), editor);
36741
36769
  })();
36742
36770
  if (newStore.toString() !== store.toString()) {
36743
36771
  store = newStore;
@@ -36747,7 +36775,7 @@ const isButtonSeparator = (item)=>item === '|' || item === '---' || item === '\n
36747
36775
  }).on(editor.ow, 'load resize', ()=>editor.e.fire('recalcAdaptive'));
36748
36776
  }
36749
36777
  }
36750
- jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('mobile', mobile);
36778
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('mobile', mobile);
36751
36779
 
36752
36780
 
36753
36781
  /***/ }),