jodit 4.1.16 → 4.2.5

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 (138) hide show
  1. package/CHANGELOG.md +22 -5
  2. package/es2015/jodit.css +82 -31
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +2 -2
  5. package/es2015/jodit.js +1339 -543
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +2 -2
  8. package/es2015/plugins/debug/debug.js +1 -1
  9. package/es2015/plugins/debug/debug.min.js +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  13. package/es2018/jodit.css +82 -31
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +2 -2
  16. package/es2018/jodit.js +1325 -543
  17. package/es2018/jodit.min.css +1 -1
  18. package/es2018/jodit.min.js +2 -2
  19. package/es2018/plugins/debug/debug.js +1 -1
  20. package/es2018/plugins/debug/debug.min.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  22. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  23. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  24. package/es2021/jodit.css +82 -31
  25. package/es2021/jodit.fat.min.css +1 -1
  26. package/es2021/jodit.fat.min.js +2 -2
  27. package/es2021/jodit.js +1322 -543
  28. package/es2021/jodit.min.css +1 -1
  29. package/es2021/jodit.min.js +2 -2
  30. package/es2021/plugins/debug/debug.js +1 -1
  31. package/es2021/plugins/debug/debug.min.js +1 -1
  32. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  33. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  34. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  35. package/es2021.en/jodit.css +82 -31
  36. package/es2021.en/jodit.fat.min.css +1 -1
  37. package/es2021.en/jodit.fat.min.js +2 -2
  38. package/es2021.en/jodit.js +1322 -543
  39. package/es2021.en/jodit.min.css +1 -1
  40. package/es2021.en/jodit.min.js +2 -2
  41. package/es2021.en/plugins/debug/debug.js +1 -1
  42. package/es2021.en/plugins/debug/debug.min.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  44. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  45. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  46. package/es5/jodit.css +131 -35
  47. package/es5/jodit.fat.min.css +1 -1
  48. package/es5/jodit.fat.min.js +2 -2
  49. package/es5/jodit.js +1363 -479
  50. package/es5/jodit.min.css +3 -3
  51. package/es5/jodit.min.js +2 -2
  52. package/es5/plugins/debug/debug.js +1 -1
  53. package/es5/plugins/debug/debug.min.js +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  57. package/esm/core/constants.js +1 -1
  58. package/esm/core/helpers/size/position.js +2 -2
  59. package/esm/core/helpers/utils/selector.d.ts +3 -1
  60. package/esm/core/helpers/utils/selector.js +3 -3
  61. package/esm/core/ui/button/tooltip/tooltip.js +2 -1
  62. package/esm/core/ui/popup/popup.js +1 -1
  63. package/esm/modules/dialog/dialog.js +1 -0
  64. package/esm/modules/file-browser/file-browser.js +8 -1
  65. package/esm/modules/image-editor/templates/form.js +6 -5
  66. package/esm/modules/toolbar/button/button.d.ts +1 -1
  67. package/esm/modules/widget/tabs/tabs.d.ts +4 -4
  68. package/esm/modules/widget/tabs/tabs.js +9 -7
  69. package/esm/plugins/ai-assistant/ai-assistant.d.ts +1 -1
  70. package/esm/plugins/ai-assistant/ai-assistant.js +3 -3
  71. package/esm/plugins/image-properties/config.d.ts +5 -83
  72. package/esm/plugins/image-properties/config.js +0 -3
  73. package/esm/plugins/image-properties/image-properties.d.ts +22 -32
  74. package/esm/plugins/image-properties/image-properties.js +129 -402
  75. package/{types/plugins/image-properties/templates/form.d.ts → esm/plugins/image-properties/readers/align.d.ts} +3 -5
  76. package/esm/plugins/image-properties/readers/align.js +24 -0
  77. package/esm/plugins/image-properties/readers/index.d.ts +12 -0
  78. package/esm/plugins/image-properties/readers/index.js +38 -0
  79. package/esm/plugins/image-properties/readers/link.d.ts +9 -0
  80. package/esm/plugins/image-properties/readers/link.js +19 -0
  81. package/esm/plugins/image-properties/readers/margin.d.ts +8 -0
  82. package/esm/plugins/image-properties/readers/margin.js +28 -0
  83. package/esm/plugins/image-properties/readers/size.d.ts +8 -0
  84. package/esm/plugins/image-properties/readers/size.js +36 -0
  85. package/esm/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
  86. package/esm/plugins/image-properties/ui/ui-image-form.js +171 -0
  87. package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
  88. package/esm/plugins/image-properties/ui/ui-image-main-tab.js +179 -0
  89. package/esm/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
  90. package/esm/plugins/image-properties/ui/ui-image-position-tab.js +261 -0
  91. package/esm/plugins/image-properties/{templates/main-tab.d.ts → utils/open-image-editor.d.ts} +5 -3
  92. package/esm/plugins/image-properties/utils/open-image-editor.js +52 -0
  93. package/esm/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
  94. package/esm/plugins/image-properties/utils/open-image-popup.js +34 -0
  95. package/esm/plugins/image-properties/utils/utils.d.ts +9 -0
  96. package/esm/plugins/image-properties/utils/utils.js +21 -0
  97. package/esm/plugins/image-properties/writers/index.d.ts +12 -0
  98. package/esm/plugins/image-properties/writers/index.js +53 -0
  99. package/esm/plugins/image-properties/{templates/form.d.ts → writers/link.d.ts} +2 -4
  100. package/esm/plugins/image-properties/writers/link.js +24 -0
  101. package/esm/plugins/image-properties/writers/margin.d.ts +8 -0
  102. package/esm/plugins/image-properties/writers/margin.js +33 -0
  103. package/esm/plugins/image-properties/writers/size.d.ts +7 -0
  104. package/esm/plugins/image-properties/writers/size.js +28 -0
  105. package/esm/plugins/select/config.d.ts +7 -0
  106. package/esm/plugins/select/config.js +2 -1
  107. package/esm/plugins/select/select.d.ts +7 -3
  108. package/esm/plugins/select/select.js +21 -4
  109. package/esm/types/ui.d.ts +1 -1
  110. package/package.json +1 -1
  111. package/types/core/helpers/utils/selector.d.ts +3 -1
  112. package/types/modules/toolbar/button/button.d.ts +1 -1
  113. package/types/modules/widget/tabs/tabs.d.ts +4 -4
  114. package/types/plugins/ai-assistant/ai-assistant.d.ts +1 -1
  115. package/types/plugins/image-properties/config.d.ts +5 -83
  116. package/types/plugins/image-properties/image-properties.d.ts +22 -32
  117. package/types/plugins/image-properties/{templates/main-tab.d.ts → readers/align.d.ts} +3 -5
  118. package/types/plugins/image-properties/readers/index.d.ts +12 -0
  119. package/types/plugins/image-properties/readers/link.d.ts +9 -0
  120. package/types/plugins/image-properties/readers/margin.d.ts +8 -0
  121. package/types/plugins/image-properties/readers/size.d.ts +8 -0
  122. package/types/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
  123. package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
  124. package/types/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
  125. package/types/plugins/image-properties/utils/open-image-editor.d.ts +12 -0
  126. package/types/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
  127. package/types/plugins/image-properties/utils/utils.d.ts +9 -0
  128. package/types/plugins/image-properties/writers/index.d.ts +12 -0
  129. package/{esm/plugins/image-properties/templates/position-tab.d.ts → types/plugins/image-properties/writers/link.d.ts} +2 -4
  130. package/types/plugins/image-properties/writers/margin.d.ts +8 -0
  131. package/types/plugins/image-properties/writers/size.d.ts +7 -0
  132. package/types/plugins/select/config.d.ts +7 -0
  133. package/types/plugins/select/select.d.ts +7 -3
  134. package/types/types/ui.d.ts +1 -1
  135. package/esm/plugins/image-properties/templates/form.js +0 -26
  136. package/esm/plugins/image-properties/templates/main-tab.js +0 -47
  137. package/esm/plugins/image-properties/templates/position-tab.js +0 -66
  138. package/types/plugins/image-properties/templates/position-tab.d.ts +0 -10
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.1.16
4
+ * Version: v4.2.5
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1708,7 +1708,7 @@ __webpack_require__.r(__webpack_exports__);
1708
1708
  * Released under MIT see LICENSE.txt in the project root for license information.
1709
1709
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1710
1710
  */
1711
- const APP_VERSION = "4.1.16";
1711
+ const APP_VERSION = "4.2.5";
1712
1712
  // prettier-ignore
1713
1713
  const ES = "es2021";
1714
1714
  const IS_ES_MODERN = true;
@@ -6717,8 +6717,8 @@ function position(elm, jodit, recurse = false) {
6717
6717
  return {
6718
6718
  left: Math.round(xPos),
6719
6719
  top: Math.round(yPos),
6720
- width: Math.round(elm.offsetWidth),
6721
- height: Math.round(elm.offsetHeight)
6720
+ width: Math.round(elm.offsetWidth ?? rect.width),
6721
+ height: Math.round(elm.offsetHeight ?? rect.height)
6722
6722
  };
6723
6723
  }
6724
6724
 
@@ -8751,9 +8751,9 @@ const getXPathByElement = (element, root) => {
8751
8751
  * Find all `ref` or `data-ref` elements inside HTMLElement
8752
8752
  */
8753
8753
  const refs = (root) => {
8754
- // if (Component.isInstanceOf<UIElement>(root, UIElement)) {
8755
- // root = root.container;
8756
- // }
8754
+ if ('container' in root) {
8755
+ root = root.container;
8756
+ }
8757
8757
  return $$('[ref],[data-ref]', root).reduce((def, child) => {
8758
8758
  const key = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(child, '-ref');
8759
8759
  if (key && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_4__/* .isString */ .K)(key)) {
@@ -13275,7 +13275,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13275
13275
  view.o.showTooltip &&
13276
13276
  !view.o.useNativeTooltip) {
13277
13277
  view.hookStatus(jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .STATUSES */ .f.ready, () => {
13278
- // TODO Move it inside __open method. Now it is here becous testcase failed with capturing
13278
+ // TODO Move it inside __open method. Now it is here because testcase failed with capturing
13279
13279
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .getContainer */ .My)(this.j, UITooltip_1).appendChild(this.container);
13280
13280
  view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
13281
13281
  capture: true
@@ -13291,6 +13291,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13291
13291
  const view = this.j;
13292
13292
  view.e
13293
13293
  .on(view.ow, 'scroll.tooltip', this.__hide)
13294
+ .on(view.ow, 'joditCloseDialog', this.__hide)
13294
13295
  .on(view.container, 'mouseleave.tooltip', this.__hide)
13295
13296
  .on([
13296
13297
  'escape.tooltip',
@@ -15300,7 +15301,7 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_7__/* .UI
15300
15301
  }
15301
15302
  let pe = this.parentElement;
15302
15303
  while (pe) {
15303
- if (checkView(j)) {
15304
+ if (checkView(pe.j)) {
15304
15305
  return;
15305
15306
  }
15306
15307
  if (pe.container.style.zIndex) {
@@ -17793,6 +17794,7 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
17793
17794
  * Fired when dialog box is started moving
17794
17795
  */
17795
17796
  this.e.fire(this, 'startMove');
17797
+ this.e.fire('closeAllPopups');
17796
17798
  }
17797
17799
  }
17798
17800
  onMouseMove(e) {
@@ -19733,7 +19735,14 @@ let FileBrowser = class FileBrowser extends jodit_core_view_view_with_toolbar__W
19733
19735
  this.__updateToolbarButtons();
19734
19736
  this._dialog.open(this.browser, header);
19735
19737
  this.e.fire('sort.filebrowser', this.state.sortBy);
19736
- (0,_fetch_load_tree__WEBPACK_IMPORTED_MODULE_10__/* .loadTree */ .r)(this).then(resolve, reject);
19738
+ (0,_fetch_load_tree__WEBPACK_IMPORTED_MODULE_10__/* .loadTree */ .r)(this)
19739
+ .then(resolve, reject)
19740
+ .finally(() => {
19741
+ if (this.isInDestruct) {
19742
+ return;
19743
+ }
19744
+ this?.e?.fire('fileBrowserReady.filebrowser');
19745
+ });
19737
19746
  })
19738
19747
  .catch((e) => {
19739
19748
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
@@ -21602,11 +21611,12 @@ const act = (el, className = 'jodti-image-editor_active') => el ? className : ''
21602
21611
  const form = (editor, o) => {
21603
21612
  const i = editor.i18n.bind(editor);
21604
21613
  const switcher = (label, ref, active = true) => `<div class="jodit-form__group">
21605
- <label>${i(label)}</label>
21606
-
21607
- <label class='jodit-switcher'>
21608
- <input ${act(active, 'checked')} data-ref="${ref}" type="checkbox"/>
21609
- <span class="jodit-switcher__slider"></span>
21614
+ <label class="jodit-switcher-wrapper">
21615
+ <span class='jodit-switcher'>
21616
+ <input ${act(active, 'checked')} data-ref="${ref}" type="checkbox"/>
21617
+ <span class="jodit-switcher__slider"></span>
21618
+ </span>
21619
+ <span>${i(label)}</span>
21610
21620
  </label>
21611
21621
  </div>`;
21612
21622
  return editor.create.fromHTML(`<form class="${jie} jodit-properties">
@@ -24670,11 +24680,13 @@ const TabsWidget = (jodit, tabs, state) => {
24670
24680
  return;
24671
24681
  }
24672
24682
  buttonList.forEach(b => {
24683
+ b.state.variant = 'initial';
24673
24684
  b.state.activated = false;
24674
24685
  });
24675
24686
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('.jodit-tab', tabBox).forEach(a => {
24676
24687
  a.classList.remove('jodit-tab_active');
24677
24688
  });
24689
+ nameToTab[tab].button.state.variant = 'outline';
24678
24690
  nameToTab[tab].button.state.activated = true;
24679
24691
  nameToTab[tab].tab.classList.add('jodit-tab_active');
24680
24692
  };
@@ -24703,7 +24715,7 @@ const TabsWidget = (jodit, tabs, state) => {
24703
24715
  content.call(jodit);
24704
24716
  }
24705
24717
  if (state) {
24706
- state.__activeTab = name;
24718
+ state.activeTab = name;
24707
24719
  }
24708
24720
  return false;
24709
24721
  });
@@ -24719,20 +24731,20 @@ const TabsWidget = (jodit, tabs, state) => {
24719
24731
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('a', buttons).forEach(a => {
24720
24732
  a.style.width = (100 / tabCount).toFixed(10) + '%';
24721
24733
  });
24722
- const tab = !state || !state.__activeTab || !nameToTab[state.__activeTab]
24734
+ const tab = !state || !state.activeTab || !nameToTab[state.activeTab]
24723
24735
  ? firstTab
24724
- : state.__activeTab;
24736
+ : state.activeTab;
24725
24737
  setActive(tab);
24726
24738
  if (state) {
24727
- let __activeTab = state.__activeTab;
24728
- Object.defineProperty(state, '__activeTab', {
24739
+ let activeTab = state.activeTab;
24740
+ Object.defineProperty(state, 'activeTab', {
24729
24741
  configurable: true,
24730
24742
  enumerable: false,
24731
24743
  get() {
24732
- return __activeTab;
24744
+ return activeTab;
24733
24745
  },
24734
24746
  set(value) {
24735
- __activeTab = value;
24747
+ activeTab = value;
24736
24748
  setActive(value);
24737
24749
  }
24738
24750
  });
@@ -25147,7 +25159,7 @@ class aiAssistant extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_3__/
25147
25159
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .extendLang */ .JW)(_langs__WEBPACK_IMPORTED_MODULE_6__);
25148
25160
  }
25149
25161
  /** @override */
25150
- afterInit(jodit) { }
25162
+ afterInit() { }
25151
25163
  onGenerateAiAssistantForm(prompt) {
25152
25164
  this.__dialog.open(this.__container, 'AI Assistant');
25153
25165
  this.__container.setPrompt(prompt);
@@ -31009,9 +31021,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .pluginSystem */ .fg.add('image
31009
31021
  * Released under MIT see LICENSE.txt in the project root for license information.
31010
31022
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31011
31023
  */
31012
- /**
31013
- * @module plugins/image-properties
31014
- */
31015
31024
 
31016
31025
  jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
31017
31026
  dialogWidth: 600,
@@ -31041,18 +31050,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
31041
31050
 
31042
31051
  "use strict";
31043
31052
  /* unused harmony export imageProperties */
31044
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(31635);
31053
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(31635);
31045
31054
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22664);
31046
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56298);
31047
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31048
- /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35265);
31049
- /* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(37435);
31050
- /* harmony import */ var jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(53804);
31051
- /* harmony import */ var jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16116);
31052
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(24654);
31053
- /* harmony import */ var _templates_form__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(22254);
31054
- /* harmony import */ var _templates_main_tab__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75263);
31055
- /* harmony import */ var _templates_position_tab__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(57837);
31055
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
31056
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
31057
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65147);
31058
+ /* harmony import */ var jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29866);
31059
+ /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(35265);
31060
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(24654);
31061
+ /* harmony import */ var _ui_ui_image_form__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31970);
31062
+ /* harmony import */ var _utils_open_image_editor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80778);
31063
+ /* harmony import */ var _utils_open_image_popup__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(33733);
31064
+ /* harmony import */ var _readers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(5549);
31065
+ /* harmony import */ var _writers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(30393);
31056
31066
  /*!
31057
31067
  * Jodit Editor (https://xdsoft.net/jodit/)
31058
31068
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -31084,55 +31094,93 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
31084
31094
  * });
31085
31095
  * ```
31086
31096
  */
31087
- const normalSizeToString = (value) => {
31088
- value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(value);
31089
- return /^[0-9]+$/.test(value) ? value + 'px' : value;
31090
- };
31091
- const normalSizeFromString = (value) => {
31092
- return /^[-+]?[0-9.]+px$/.test(value.toString())
31093
- ? parseFloat(value.toString())
31094
- : value;
31095
- };
31096
31097
  /**
31097
31098
  * Show dialog with image's options
31098
31099
  */
31099
- class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin {
31100
+ class imageProperties extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k {
31100
31101
  constructor() {
31101
31102
  super(...arguments);
31102
31103
  this.state = {
31103
31104
  image: new Image(),
31105
+ sourceImage: new Image(),
31104
31106
  get ratio() {
31105
- return this.image.naturalWidth / this.image.naturalHeight || 1;
31107
+ const { naturalWidth, naturalHeight } = this.image;
31108
+ return naturalWidth / naturalHeight || 1;
31106
31109
  },
31107
31110
  sizeIsLocked: true,
31108
- marginIsLocked: true
31111
+ marginIsLocked: true,
31112
+ values: {
31113
+ style: '',
31114
+ imageSrc: '',
31115
+ borderRadius: 0,
31116
+ imageTitle: '',
31117
+ imageAlt: '',
31118
+ imageLink: '',
31119
+ imageLinkOpenInNewTab: false,
31120
+ imageWidth: 0,
31121
+ imageHeight: 0,
31122
+ marginTop: 0,
31123
+ marginRight: 0,
31124
+ marginBottom: 0,
31125
+ marginLeft: 0,
31126
+ classes: '',
31127
+ id: '',
31128
+ align: ''
31129
+ }
31109
31130
  };
31110
31131
  this.activeTabState = {
31111
- __activeTab: 'Image'
31132
+ activeTab: 'Image'
31112
31133
  };
31113
31134
  }
31114
- onChangeMarginIsLocked() {
31115
- if (!this.form) {
31116
- return;
31117
- }
31118
- const { marginRight, marginBottom, marginLeft, lockMargin } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31119
- [marginRight, marginBottom, marginLeft].forEach(elm => {
31120
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'disabled', this.state.marginIsLocked || null);
31135
+ get form() {
31136
+ return new _ui_ui_image_form__WEBPACK_IMPORTED_MODULE_7__/* .UIImagePropertiesForm */ .l(this.j, this.state, this.activeTabState, {
31137
+ openImageEditor: () => (0,_utils_open_image_editor__WEBPACK_IMPORTED_MODULE_8__/* .openImageEditorDialog */ .v)(this.j, this.state),
31138
+ openImagePopup: target => (0,_utils_open_image_popup__WEBPACK_IMPORTED_MODULE_9__/* .openImagePopup */ .q)(this.j, this.dialog, this.state, target)
31121
31139
  });
31122
- lockMargin.innerHTML = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Icon.get(this.state.marginIsLocked ? 'lock' : 'unlock');
31123
31140
  }
31124
- onChangeSizeIsLocked() {
31125
- if (!this.form) {
31126
- return;
31127
- }
31128
- const { lockSize, imageWidth } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31129
- lockSize.innerHTML = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Icon.get(this.state.sizeIsLocked ? 'lock' : 'unlock');
31130
- lockSize.classList.remove('jodit-properties__lock');
31131
- lockSize.classList.remove('jodit-properties__unlock');
31132
- lockSize.classList.add(this.state.sizeIsLocked
31133
- ? 'jodit-properties__lock'
31134
- : 'jodit-properties__unlock');
31135
- this.j.e.fire(imageWidth, 'change');
31141
+ /**
31142
+ * Dialog for form
31143
+ */
31144
+ get dialog() {
31145
+ const { j } = this;
31146
+ const dialog = j.dlg({
31147
+ minWidth: Math.min(400, screen.width),
31148
+ minHeight: 590,
31149
+ buttons: ['fullsize', 'dialog.close']
31150
+ });
31151
+ const buttons = this.__buttons;
31152
+ buttons.check.onAction(() => {
31153
+ (0,_writers__WEBPACK_IMPORTED_MODULE_11__/* .applyValuesToImage */ .j)(j, this.state, this.state.sourceImage);
31154
+ j.synchronizeValues();
31155
+ dialog.close();
31156
+ });
31157
+ buttons.remove.onAction(() => {
31158
+ j.s.removeNode(this.state.sourceImage);
31159
+ dialog.close();
31160
+ });
31161
+ buttons.cancel.onAction(() => {
31162
+ dialog.close();
31163
+ });
31164
+ dialog.setHeader(j.i18n('Image properties'));
31165
+ dialog.setContent(this.form);
31166
+ dialog.setFooter([[buttons.cancel, buttons.remove], buttons.check]);
31167
+ j.e.on(dialog, 'afterClose', () => {
31168
+ if (this.state.image.parentNode &&
31169
+ j.o.image.selectImageAfterClose) {
31170
+ j.s.select(this.state.sourceImage);
31171
+ }
31172
+ });
31173
+ dialog.setSize(j.o.image.dialogWidth);
31174
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.markOwner)(j, dialog.container);
31175
+ return dialog;
31176
+ }
31177
+ get __buttons() {
31178
+ const { j } = this;
31179
+ return {
31180
+ check: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'ok', 'Apply', 'primary'),
31181
+ remove: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'bin', 'Delete'),
31182
+ cancel: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'cancel', 'Cancel')
31183
+ };
31136
31184
  }
31137
31185
  /**
31138
31186
  * Open dialog editing image properties
@@ -31149,358 +31197,24 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31149
31197
  * ```
31150
31198
  */
31151
31199
  open() {
31152
- this.makeForm();
31153
- this.activeTabState.__activeTab = 'Image';
31154
- this.j.e.fire('hidePopup');
31155
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.markOwner)(this.j, this.dialog.container);
31156
- this.state.marginIsLocked = true;
31157
- this.state.sizeIsLocked = true;
31158
- this.onChangeMarginIsLocked();
31159
- this.onChangeSizeIsLocked();
31160
- this.updateValues();
31200
+ this.activeTabState.activeTab = 'Image';
31201
+ this.__lock();
31161
31202
  this.dialog.open().setModal(true).setPosition();
31203
+ this.async
31204
+ .promise((resolve, reject) => (0,_readers__WEBPACK_IMPORTED_MODULE_10__/* .readValuesFromImage */ .U)(this.j, this.state).then(resolve, reject))
31205
+ .catch((e) => this.dialog.message.error(e.message))
31206
+ .finally(() => this.__unlock());
31162
31207
  return false;
31163
31208
  }
31164
- /**
31165
- * Create form for edit image properties
31166
- */
31167
- makeForm() {
31168
- if (this.dialog) {
31169
- return;
31170
- }
31171
- this.dialog = this.j.dlg({
31172
- minWidth: Math.min(400, screen.width),
31173
- minHeight: 590,
31174
- buttons: ['fullsize', 'dialog.close']
31175
- });
31176
- const editor = this.j, opt = editor.o, i18n = editor.i18n.bind(editor), buttons = {
31177
- check: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(editor, 'ok', 'Apply', 'primary'),
31178
- remove: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(editor, 'bin', 'Delete')
31179
- };
31180
- editor.e.on(this.dialog, 'afterClose', () => {
31181
- if (this.state.image.parentNode &&
31182
- opt.image.selectImageAfterClose) {
31183
- editor.s.select(this.state.image);
31184
- }
31185
- });
31186
- buttons.remove.onAction(() => {
31187
- editor.s.removeNode(this.state.image);
31188
- this.dialog.close();
31189
- });
31190
- const { dialog } = this;
31191
- dialog.setHeader(i18n('Image properties'));
31192
- const mainForm = (0,_templates_form__WEBPACK_IMPORTED_MODULE_8__/* .form */ .Z)(editor);
31193
- this.form = mainForm;
31194
- dialog.setContent(mainForm);
31195
- const { tabsBox } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31196
- if (tabsBox) {
31197
- tabsBox.appendChild((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__/* .TabsWidget */ .Zg)(editor, [
31198
- { name: 'Image', content: (0,_templates_main_tab__WEBPACK_IMPORTED_MODULE_9__/* .mainTab */ .J)(editor) },
31199
- { name: 'Advanced', content: (0,_templates_position_tab__WEBPACK_IMPORTED_MODULE_10__/* .positionTab */ .b)(editor) }
31200
- ], this.activeTabState));
31201
- }
31202
- buttons.check.onAction(this.onApply);
31203
- const { changeImage, editImage } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31204
- editor.e.on(changeImage, 'click', this.openImagePopup);
31205
- if (opt.image.useImageEditor) {
31206
- editor.e.on(editImage, 'click', this.openImageEditor);
31207
- }
31208
- const { lockSize, lockMargin, imageWidth, imageHeight } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(mainForm);
31209
- if (lockSize) {
31210
- editor.e.on(lockSize, 'click', () => {
31211
- this.state.sizeIsLocked = !this.state.sizeIsLocked;
31212
- });
31213
- }
31214
- editor.e.on(lockMargin, 'click', (e) => {
31215
- this.state.marginIsLocked = !this.state.marginIsLocked;
31216
- e.preventDefault();
31217
- });
31218
- const changeSizes = (event) => {
31219
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageWidth.value) || !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageHeight.value)) {
31220
- return;
31221
- }
31222
- const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
31223
- if (event.target === imageWidth) {
31224
- imageHeight.value = Math.round(w / this.state.ratio).toString();
31225
- }
31226
- else {
31227
- imageWidth.value = Math.round(h * this.state.ratio).toString();
31228
- }
31229
- };
31230
- editor.e.on([imageWidth, imageHeight], 'change keydown mousedown paste', (event) => {
31231
- if (!this.state.sizeIsLocked) {
31232
- return;
31233
- }
31234
- editor.async.setTimeout(changeSizes.bind(this, event), {
31235
- timeout: editor.defaultTimeout,
31236
- label: 'image-properties-changeSize'
31237
- });
31238
- });
31239
- dialog.setFooter([buttons.remove, buttons.check]);
31240
- dialog.setSize(this.j.o.image.dialogWidth);
31241
- }
31242
- /**
31243
- * Set input values from image
31244
- */
31245
- updateValues() {
31246
- const opt = this.j.o;
31247
- const { image } = this.state;
31248
- const { marginTop, marginRight, marginBottom, marginLeft, lockMargin, imageSrc, id, classes, align, style, imageTitle, imageAlt, borderRadius, imageLink, imageWidth, imageHeight, imageLinkOpenInNewTab, imageViewSrc, lockSize } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31249
- const updateLock = () => {
31250
- lockMargin.checked = this.state.marginIsLocked;
31251
- lockSize.checked = this.state.sizeIsLocked;
31252
- }, updateAlign = () => {
31253
- if (image.style.cssFloat &&
31254
- ['left', 'right'].indexOf(image.style.cssFloat.toLowerCase()) !== -1) {
31255
- align.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float');
31256
- }
31257
- else {
31258
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'display') === 'block' &&
31259
- image.style.marginLeft === 'auto' &&
31260
- image.style.marginRight === 'auto') {
31261
- align.value = 'center';
31262
- }
31263
- }
31264
- }, updateBorderRadius = () => {
31265
- borderRadius.value = (parseInt(image.style.borderRadius || '0', 10) || '0').toString();
31266
- }, updateId = () => {
31267
- id.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'id') || '';
31268
- }, updateStyle = () => {
31269
- style.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'style') || '';
31270
- }, updateClasses = () => {
31271
- classes.value = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
31272
- }, updateMargins = () => {
31273
- if (!opt.image.editMargins) {
31274
- return;
31275
- }
31276
- let equal = true, wasEmptyField = false;
31277
- [marginTop, marginRight, marginBottom, marginLeft].forEach(elm => {
31278
- const id = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'data-ref') || '';
31279
- let value = image.style.getPropertyValue((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.kebabCase)(id));
31280
- if (!value) {
31281
- wasEmptyField = true;
31282
- elm.value = '';
31283
- return;
31284
- }
31285
- if (/^[0-9]+(px)?$/.test(value)) {
31286
- value = parseInt(value, 10);
31287
- }
31288
- elm.value = value.toString() || '';
31289
- if ((wasEmptyField && elm.value) ||
31290
- (equal &&
31291
- id !== 'marginTop' &&
31292
- elm.value !== marginTop.value)) {
31293
- equal = false;
31294
- }
31295
- });
31296
- this.state.marginIsLocked = equal;
31297
- }, updateSizes = () => {
31298
- const width = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width') ||
31299
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'width', true) ||
31300
- false, height = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height') ||
31301
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'height', true) ||
31302
- false;
31303
- imageWidth.value =
31304
- width !== false
31305
- ? normalSizeFromString(width).toString()
31306
- : image.offsetWidth.toString();
31307
- imageHeight.value =
31308
- height !== false
31309
- ? normalSizeFromString(height).toString()
31310
- : image.offsetHeight.toString();
31311
- this.state.sizeIsLocked = (() => {
31312
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageWidth.value) ||
31313
- !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageHeight.value)) {
31314
- return false;
31315
- }
31316
- const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
31317
- return Math.abs(w - h * this.state.ratio) < 1;
31318
- })();
31319
- }, updateText = () => {
31320
- imageTitle.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'title') || '';
31321
- imageAlt.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt') || '';
31322
- const a = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(image, 'a', this.j.editor);
31323
- if (a) {
31324
- imageLink.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(a, 'href') || '';
31325
- imageLinkOpenInNewTab.checked =
31326
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(a, 'target') === '_blank';
31327
- }
31328
- else {
31329
- imageLink.value = '';
31330
- imageLinkOpenInNewTab.checked = false;
31331
- }
31332
- }, updateSrc = () => {
31333
- imageSrc.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src') || '';
31334
- if (imageViewSrc) {
31335
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(imageViewSrc, 'src', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src') || '');
31336
- }
31337
- };
31338
- updateLock();
31339
- updateSrc();
31340
- updateText();
31341
- updateSizes();
31342
- updateMargins();
31343
- updateClasses();
31344
- updateId();
31345
- updateBorderRadius();
31346
- updateAlign();
31347
- updateStyle();
31348
- }
31349
- /**
31350
- * Apply form's values to image
31351
- */
31352
- onApply() {
31353
- const { style, imageSrc, borderRadius, imageTitle, imageAlt, imageLink, imageWidth, imageHeight, marginTop, marginRight, marginBottom, marginLeft, imageLinkOpenInNewTab, align, classes, id } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31354
- const opt = this.j.o;
31355
- const { image } = this.state;
31356
- // styles
31357
- if (opt.image.editStyle) {
31358
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'style', style.value || null);
31359
- }
31360
- // Src
31361
- if (imageSrc.value) {
31362
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src', imageSrc.value);
31363
- }
31364
- else {
31365
- jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(image);
31366
- this.dialog.close();
31367
- return;
31368
- }
31369
- // Border radius
31370
- if (borderRadius.value !== '0' && /^[0-9]+$/.test(borderRadius.value)) {
31371
- image.style.borderRadius = borderRadius.value + 'px';
31372
- }
31373
- else {
31374
- image.style.borderRadius = '';
31375
- }
31376
- // Title
31377
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'title', imageTitle.value || null);
31378
- // Alt
31379
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt', imageAlt.value || null);
31380
- // Link
31381
- let link = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(image, 'a', this.j.editor);
31382
- if (imageLink.value) {
31383
- if (!link) {
31384
- link = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(image, 'a', this.j.createInside);
31385
- }
31386
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'href', imageLink.value);
31387
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'target', imageLinkOpenInNewTab.checked ? '_blank' : null);
31388
- }
31389
- else {
31390
- if (link && link.parentNode) {
31391
- link.parentNode.replaceChild(image, link);
31392
- }
31393
- }
31394
- // Size
31395
- if (imageWidth.value !== image.offsetWidth.toString() ||
31396
- imageHeight.value !== image.offsetHeight.toString()) {
31397
- const updatedtWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(imageWidth.value)
31398
- ? normalSizeToString(imageWidth.value)
31399
- : null;
31400
- const updatedHeight = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(imageHeight.value)
31401
- ? normalSizeToString(imageHeight.value)
31402
- : null;
31403
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, {
31404
- width: updatedtWidth,
31405
- height: updatedHeight
31406
- });
31407
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width') ? updatedtWidth : null);
31408
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height') ? updatedHeight : null);
31409
- }
31410
- const margins = [marginTop, marginRight, marginBottom, marginLeft];
31411
- if (opt.image.editMargins) {
31412
- if (!this.state.marginIsLocked) {
31413
- margins.forEach((margin) => {
31414
- const side = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(margin, 'data-ref') || '';
31415
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, side, normalSizeToString(margin.value));
31416
- });
31417
- }
31418
- else {
31419
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'margin', normalSizeToString(marginTop.value));
31420
- }
31421
- }
31422
- if (opt.image.editClass) {
31423
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'class', classes.value || null);
31424
- }
31425
- if (opt.image.editId) {
31426
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'id', id.value || null);
31427
- }
31428
- if (opt.image.editAlign) {
31429
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(image, align.value);
31430
- }
31431
- this.j.synchronizeValues();
31432
- this.dialog.close();
31433
- }
31434
- /**
31435
- * Open image editor dialog
31436
- */
31437
- openImageEditor() {
31438
- const url = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src') || '', a = this.j.c.element('a'), loadExternal = () => {
31439
- if (a.host !== location.host) {
31440
- this.j.confirm('You can only edit your own images. Download this image on the host?', yes => {
31441
- if (yes && this.j.uploader) {
31442
- this.j.uploader.uploadRemoteImage(a.href.toString(), resp => {
31443
- this.j.alert('The image has been successfully uploaded to the host!', () => {
31444
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isString)(resp.newfilename)) {
31445
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', resp.baseurl +
31446
- resp.newfilename);
31447
- this.updateValues();
31448
- }
31449
- });
31450
- }, error => {
31451
- this.j.alert('There was an error loading %s', error.message);
31452
- });
31453
- }
31454
- });
31455
- return;
31456
- }
31457
- };
31458
- a.href = url;
31459
- this.j.filebrowser.dataProvider
31460
- .getPathByUrl(a.href.toString())
31461
- .then(resp => {
31462
- jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_5__/* .openImageEditor */ .B.call(this.j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
31463
- const timestamp = new Date().getTime();
31464
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', url +
31465
- (url.indexOf('?') !== -1 ? '' : '?') +
31466
- '&_tmp=' +
31467
- timestamp.toString());
31468
- this.updateValues();
31469
- }, error => {
31470
- this.j.alert(error.message);
31471
- });
31472
- })
31473
- .catch(error => {
31474
- this.j.alert(error.message, loadExternal);
31475
- });
31209
+ __lock() {
31210
+ this.dialog.lock();
31211
+ this.form.setMod('lock', true);
31212
+ Object.values(this.__buttons).forEach(b => (b.state.disabled = true));
31476
31213
  }
31477
- /**
31478
- * Open popup with filebrowser/uploader buttons for image
31479
- */
31480
- openImagePopup(event) {
31481
- const popup = new jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Popup(this.j), { changeImage } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31482
- popup.setZIndex(this.dialog.getZIndex() + 1);
31483
- popup
31484
- .setContent((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__/* .FileSelectorWidget */ .kG)(this.j, {
31485
- upload: (data) => {
31486
- if (data.files && data.files.length) {
31487
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', data.baseurl + data.files[0]);
31488
- }
31489
- this.updateValues();
31490
- popup.close();
31491
- },
31492
- filebrowser: (data) => {
31493
- if (data &&
31494
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isArray)(data.files) &&
31495
- data.files.length) {
31496
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', data.files[0]);
31497
- popup.close();
31498
- this.updateValues();
31499
- }
31500
- }
31501
- }, this.state.image, popup.close))
31502
- .open(() => (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.position)(changeImage));
31503
- event.stopPropagation();
31214
+ __unlock() {
31215
+ this.dialog.unlock();
31216
+ this.form.setMod('lock', false);
31217
+ Object.values(this.__buttons).forEach(b => (b.state.disabled = false));
31504
31218
  }
31505
31219
  /** @override **/
31506
31220
  afterInit(editor) {
@@ -31511,7 +31225,7 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31511
31225
  .off(editor.editor, '.imageproperties')
31512
31226
  .on(editor.editor, 'dblclick.imageproperties', (e) => {
31513
31227
  const image = e.target;
31514
- if (!jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(image, 'img')) {
31228
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(image, 'img')) {
31515
31229
  return;
31516
31230
  }
31517
31231
  if (editor.o.image.openOnDblClick) {
@@ -31519,7 +31233,8 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31519
31233
  false) {
31520
31234
  return;
31521
31235
  }
31522
- self.state.image = image;
31236
+ self.state.sourceImage = image;
31237
+ self.state.image = image.cloneNode(true);
31523
31238
  if (!editor.o.readonly) {
31524
31239
  e.stopImmediatePropagation();
31525
31240
  e.preventDefault();
@@ -31533,206 +31248,1252 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31533
31248
  });
31534
31249
  })
31535
31250
  .on('openImageProperties.imageproperties', (image) => {
31536
- this.state.image = image;
31251
+ self.state.sourceImage = image;
31252
+ this.state.image = image.cloneNode(true);
31537
31253
  this.open();
31538
31254
  });
31539
31255
  }
31256
+ async onStateValuesImageSrcChange() {
31257
+ const { image, values } = this.state;
31258
+ if (!image.src) {
31259
+ return;
31260
+ }
31261
+ try {
31262
+ this.__lock();
31263
+ await image.decode();
31264
+ if (this.state.sizeIsLocked && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isNumeric)(values.imageWidth)) {
31265
+ const w = parseFloat(values.imageWidth.toString());
31266
+ values.imageHeight = Math.round(w / this.state.ratio);
31267
+ }
31268
+ this.j.e.fire('updateImageProperties.imageproperties', image);
31269
+ }
31270
+ catch (e) {
31271
+ this.j.alert(e.message);
31272
+ }
31273
+ finally {
31274
+ this.__unlock();
31275
+ }
31276
+ }
31540
31277
  /** @override */
31541
31278
  beforeDestruct(editor) {
31542
- this.dialog && this.dialog.destruct();
31279
+ Object.values((0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, '__buttons') ?? {}).forEach(b => b.destruct());
31280
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, 'dialog')?.destruct();
31281
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, 'form')?.destruct();
31543
31282
  editor.e.off(editor.editor, '.imageproperties').off('.imageproperties');
31544
31283
  }
31545
31284
  }
31546
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31547
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.marginIsLocked')
31548
- ], imageProperties.prototype, "onChangeMarginIsLocked", null);
31549
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31550
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.sizeIsLocked')
31551
- ], imageProperties.prototype, "onChangeSizeIsLocked", null);
31552
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31553
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31554
- ], imageProperties.prototype, "onApply", null);
31555
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31556
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31557
- ], imageProperties.prototype, "openImageEditor", null);
31558
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31559
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31560
- ], imageProperties.prototype, "openImagePopup", null);
31561
- jodit_core_global__WEBPACK_IMPORTED_MODULE_1__/* .pluginSystem */ .fg.add('imageProperties', imageProperties);
31285
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31286
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
31287
+ ], imageProperties.prototype, "form", null);
31288
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31289
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
31290
+ ], imageProperties.prototype, "dialog", null);
31291
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31292
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
31293
+ ], imageProperties.prototype, "__buttons", null);
31294
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31295
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.image')
31296
+ ], imageProperties.prototype, "onStateValuesImageSrcChange", null);
31297
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .pluginSystem */ .fg.add('imageProperties', imageProperties);
31562
31298
 
31563
31299
 
31564
31300
  /***/ }),
31565
31301
 
31566
- /***/ 22254:
31302
+ /***/ 74260:
31567
31303
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31568
31304
 
31569
31305
  "use strict";
31570
31306
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31571
- /* harmony export */ Z: function() { return /* binding */ form; }
31307
+ /* harmony export */ g: function() { return /* binding */ readAlign; }
31572
31308
  /* harmony export */ });
31573
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31309
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38322);
31310
+ /*!
31311
+ * Jodit Editor (https://xdsoft.net/jodit/)
31312
+ * Released under MIT see LICENSE.txt in the project root for license information.
31313
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31314
+ */
31315
+
31316
+ /** @private */
31317
+ function readAlign(image, values) {
31318
+ // Align
31319
+ if (image.style.cssFloat &&
31320
+ ['left', 'right'].indexOf(image.style.cssFloat.toLowerCase()) !== -1) {
31321
+ values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__/* .css */ .A)(image, 'float');
31322
+ }
31323
+ else {
31324
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__/* .css */ .A)(image, 'display') === 'block' &&
31325
+ image.style.marginLeft === 'auto' &&
31326
+ image.style.marginRight === 'auto') {
31327
+ values.align = 'center';
31328
+ }
31329
+ else {
31330
+ values.align = '';
31331
+ }
31332
+ }
31333
+ }
31334
+
31335
+
31336
+ /***/ }),
31337
+
31338
+ /***/ 5549:
31339
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31340
+
31341
+ "use strict";
31342
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31343
+ /* harmony export */ U: function() { return /* binding */ readValuesFromImage; }
31344
+ /* harmony export */ });
31345
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
31346
+ /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74260);
31347
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
31348
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(85079);
31349
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17880);
31350
+ /*!
31351
+ * Jodit Editor (https://xdsoft.net/jodit/)
31352
+ * Released under MIT see LICENSE.txt in the project root for license information.
31353
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31354
+ */
31355
+
31356
+
31357
+
31358
+
31359
+
31360
+ /**
31361
+ * Read values from image and set it to state
31362
+ * @private
31363
+ */
31364
+ async function readValuesFromImage(j, state) {
31365
+ const { sourceImage: image, values } = state;
31366
+ (0,_align__WEBPACK_IMPORTED_MODULE_3__/* .readAlign */ .g)(image, values);
31367
+ // Border radius
31368
+ values.borderRadius = parseInt(image.style.borderRadius || '0', 10) || 0;
31369
+ // Id
31370
+ values.id = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'id') || '';
31371
+ // Title
31372
+ values.imageTitle = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'title') || '';
31373
+ // Alt
31374
+ values.imageAlt = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'alt') || '';
31375
+ // Style
31376
+ values.style = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'style') || '';
31377
+ // Classes
31378
+ values.classes = ((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
31379
+ // Margins
31380
+ (0,_margin__WEBPACK_IMPORTED_MODULE_4__/* .readMargins */ .E)(image, values, state);
31381
+ // Link
31382
+ (0,_link__WEBPACK_IMPORTED_MODULE_1__/* .readLink */ .X)(state, j, values);
31383
+ // Src
31384
+ values.imageSrc = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'src') || '';
31385
+ // Image size
31386
+ return (0,_size__WEBPACK_IMPORTED_MODULE_2__/* .readSizes */ .P)(image, values, state);
31387
+ }
31388
+
31389
+
31390
+ /***/ }),
31391
+
31392
+ /***/ 33201:
31393
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31394
+
31395
+ "use strict";
31396
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31397
+ /* harmony export */ X: function() { return /* binding */ readLink; }
31398
+ /* harmony export */ });
31399
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
31400
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26150);
31401
+ /*!
31402
+ * Jodit Editor (https://xdsoft.net/jodit/)
31403
+ * Released under MIT see LICENSE.txt in the project root for license information.
31404
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31405
+ */
31406
+
31407
+
31408
+ /** @private */
31409
+ function readLink(state, j, values) {
31410
+ const a = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.closest(state.sourceImage, 'a', j.editor);
31411
+ if (a) {
31412
+ values.imageLink = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(a, 'href') || '';
31413
+ values.imageLinkOpenInNewTab = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(a, 'target') === '_blank';
31414
+ }
31415
+ else {
31416
+ values.imageLink = '';
31417
+ values.imageLinkOpenInNewTab = false;
31418
+ }
31419
+ }
31420
+
31421
+
31422
+ /***/ }),
31423
+
31424
+ /***/ 85079:
31425
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31426
+
31427
+ "use strict";
31428
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31429
+ /* harmony export */ E: function() { return /* binding */ readMargins; }
31430
+ /* harmony export */ });
31431
+ /* harmony import */ var jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(449);
31432
+ /*!
31433
+ * Jodit Editor (https://xdsoft.net/jodit/)
31434
+ * Released under MIT see LICENSE.txt in the project root for license information.
31435
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31436
+ */
31437
+
31438
+ /** @private */
31439
+ function readMargins(image, values, state) {
31440
+ // Margins
31441
+ let equal = true, wasEmptyField = false;
31442
+ ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(id => {
31443
+ let value = image.style.getPropertyValue((0,jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_0__/* .kebabCase */ .k)(id));
31444
+ if (!value) {
31445
+ wasEmptyField = true;
31446
+ values[id] = 0;
31447
+ return;
31448
+ }
31449
+ if (/^[0-9]+(px)?$/.test(value)) {
31450
+ value = parseInt(value, 10);
31451
+ }
31452
+ values[id] = value;
31453
+ if ((wasEmptyField && values[id]) ||
31454
+ (equal && id !== 'marginTop' && values[id] !== values.marginTop)) {
31455
+ equal = false;
31456
+ }
31457
+ });
31458
+ state.marginIsLocked = equal;
31459
+ }
31460
+
31461
+
31462
+ /***/ }),
31463
+
31464
+ /***/ 17880:
31465
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31466
+
31467
+ "use strict";
31468
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31469
+ /* harmony export */ P: function() { return /* binding */ readSizes; }
31470
+ /* harmony export */ });
31471
+ /* harmony import */ var jodit_core_helpers_checker_is_numeric__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12461);
31472
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
31473
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38322);
31474
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9645);
31475
+ /*!
31476
+ * Jodit Editor (https://xdsoft.net/jodit/)
31477
+ * Released under MIT see LICENSE.txt in the project root for license information.
31478
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31479
+ */
31480
+
31481
+
31482
+
31483
+
31484
+ /** @private */
31485
+ async function readSizes(image, values, state) {
31486
+ await image.decode();
31487
+ const width = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'width') || (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__/* .css */ .A)(image, 'width', true) || false;
31488
+ const height = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'height') || (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__/* .css */ .A)(image, 'height', true) || false;
31489
+ values.imageWidth =
31490
+ width !== false
31491
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeFromString */ .G)(width)
31492
+ : image.offsetWidth || image.naturalWidth;
31493
+ values.imageHeight =
31494
+ height !== false
31495
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeFromString */ .G)(height)
31496
+ : image.offsetHeight || image.naturalHeight;
31497
+ const { imageWidth, imageHeight } = values;
31498
+ const w = parseFloat(imageWidth.toString());
31499
+ if (!(0,jodit_core_helpers_checker_is_numeric__WEBPACK_IMPORTED_MODULE_3__/* .isNumeric */ .k)(imageWidth) || !(0,jodit_core_helpers_checker_is_numeric__WEBPACK_IMPORTED_MODULE_3__/* .isNumeric */ .k)(imageHeight)) {
31500
+ state.sizeIsLocked = false;
31501
+ return;
31502
+ }
31503
+ if (height === false) {
31504
+ values.imageHeight = Math.round(w / state.ratio);
31505
+ state.sizeIsLocked = true;
31506
+ return;
31507
+ }
31508
+ const h = parseFloat(imageHeight.toString());
31509
+ state.sizeIsLocked = Math.abs(w - h * state.ratio) < 1;
31510
+ }
31511
+
31512
+
31513
+ /***/ }),
31514
+
31515
+ /***/ 31970:
31516
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31517
+
31518
+ "use strict";
31519
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31520
+ /* harmony export */ l: function() { return /* binding */ UIImagePropertiesForm; }
31521
+ /* harmony export */ });
31522
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635);
31523
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22664);
31524
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(24767);
31525
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65147);
31526
+ /* harmony import */ var jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6455);
31527
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(931);
31528
+ /* harmony import */ var jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16116);
31529
+ /* harmony import */ var _ui_image_main_tab__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33403);
31530
+ /* harmony import */ var _ui_image_position_tab__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46681);
31574
31531
  /*!
31575
31532
  * Jodit Editor (https://xdsoft.net/jodit/)
31576
31533
  * Released under MIT see LICENSE.txt in the project root for license information.
31577
31534
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31578
31535
  */
31579
31536
 
31580
- function form(editor) {
31581
- const { showPreview, editSize } = editor.o.image, gi = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__/* .Icon */ .I.get.bind(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__/* .Icon */ .I);
31582
- return editor.c.fromHTML(`<form class="jodit-properties">
31537
+
31538
+
31539
+
31540
+
31541
+
31542
+
31543
+
31544
+
31545
+
31546
+ /** @private */
31547
+ let UIImagePropertiesForm = class UIImagePropertiesForm extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_2__/* .UIGroup */ .U {
31548
+ className() {
31549
+ return 'UIImagePropertiesForm';
31550
+ }
31551
+ appendChildToContainer() { }
31552
+ getElm(elementName) {
31553
+ const selfElm = super.getElm(elementName);
31554
+ if (selfElm) {
31555
+ return selfElm;
31556
+ }
31557
+ for (const child of this.elements) {
31558
+ const elm = child.getElm(elementName);
31559
+ if (elm) {
31560
+ return elm;
31561
+ }
31562
+ }
31563
+ return null;
31564
+ }
31565
+ constructor(jodit, state, activeTabState, handlers) {
31566
+ super(jodit);
31567
+ this.state = state;
31568
+ this.handlers = handlers;
31569
+ this.__mainTab = new _ui_image_main_tab__WEBPACK_IMPORTED_MODULE_5__/* .UIImageMainTab */ .k(this.jodit, this.state, this.handlers);
31570
+ this.__positionTab = new _ui_image_position_tab__WEBPACK_IMPORTED_MODULE_6__/* .UIImagePositionTab */ ._(this.jodit, this.state, this.handlers);
31571
+ this.getElm('tabsBox').appendChild((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__/* .TabsWidget */ .Zg)(jodit, [
31572
+ { name: 'Image', content: this.__mainTab },
31573
+ { name: 'Advanced', content: this.__positionTab }
31574
+ ], activeTabState));
31575
+ this.setMod('lock-size', this.state.sizeIsLocked);
31576
+ this.append(this.__mainTab).append(this.__positionTab);
31577
+ }
31578
+ render() {
31579
+ return `<form>
31583
31580
  <div class="jodit-grid jodit-grid_xs-column">
31584
31581
  <div class="jodit_col-lg-2-5 jodit_col-xs-5-5">
31585
- <div class="jodit-properties_view_box">
31586
- <div style="${!showPreview ? 'display:none' : ''}" class="jodit-properties_image_view">
31587
- <img data-ref="imageViewSrc" src="" alt=""/>
31582
+ <div class="&__view-box">
31583
+ <div class="&__imageView">
31584
+ <img class="&__imageViewSrc" src="" alt=""/>
31588
31585
  </div>
31589
- <div style="${!editSize ? 'display:none' : ''}" class="jodit-form__group jodit-properties_image_sizes">
31590
- <input data-ref="imageWidth" type="text" class="jodit-input"/>
31591
- <a data-ref="lockSize" class="jodit-properties__lock">${gi('lock')}</a>
31592
- <input data-ref="imageHeight" type="text" class="imageHeight jodit-input"/>
31586
+ <div class="jodit-form__group &__imageSizes">
31587
+ <input type="text" class="jodit-input &__imageWidth"/>
31588
+ <a class="&__lockSize">${jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__/* .Icon */ .I.get('lock')}</a>
31589
+ <input type="text" class="&__imageHeight jodit-input"/>
31593
31590
  </div>
31594
31591
  </div>
31595
31592
  </div>
31596
- <div data-ref="tabsBox" class="jodit_col-lg-3-5 jodit_col-xs-5-5"></div>
31593
+ <div class="jodit_col-lg-3-5 jodit_col-xs-5-5 &__tabsBox"></div>
31597
31594
  </div>
31598
- </form>`);
31599
- }
31595
+ </form>`;
31596
+ }
31597
+ onChangeSizeIsLocked() {
31598
+ const lockSize = this.getElm('lockSize');
31599
+ const imageWidth = this.getElm('imageWidth');
31600
+ lockSize.innerHTML = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__/* .Icon */ .I.get(this.state.sizeIsLocked ? 'lock' : 'unlock');
31601
+ this.setMod('lock-size', this.state.sizeIsLocked);
31602
+ this.j.e.fire(imageWidth, 'change');
31603
+ }
31604
+ onLockSizeClick() {
31605
+ this.state.sizeIsLocked = !this.state.sizeIsLocked;
31606
+ }
31607
+ onStateValuesSizeChange() {
31608
+ const imageWidth = this.getElm('imageWidth');
31609
+ const imageHeight = this.getElm('imageHeight');
31610
+ if (imageWidth !== this.j.od.activeElement) {
31611
+ imageWidth.value = this.state.values.imageWidth.toString();
31612
+ }
31613
+ if (imageHeight !== this.j.od.activeElement) {
31614
+ imageHeight.value = this.state.values.imageHeight.toString();
31615
+ }
31616
+ }
31617
+ onImageWidthChange(e) {
31618
+ const imageWidth = this.getElm('imageWidth');
31619
+ const imageHeight = this.getElm('imageHeight');
31620
+ if (!this.state.sizeIsLocked ||
31621
+ !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isNumeric)(imageWidth.value) ||
31622
+ !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isNumeric)(imageHeight.value)) {
31623
+ this.state.values.imageWidth = imageWidth.value;
31624
+ this.state.values.imageHeight = imageHeight.value;
31625
+ return;
31626
+ }
31627
+ const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
31628
+ if (e.target === imageWidth) {
31629
+ this.state.values.imageWidth = w;
31630
+ this.state.values.imageHeight = Math.round(w / this.state.ratio);
31631
+ }
31632
+ else {
31633
+ this.state.values.imageWidth = Math.round(h * this.state.ratio);
31634
+ this.state.values.imageHeight = h;
31635
+ }
31636
+ }
31637
+ onStateValuesImageSrcChange() {
31638
+ const { imageSrc } = this.state.values;
31639
+ if (!imageSrc) {
31640
+ return;
31641
+ }
31642
+ const imageViewSrc = this.getElm('imageViewSrc');
31643
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(imageViewSrc, 'src', imageSrc);
31644
+ const image = new Image();
31645
+ image.src = imageSrc;
31646
+ this.state.image = image;
31647
+ }
31648
+ hideFieldByOptions() {
31649
+ const opt = this.j.o.image;
31650
+ [
31651
+ ['editSize', 'imageSizes'],
31652
+ ['showPreview', 'imageView']
31653
+ ].forEach(([optKey, elmKey]) => {
31654
+ const elm = this.getElm(elmKey);
31655
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.css)(elm, 'display', opt[optKey] ? null : 'none');
31656
+ });
31657
+ }
31658
+ };
31659
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31660
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31661
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.sizeIsLocked')
31662
+ ], UIImagePropertiesForm.prototype, "onChangeSizeIsLocked", null);
31663
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31664
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('lockSize:click')
31665
+ ], UIImagePropertiesForm.prototype, "onLockSizeClick", null);
31666
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31667
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31668
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)(['state.values.imageWidth', 'state.values.imageHeight'])
31669
+ ], UIImagePropertiesForm.prototype, "onStateValuesSizeChange", null);
31670
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31671
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([
31672
+ 'imageWidth:change',
31673
+ 'imageHeight:change',
31674
+ 'imageWidth:keydown',
31675
+ 'imageHeight:keydown',
31676
+ 'imageWidth:mousedown',
31677
+ 'imageHeight:mousedown',
31678
+ 'imageWidth:paste',
31679
+ 'imageHeight:paste'
31680
+ ]),
31681
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.debounce)()
31682
+ ], UIImagePropertiesForm.prototype, "onImageWidthChange", null);
31683
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31684
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31685
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.values.imageSrc')
31686
+ ], UIImagePropertiesForm.prototype, "onStateValuesImageSrcChange", null);
31687
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31688
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready')
31689
+ ], UIImagePropertiesForm.prototype, "hideFieldByOptions", null);
31690
+ UIImagePropertiesForm = (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31691
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__/* .component */ .s
31692
+ ], UIImagePropertiesForm);
31693
+
31600
31694
 
31601
31695
 
31602
31696
  /***/ }),
31603
31697
 
31604
- /***/ 75263:
31698
+ /***/ 33403:
31605
31699
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31606
31700
 
31607
31701
  "use strict";
31608
31702
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31609
- /* harmony export */ J: function() { return /* binding */ mainTab; }
31703
+ /* harmony export */ k: function() { return /* binding */ UIImageMainTab; }
31610
31704
  /* harmony export */ });
31611
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31705
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31635);
31706
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24767);
31707
+ /* harmony import */ var jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71151);
31708
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
31709
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31710
+ /* harmony import */ var jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6455);
31612
31711
  /*!
31613
31712
  * Jodit Editor (https://xdsoft.net/jodit/)
31614
31713
  * Released under MIT see LICENSE.txt in the project root for license information.
31615
31714
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31616
31715
  */
31617
31716
 
31618
- function mainTab(editor) {
31619
- const opt = editor.o, i18n = editor.i18n.bind(editor), gi = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__/* .Icon */ .I.get.bind(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__/* .Icon */ .I), hasFbUrl = opt.filebrowser.ajax.url || opt.uploader.url, hasEditor = opt.image.useImageEditor;
31620
- return editor.c.fromHTML(`<div style="${!opt.image.editSrc ? 'display:none' : ''}" class="jodit-form__group">
31621
- <label>${i18n('Src')}</label>
31717
+
31718
+
31719
+
31720
+
31721
+
31722
+ /** @private */
31723
+ let UIImageMainTab = class UIImageMainTab extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__/* .UIGroup */ .U {
31724
+ className() {
31725
+ return 'UIImageMainTab';
31726
+ }
31727
+ appendChildToContainer() {
31728
+ // Do nothing
31729
+ }
31730
+ constructor(view, state, handlers) {
31731
+ super(view);
31732
+ this.state = state;
31733
+ this.handlers = handlers;
31734
+ }
31735
+ render() {
31736
+ return `<div class="jodit-form__group &__editSrc">
31737
+ <label>~Src~</label>
31622
31738
  <div class="jodit-input_group">
31623
- <input data-ref="imageSrc" class="jodit-input" type="text"/>
31624
- <div
31625
- class="jodit-input_group-buttons"
31626
- style="${hasFbUrl ? '' : 'display: none'}"
31627
- >
31628
- <a
31629
- data-ref="changeImage"
31630
- class="jodit-button"
31631
- >${gi('image')}</a>
31632
- <a
31633
- data-ref="editImage"
31634
- class="jodit-button"
31635
- style="${hasEditor ? '' : 'display: none'}"
31636
- >${gi('crop')}</a>
31739
+ <input class="jodit-input &__imageSrc" type="text"/>
31740
+ <div class="jodit-input_group-buttons &__fixImage">
31741
+ <a class="jodit-button &__changeImage">*image*</a>
31742
+ <a class="jodit-button &__editImage">*crop*</a>
31637
31743
  </div>
31638
31744
  </div>
31639
31745
  </div>
31640
- <div style="${!opt.image.editTitle ? 'display:none' : ''}" class="jodit-form__group">
31641
- <label>${i18n('Title')}</label>
31642
- <input data-ref="imageTitle" type="text" class="jodit-input"/>
31746
+ <div class="jodit-form__group &__editTitle">
31747
+ <label>~Title~</label>
31748
+ <input type="text" class="jodit-input &__imageTitle"/>
31643
31749
  </div>
31644
- <div style="${!opt.image.editAlt ? 'display:none' : ''}" class="jodit-form__group">
31645
- <label>${i18n('Alternative')}</label>
31646
- <input data-ref="imageAlt" type="text" class="jodit-input"/>
31750
+ <div class="jodit-form__group &__editAlt">
31751
+ <label>~Alternative~</label>
31752
+ <input type="text" class="jodit-input &__imageAlt"/>
31647
31753
  </div>
31648
- <div style="${!opt.image.editLink ? 'display:none' : ''}" class="jodit-form__group">
31649
- <label>${i18n('Link')}</label>
31650
- <input data-ref="imageLink" type="text" class="jodit-input"/>
31754
+ <div class="jodit-form__group &__editLink">
31755
+ <label>~Link~</label>
31756
+ <input type="text" class="jodit-input &__imageLink"/>
31651
31757
  </div>
31652
- <div style="${!opt.image.editLink ? 'display:none' : ''}" class="jodit-form__group">
31758
+ <div class="jodit-form__group &__editLinkTarget">
31653
31759
  <label class="jodit_vertical_middle">
31654
- <input data-ref="imageLinkOpenInNewTab" type="checkbox" class="jodit-checkbox"/>
31655
- <span>${i18n('Open link in new tab')}</span>
31760
+ <input type="checkbox" class="jodit-checkbox &__imageLinkOpenInNewTab"/>
31761
+ <span>~Open link in new tab~</span>
31656
31762
  </label>
31657
- </div>`);
31658
- }
31763
+ </div>`;
31764
+ }
31765
+ async onStateImageSrcChange() {
31766
+ const imageSrc = this.getElm('imageSrc');
31767
+ imageSrc.value = this.state.values.imageSrc;
31768
+ }
31769
+ onImageSrcChange() {
31770
+ this.state.values.imageSrc = this.getElm('imageSrc').value;
31771
+ }
31772
+ /**
31773
+ * Open image editor
31774
+ */
31775
+ onEditImageClick(e) {
31776
+ this.handlers.openImageEditor();
31777
+ e.stopPropagation();
31778
+ }
31779
+ /**
31780
+ * Open popup with filebrowser/uploader buttons for image
31781
+ */
31782
+ onChangeImageClick(e) {
31783
+ this.handlers.openImagePopup(this.getElm('changeImage'));
31784
+ e.stopPropagation();
31785
+ }
31786
+ onStateTitleChange() {
31787
+ const title = this.getElm('imageTitle');
31788
+ title.value = this.state.values.imageTitle;
31789
+ }
31790
+ onTitleChange() {
31791
+ this.state.values.imageTitle = this.getElm('imageTitle').value;
31792
+ }
31793
+ onStateAltChange() {
31794
+ const alt = this.getElm('imageAlt');
31795
+ alt.value = this.state.values.imageAlt;
31796
+ }
31797
+ onAltChange() {
31798
+ this.state.values.imageAlt = this.getElm('imageAlt').value;
31799
+ }
31800
+ onStateImageLinkChange() {
31801
+ const imageLink = this.getElm('imageLink');
31802
+ imageLink.value = this.state.values.imageLink;
31803
+ }
31804
+ onImageLinkChange() {
31805
+ this.state.values.imageLink = this.getElm('imageLink').value;
31806
+ }
31807
+ onStateImageLinkOpenInNewTabChange() {
31808
+ const imageLinkOpenInNewTab = this.getElm('imageLinkOpenInNewTab');
31809
+ imageLinkOpenInNewTab.checked = this.state.values.imageLinkOpenInNewTab;
31810
+ }
31811
+ onImageLinkOpenInNewTabChange() {
31812
+ this.state.values.imageLinkOpenInNewTab = this.getElm('imageLinkOpenInNewTab').checked;
31813
+ }
31814
+ hideFieldByOptions() {
31815
+ const o = this.j.o;
31816
+ const opt = o.image;
31817
+ [
31818
+ ['editSrc', 'editSrc'],
31819
+ ['editTitle', 'editTitle'],
31820
+ ['editAlt', 'editAlt'],
31821
+ ['editLink', 'editLink'],
31822
+ ['editLink', 'editLinkTarget'],
31823
+ ['useImageEditor', 'editImage']
31824
+ ].forEach(([optKey, elmKey]) => {
31825
+ const elm = this.getElm(elmKey);
31826
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display', opt[optKey] ? null : 'none');
31827
+ });
31828
+ const changeImage = this.getElm('changeImage');
31829
+ const needShowChangeImage = Boolean(o.filebrowser.ajax.url || o.uploader.url);
31830
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(changeImage, 'display', needShowChangeImage ? null : 'none');
31831
+ const editImage = this.getElm('editImage');
31832
+ const needShowEditImage = Boolean(o.filebrowser.ajax.url) && opt.useImageEditor;
31833
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(editImage, 'display', needShowEditImage ? null : 'none');
31834
+ const fixImage = this.getElm('fixImage');
31835
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(fixImage, 'display', needShowChangeImage || needShowEditImage ? null : 'none');
31836
+ }
31837
+ };
31838
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31839
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageSrc')
31840
+ ], UIImageMainTab.prototype, "onStateImageSrcChange", null);
31841
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31842
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageSrc:change')
31843
+ ], UIImageMainTab.prototype, "onImageSrcChange", null);
31844
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31845
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('editImage:click')
31846
+ ], UIImageMainTab.prototype, "onEditImageClick", null);
31847
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31848
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('changeImage:click')
31849
+ ], UIImageMainTab.prototype, "onChangeImageClick", null);
31850
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31851
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageTitle')
31852
+ ], UIImageMainTab.prototype, "onStateTitleChange", null);
31853
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31854
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageTitle:change')
31855
+ ], UIImageMainTab.prototype, "onTitleChange", null);
31856
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31857
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageAlt')
31858
+ ], UIImageMainTab.prototype, "onStateAltChange", null);
31859
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31860
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageAlt:change')
31861
+ ], UIImageMainTab.prototype, "onAltChange", null);
31862
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31863
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageLink')
31864
+ ], UIImageMainTab.prototype, "onStateImageLinkChange", null);
31865
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31866
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageLink:change')
31867
+ ], UIImageMainTab.prototype, "onImageLinkChange", null);
31868
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31869
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageLinkOpenInNewTab')
31870
+ ], UIImageMainTab.prototype, "onStateImageLinkOpenInNewTabChange", null);
31871
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31872
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageLinkOpenInNewTab:change')
31873
+ ], UIImageMainTab.prototype, "onImageLinkOpenInNewTabChange", null);
31874
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31875
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready')
31876
+ ], UIImageMainTab.prototype, "hideFieldByOptions", null);
31877
+ UIImageMainTab = (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31878
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_5__/* .component */ .s
31879
+ ], UIImageMainTab);
31880
+
31659
31881
 
31660
31882
 
31661
31883
  /***/ }),
31662
31884
 
31663
- /***/ 57837:
31885
+ /***/ 46681:
31664
31886
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31665
31887
 
31666
31888
  "use strict";
31667
31889
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31668
- /* harmony export */ b: function() { return /* binding */ positionTab; }
31890
+ /* harmony export */ _: function() { return /* binding */ UIImagePositionTab; }
31669
31891
  /* harmony export */ });
31670
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31892
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(31635);
31893
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(24767);
31894
+ /* harmony import */ var jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71151);
31895
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
31896
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31897
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(98253);
31898
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26150);
31899
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29780);
31900
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(931);
31901
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9645);
31671
31902
  /*!
31672
31903
  * Jodit Editor (https://xdsoft.net/jodit/)
31673
31904
  * Released under MIT see LICENSE.txt in the project root for license information.
31674
31905
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31675
31906
  */
31676
31907
 
31677
- function positionTab(editor) {
31678
- const opt = editor.o, i18n = editor.i18n.bind(editor), gi = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__/* .Icon */ .I.get.bind(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__/* .Icon */ .I);
31679
- const classInput = [];
31680
- if (opt.image.availableClasses.length > 0) {
31681
- classInput.push('<select data-ref="classes" class="jodit-input jodit-select">');
31682
- opt.image.availableClasses.forEach(item => {
31683
- if (typeof item === 'string') {
31684
- classInput.push(`<option value="${item}">${item}</option>`);
31685
- }
31686
- else {
31687
- classInput.push(`<option value="${item[0]}">${item[1]}</option>`);
31688
- }
31689
- });
31690
- classInput.push('</select>');
31908
+
31909
+
31910
+
31911
+
31912
+
31913
+
31914
+
31915
+
31916
+
31917
+ /** @private */
31918
+ let UIImagePositionTab = class UIImagePositionTab extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_4__/* .UIElement */ .D {
31919
+ className() {
31920
+ return 'UIImagePositionTab';
31691
31921
  }
31692
- else {
31693
- classInput.push('<input data-ref="classes" type="text" class="jodit-input"/>');
31922
+ constructor(jodit, state, handlers) {
31923
+ super(jodit, {
31924
+ availableClasses: jodit.o.image.availableClasses
31925
+ });
31926
+ this.state = state;
31927
+ this.handlers = handlers;
31694
31928
  }
31695
- return editor.c.fromHTML(`<div style="${!opt.image.editMargins ? 'display:none' : ''}" class="jodit-form__group">
31696
- <label>${i18n('Margins')}</label>
31929
+ render({ availableClasses }) {
31930
+ return `<div class="jodit-form__group &__editMargins">
31931
+ <label>~Margins~</label>
31697
31932
  <div class="jodit-grid jodit_vertical_middle">
31698
- <input class="jodit_col-lg-1-5 jodit-input" data-ref="marginTop" type="text" placeholder="${i18n('top')}"/>
31699
- <a style="text-align: center;" data-ref="lockMargin" class="jodit-properties__lock jodit_col-lg-1-5">${gi('lock')}</a>
31700
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginRight" type="text" placeholder="${i18n('right')}"/>
31701
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginBottom" type="text" placeholder="${i18n('bottom')}"/>
31702
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginLeft" type="text" placeholder="${i18n('left')}"/>
31933
+ <input class="jodit_col-lg-1-5 jodit-input &__marginTop" type="text" placeholder="~top~"/>
31934
+ <a style="text-align: center;" class="jodit-properties__lock jodit_col-lg-1-5 &__lockMargin">*lock*</a>
31935
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginRight" type="text" placeholder="~right~"/>
31936
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginBottom" type="text" placeholder="~bottom~"/>
31937
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginLeft" type="text" placeholder="~left~"/>
31703
31938
  </div>
31704
31939
  </div>
31705
- <div
31706
- style="${!opt.image.editAlign ? 'display:none' : ''}"
31707
- class="jodit-form__group"
31708
- >
31709
- <label>${i18n('Align')}</label>
31710
- <select data-ref="align" class="jodit-select">
31711
- <option value="">${i18n('--Not Set--')}</option>
31712
- <option value="left">${i18n('Left')}</option>
31713
- <option value="center">${i18n('Center')}</option>
31714
- <option value="right">${i18n('Right')}</option>
31940
+ <div class="jodit-form__group &__editAlign">
31941
+ <label>~Align~</label>
31942
+ <select class="jodit-select &__align">
31943
+ <option value="">~--Not Set--~</option>
31944
+ <option value="left">~Left~</option>
31945
+ <option value="center">~Center~</option>
31946
+ <option value="right">~Right~</option>
31715
31947
  </select>
31716
31948
  </div>
31717
- <div style="${!opt.image.editStyle ? 'display:none' : ''}" class="jodit-form__group">
31718
- <label>${i18n('Styles')}</label>
31719
- <input data-ref="style" type="text" class="jodit-input"/>
31949
+ <div class="jodit-form__group &__editStyle">
31950
+ <label>~Styles~</label>
31951
+ <input type="text" class="jodit-input &__style"/>
31720
31952
  </div>
31721
- <div style="${!opt.image.editClass ? 'display:none' : ''}" class="jodit-form__group">
31722
- <label>${i18n('Classes')}</label>
31723
- ${classInput.join('')}
31953
+ <div class="jodit-form__group &__editClass">
31954
+ <label>~Classes~</label>
31955
+ ${(() => {
31956
+ const classInput = [];
31957
+ if (availableClasses && availableClasses.length > 0) {
31958
+ classInput.push('<select class="jodit-input jodit-select &__classes">');
31959
+ availableClasses.forEach(item => {
31960
+ if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__/* .isString */ .K)(item)) {
31961
+ classInput.push(`<option value="${item}">${item}</option>`);
31962
+ }
31963
+ else {
31964
+ classInput.push(`<option value="${item[0]}">${item[1]}</option>`);
31965
+ }
31966
+ });
31967
+ classInput.push('</select>');
31968
+ }
31969
+ else {
31970
+ classInput.push('<input type="text" class="jodit-input &__classes"/>');
31971
+ }
31972
+ return classInput.join('');
31973
+ })()}
31724
31974
  </div>
31725
- <div style="${!opt.image.editId ? 'display:none' : ''}" class="jodit-form__group">
31975
+ <div class="jodit-form__group &__editId">
31726
31976
  <label>Id</label>
31727
- <input data-ref="id" type="text" class="jodit-input"/>
31977
+ <input type="text" class="jodit-input &__id"/>
31728
31978
  </div>
31729
31979
  <div
31730
- style="${!opt.image.editBorderRadius ? 'display:none' : ''}"
31731
- class="jodit-form__group"
31980
+ class="jodit-form__group &__editBorderRadius"
31732
31981
  >
31733
- <label>${i18n('Border radius')}</label>
31734
- <input data-ref="borderRadius" type="number" class="jodit-input"/>
31735
- </div>`);
31982
+ <label>~Border radius~</label>
31983
+ <input type="number" class="jodit-input &__borderRadius"/>
31984
+ </div>`;
31985
+ }
31986
+ onStateAlignChange() {
31987
+ const align = this.getElm('align');
31988
+ align.value = this.state.values.align;
31989
+ }
31990
+ onChangeAlign() {
31991
+ const align = this.getElm('align');
31992
+ this.state.values.align = align.value;
31993
+ }
31994
+ onStateValuesBorderRadiusChange() {
31995
+ const borderRadius = this.getElm('borderRadius');
31996
+ borderRadius.value = this.state.values.borderRadius.toString();
31997
+ }
31998
+ onChangeBorderRadius() {
31999
+ const borderRadius = this.getElm('borderRadius');
32000
+ this.state.values.borderRadius = parseFloat(borderRadius.value);
32001
+ }
32002
+ onStateValuesIdChange() {
32003
+ const id = this.getElm('id');
32004
+ id.value = this.state.values.id;
32005
+ }
32006
+ onChangeId() {
32007
+ const id = this.getElm('id');
32008
+ this.state.values.id = id.value;
32009
+ }
32010
+ onStateValuesStyleChange() {
32011
+ const style = this.getElm('style');
32012
+ style.value = this.state.values.style;
32013
+ }
32014
+ onChangeStyle() {
32015
+ const style = this.getElm('style');
32016
+ this.state.values.style = style.value;
32017
+ }
32018
+ onStateValuesClassesChange() {
32019
+ const classes = this.getElm('classes');
32020
+ classes.value = this.state.values.classes;
32021
+ }
32022
+ onChangClasses() {
32023
+ const classes = this.getElm('classes');
32024
+ this.state.values.classes = classes.value;
32025
+ }
32026
+ onLockMarginClick(e) {
32027
+ this.state.marginIsLocked = !this.state.marginIsLocked;
32028
+ e.preventDefault();
32029
+ }
32030
+ onChangeMarginIsLocked() {
32031
+ const marginBottom = this.getElm('marginBottom');
32032
+ const marginRight = this.getElm('marginRight');
32033
+ const marginLeft = this.getElm('marginLeft');
32034
+ const lockMargin = this.getElm('lockMargin');
32035
+ [marginRight, marginBottom, marginLeft].forEach(elm => {
32036
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__/* .attr */ .C)(elm, 'disabled', this.state.marginIsLocked || null);
32037
+ });
32038
+ lockMargin.innerHTML = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__/* .Icon */ .I.get(this.state.marginIsLocked ? 'lock' : 'unlock');
32039
+ if (this.state.marginIsLocked) {
32040
+ const marginTop = this.state.values.marginTop;
32041
+ this.state.values.marginRight = marginTop;
32042
+ this.state.values.marginBottom = marginTop;
32043
+ this.state.values.marginLeft = marginTop;
32044
+ }
32045
+ }
32046
+ onStateValuesMarginChange() {
32047
+ const marginTop = this.getElm('marginTop');
32048
+ const marginRight = this.getElm('marginRight');
32049
+ const marginBottom = this.getElm('marginBottom');
32050
+ const marginLeft = this.getElm('marginLeft');
32051
+ marginTop.value = this.state.values.marginTop.toString();
32052
+ marginRight.value = this.state.values.marginRight.toString();
32053
+ marginBottom.value = this.state.values.marginBottom.toString();
32054
+ marginLeft.value = this.state.values.marginLeft.toString();
32055
+ }
32056
+ onChangeMargin() {
32057
+ const marginTop = this.getElm('marginTop');
32058
+ const marginRight = this.getElm('marginRight');
32059
+ const marginBottom = this.getElm('marginBottom');
32060
+ const marginLeft = this.getElm('marginLeft');
32061
+ this.state.values.marginTop = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginTop.value);
32062
+ if (this.state.marginIsLocked) {
32063
+ this.state.values.marginRight = this.state.values.marginTop;
32064
+ this.state.values.marginBottom = this.state.values.marginTop;
32065
+ this.state.values.marginLeft = this.state.values.marginTop;
32066
+ }
32067
+ else {
32068
+ this.state.values.marginRight = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginRight.value);
32069
+ this.state.values.marginBottom = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginBottom.value);
32070
+ this.state.values.marginLeft = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginLeft.value);
32071
+ }
32072
+ }
32073
+ hideFieldByOptions() {
32074
+ const opt = this.j.o.image;
32075
+ [
32076
+ ['editMargins', 'editMargins'],
32077
+ ['editAlign', 'editAlign'],
32078
+ ['editStyle', 'editStyle'],
32079
+ ['editClass', 'editClass'],
32080
+ ['editId', 'editId'],
32081
+ ['editBorderRadius', 'editBorderRadius']
32082
+ ].forEach(([optKey, elmKey]) => {
32083
+ const elm = this.getElm(elmKey);
32084
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display', opt[optKey] ? null : 'none');
32085
+ });
32086
+ }
32087
+ };
32088
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32089
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32090
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.align')
32091
+ ], UIImagePositionTab.prototype, "onStateAlignChange", null);
32092
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32093
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('align:change')
32094
+ ], UIImagePositionTab.prototype, "onChangeAlign", null);
32095
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32096
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32097
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.borderRadius')
32098
+ ], UIImagePositionTab.prototype, "onStateValuesBorderRadiusChange", null);
32099
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32100
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('borderRadius:change')
32101
+ ], UIImagePositionTab.prototype, "onChangeBorderRadius", null);
32102
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32103
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32104
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.id')
32105
+ ], UIImagePositionTab.prototype, "onStateValuesIdChange", null);
32106
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32107
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('id:change')
32108
+ ], UIImagePositionTab.prototype, "onChangeId", null);
32109
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32110
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32111
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.style')
32112
+ ], UIImagePositionTab.prototype, "onStateValuesStyleChange", null);
32113
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32114
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('style:change')
32115
+ ], UIImagePositionTab.prototype, "onChangeStyle", null);
32116
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32117
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32118
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.classes')
32119
+ ], UIImagePositionTab.prototype, "onStateValuesClassesChange", null);
32120
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32121
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('classes:change')
32122
+ ], UIImagePositionTab.prototype, "onChangClasses", null);
32123
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32124
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('lockMargin:click')
32125
+ ], UIImagePositionTab.prototype, "onLockMarginClick", null);
32126
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32127
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32128
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.marginIsLocked')
32129
+ ], UIImagePositionTab.prototype, "onChangeMarginIsLocked", null);
32130
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32131
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32132
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)([
32133
+ 'state.values.marginTop',
32134
+ 'state.values.marginRight',
32135
+ 'state.values.marginBottom',
32136
+ 'state.values.marginLeft'
32137
+ ])
32138
+ ], UIImagePositionTab.prototype, "onStateValuesMarginChange", null);
32139
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32140
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)([
32141
+ 'marginTop:change',
32142
+ 'marginRight:change',
32143
+ 'marginBottom:change',
32144
+ 'marginLeft:change'
32145
+ ])
32146
+ ], UIImagePositionTab.prototype, "onChangeMargin", null);
32147
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32148
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready')
32149
+ ], UIImagePositionTab.prototype, "hideFieldByOptions", null);
32150
+ UIImagePositionTab = (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32151
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_9__/* .component */ .s
32152
+ ], UIImagePositionTab);
32153
+
32154
+
32155
+
32156
+ /***/ }),
32157
+
32158
+ /***/ 80778:
32159
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32160
+
32161
+ "use strict";
32162
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32163
+ /* harmony export */ v: function() { return /* binding */ openImageEditorDialog; }
32164
+ /* harmony export */ });
32165
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(98253);
32166
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
32167
+ /* harmony import */ var jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53804);
32168
+ /*!
32169
+ * Jodit Editor (https://xdsoft.net/jodit/)
32170
+ * Released under MIT see LICENSE.txt in the project root for license information.
32171
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32172
+ */
32173
+
32174
+
32175
+
32176
+ /**
32177
+ * Open image editor dialog
32178
+ * @private
32179
+ */
32180
+ function openImageEditorDialog(j, state) {
32181
+ const url = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(state.image, 'src') || '', a = j.c.element('a'), loadExternal = () => {
32182
+ if (a.host !== location.host) {
32183
+ j.confirm('You can only edit your own images. Download this image on the host?', yes => {
32184
+ if (yes && j.uploader) {
32185
+ j.uploader.uploadRemoteImage(a.href.toString(), resp => {
32186
+ j.alert('The image has been successfully uploaded to the host!', () => {
32187
+ if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .K)(resp.newfilename)) {
32188
+ state.values.imageSrc =
32189
+ resp.baseurl +
32190
+ resp.newfilename;
32191
+ }
32192
+ });
32193
+ }, error => {
32194
+ j.alert('There was an error loading %s', error.message);
32195
+ });
32196
+ }
32197
+ });
32198
+ return;
32199
+ }
32200
+ };
32201
+ a.href = url;
32202
+ j.filebrowser.dataProvider
32203
+ .getPathByUrl(a.href.toString())
32204
+ .then(resp => {
32205
+ jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_1__/* .openImageEditor */ .B.call(j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
32206
+ const timestamp = new Date().getTime();
32207
+ state.values.imageSrc =
32208
+ url +
32209
+ (url.indexOf('?') !== -1 ? '' : '?') +
32210
+ '&_tmp=' +
32211
+ timestamp.toString();
32212
+ }, error => {
32213
+ j.alert(error.message);
32214
+ });
32215
+ })
32216
+ .catch(error => {
32217
+ j.alert(error.message, loadExternal);
32218
+ });
32219
+ }
32220
+
32221
+
32222
+ /***/ }),
32223
+
32224
+ /***/ 33733:
32225
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32226
+
32227
+ "use strict";
32228
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32229
+ /* harmony export */ q: function() { return /* binding */ openImagePopup; }
32230
+ /* harmony export */ });
32231
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(37923);
32232
+ /* harmony import */ var jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27594);
32233
+ /* harmony import */ var jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80071);
32234
+ /* harmony import */ var jodit_modules_widget_file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10067);
32235
+ /*!
32236
+ * Jodit Editor (https://xdsoft.net/jodit/)
32237
+ * Released under MIT see LICENSE.txt in the project root for license information.
32238
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32239
+ */
32240
+
32241
+
32242
+
32243
+
32244
+ /** @private */
32245
+ function openImagePopup(j, dialog, state, button) {
32246
+ const popup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_0__/* .Popup */ .z(dialog);
32247
+ const closePopup = () => {
32248
+ popup.close();
32249
+ popup.destruct();
32250
+ };
32251
+ popup
32252
+ .setContent((0,jodit_modules_widget_file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__/* .FileSelectorWidget */ .k)(j, {
32253
+ upload: (data) => {
32254
+ if (data.files && data.files.length) {
32255
+ state.values.imageSrc =
32256
+ data.baseurl + data.files[0];
32257
+ }
32258
+ closePopup();
32259
+ },
32260
+ filebrowser: async (data) => {
32261
+ if (data && (0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .c)(data.files) && data.files.length) {
32262
+ state.values.imageSrc = data.files[0];
32263
+ closePopup();
32264
+ }
32265
+ }
32266
+ }, state.image, closePopup))
32267
+ .open(() => (0,jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_3__/* .position */ .G)(button));
32268
+ }
32269
+
32270
+
32271
+ /***/ }),
32272
+
32273
+ /***/ 9645:
32274
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32275
+
32276
+ "use strict";
32277
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32278
+ /* harmony export */ G: function() { return /* binding */ normalSizeFromString; },
32279
+ /* harmony export */ n: function() { return /* binding */ normalSizeToString; }
32280
+ /* harmony export */ });
32281
+ /* harmony import */ var jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2461);
32282
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59101);
32283
+ /*!
32284
+ * Jodit Editor (https://xdsoft.net/jodit/)
32285
+ * Released under MIT see LICENSE.txt in the project root for license information.
32286
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32287
+ */
32288
+
32289
+
32290
+ /** @private */
32291
+ const normalSizeFromString = (value) => {
32292
+ return /^[-+]?[0-9.]+(px)?$/.test(value.toString())
32293
+ ? parseFloat(value.toString())
32294
+ : value;
32295
+ };
32296
+ /** @private */
32297
+ const normalSizeToString = (value) => {
32298
+ if ((0,jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_1__/* .isNumber */ .E)(value)) {
32299
+ return value ? value + 'px' : value.toString();
32300
+ }
32301
+ value = (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_0__/* .trim */ .Bq)(value);
32302
+ return /^[0-9]+$/.test(value) ? value + 'px' : value;
32303
+ };
32304
+
32305
+
32306
+ /***/ }),
32307
+
32308
+ /***/ 30393:
32309
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32310
+
32311
+ "use strict";
32312
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32313
+ /* harmony export */ j: function() { return /* binding */ applyValuesToImage; }
32314
+ /* harmony export */ });
32315
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
32316
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97369);
32317
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88269);
32318
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78139);
32319
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58972);
32320
+ /*!
32321
+ * Jodit Editor (https://xdsoft.net/jodit/)
32322
+ * Released under MIT see LICENSE.txt in the project root for license information.
32323
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32324
+ */
32325
+
32326
+
32327
+
32328
+
32329
+
32330
+ /**
32331
+ * Apply form's values to image
32332
+ * @private
32333
+ */
32334
+ function applyValuesToImage(j, state, image) {
32335
+ const { style, imageSrc, borderRadius, imageTitle, imageAlt, imageLink, imageWidth, imageHeight, marginTop, marginRight, marginBottom, marginLeft, imageLinkOpenInNewTab, align, classes, id } = state.values;
32336
+ const opt = j.o;
32337
+ // styles
32338
+ if (opt.image.editStyle) {
32339
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'style', style || null);
32340
+ }
32341
+ // Src
32342
+ if (imageSrc) {
32343
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'src', imageSrc);
32344
+ }
32345
+ else {
32346
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.safeRemove(image);
32347
+ return;
32348
+ }
32349
+ // Border radius
32350
+ image.style.borderRadius = borderRadius ? borderRadius + 'px' : '';
32351
+ // Title
32352
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'title', imageTitle || null);
32353
+ // Alt
32354
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'alt', imageAlt || null);
32355
+ // Link
32356
+ (0,_link__WEBPACK_IMPORTED_MODULE_2__/* .applyLink */ .j)(j, image, imageLink, imageLinkOpenInNewTab);
32357
+ // Size
32358
+ (0,_size__WEBPACK_IMPORTED_MODULE_4__/* .applySize */ .q)(image, imageWidth, imageHeight, state.sizeIsLocked);
32359
+ // Margin
32360
+ if (j.o.image.editMargins) {
32361
+ (0,_margin__WEBPACK_IMPORTED_MODULE_3__/* .applyMargin */ .N)(j, marginTop, marginRight, marginBottom, marginLeft, image, state.marginIsLocked);
32362
+ }
32363
+ if (opt.image.editClass) {
32364
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'class', classes || null);
32365
+ }
32366
+ if (opt.image.editId) {
32367
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
32368
+ }
32369
+ if (opt.image.editAlign) {
32370
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
32371
+ }
32372
+ }
32373
+
32374
+
32375
+ /***/ }),
32376
+
32377
+ /***/ 88269:
32378
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32379
+
32380
+ "use strict";
32381
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32382
+ /* harmony export */ j: function() { return /* binding */ applyLink; }
32383
+ /* harmony export */ });
32384
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
32385
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26150);
32386
+ /*!
32387
+ * Jodit Editor (https://xdsoft.net/jodit/)
32388
+ * Released under MIT see LICENSE.txt in the project root for license information.
32389
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32390
+ */
32391
+
32392
+
32393
+ /** @private */
32394
+ function applyLink(j, image, imageLink, imageLinkOpenInNewTab) {
32395
+ // Link
32396
+ let link = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.closest(image, 'a', j.editor);
32397
+ if (imageLink) {
32398
+ if (!link) {
32399
+ link = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.wrap(image, 'a', j.createInside);
32400
+ }
32401
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(link, 'href', imageLink);
32402
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(link, 'target', imageLinkOpenInNewTab ? '_blank' : null);
32403
+ }
32404
+ else {
32405
+ if (link && link.parentNode) {
32406
+ link.parentNode.replaceChild(image, link);
32407
+ }
32408
+ }
32409
+ }
32410
+
32411
+
32412
+ /***/ }),
32413
+
32414
+ /***/ 78139:
32415
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32416
+
32417
+ "use strict";
32418
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32419
+ /* harmony export */ N: function() { return /* binding */ applyMargin; }
32420
+ /* harmony export */ });
32421
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38322);
32422
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9645);
32423
+ /*!
32424
+ * Jodit Editor (https://xdsoft.net/jodit/)
32425
+ * Released under MIT see LICENSE.txt in the project root for license information.
32426
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32427
+ */
32428
+
32429
+
32430
+ /** @private */
32431
+ function applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, image, marginIsLocked) {
32432
+ const margins = [marginTop, marginRight, marginBottom, marginLeft];
32433
+ const applyMargin = (key, value) => {
32434
+ const oldValue = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__/* .css */ .A)(image, key);
32435
+ const v = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_0__/* .normalSizeToString */ .n)(value);
32436
+ if (oldValue.toString() !== v.toString()) {
32437
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__/* .css */ .A)(image, key, v);
32438
+ }
32439
+ };
32440
+ if (!marginIsLocked) {
32441
+ const sides = [
32442
+ 'margin-top',
32443
+ 'margin-right',
32444
+ 'margin-bottom',
32445
+ 'margin-left'
32446
+ ];
32447
+ margins.forEach((margin, index) => {
32448
+ const side = sides[index];
32449
+ applyMargin(side, margin);
32450
+ });
32451
+ }
32452
+ else {
32453
+ applyMargin('margin', marginTop);
32454
+ }
32455
+ }
32456
+
32457
+
32458
+ /***/ }),
32459
+
32460
+ /***/ 58972:
32461
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32462
+
32463
+ "use strict";
32464
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32465
+ /* harmony export */ q: function() { return /* binding */ applySize; }
32466
+ /* harmony export */ });
32467
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
32468
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38322);
32469
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9645);
32470
+ /*!
32471
+ * Jodit Editor (https://xdsoft.net/jodit/)
32472
+ * Released under MIT see LICENSE.txt in the project root for license information.
32473
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32474
+ */
32475
+
32476
+
32477
+
32478
+ /** @private */
32479
+ function applySize(image, imageWidth, imageHeight, sizeIsLocked) {
32480
+ // Size
32481
+ if (imageWidth !== image.offsetWidth ||
32482
+ imageHeight !== image.offsetHeight) {
32483
+ const updatedWidth = imageWidth ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeToString */ .n)(imageWidth) : null;
32484
+ let updatedHeight = imageHeight
32485
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeToString */ .n)(imageHeight)
32486
+ : null;
32487
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__/* .css */ .A)(image, {
32488
+ width: updatedWidth,
32489
+ height: updatedWidth && sizeIsLocked ? null : updatedHeight
32490
+ });
32491
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'width', (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'width') ? updatedWidth : null);
32492
+ if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'width') || sizeIsLocked) {
32493
+ updatedHeight = null;
32494
+ }
32495
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'height', updatedHeight);
32496
+ }
31736
32497
  }
31737
32498
 
31738
32499
 
@@ -38091,7 +38852,8 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .pluginSystem */ .fg.add('selec
38091
38852
  */
38092
38853
 
38093
38854
  jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.select = {
38094
- normalizeSelectionBeforeCutAndCopy: false
38855
+ normalizeSelectionBeforeCutAndCopy: false,
38856
+ normalizeTripleClick: true
38095
38857
  };
38096
38858
 
38097
38859
 
@@ -38167,7 +38929,7 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38167
38929
  }
38168
38930
  }
38169
38931
  /**
38170
- * @event outsideClick(e) - when user clicked in the outside of editor
38932
+ * @event outsideClick(e) - when user clicked on the outside of editor
38171
38933
  */
38172
38934
  onOutsideClick(e) {
38173
38935
  const node = e.target;
@@ -38179,7 +38941,7 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38179
38941
  this.j.e.fire('outsideClick', e);
38180
38942
  }
38181
38943
  }
38182
- beforeCommandCut(command) {
38944
+ beforeCommandCut() {
38183
38945
  const { s } = this.j;
38184
38946
  if (!s.isCollapsed()) {
38185
38947
  const current = s.current();
@@ -38188,13 +38950,27 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38188
38950
  }
38189
38951
  }
38190
38952
  }
38191
- beforeCommandSelectall(command) {
38953
+ beforeCommandSelectAll() {
38192
38954
  const { s } = this.j;
38193
38955
  s.focus();
38194
38956
  s.select(this.j.editor, true);
38195
38957
  s.expandSelection();
38196
38958
  return false;
38197
38959
  }
38960
+ /**
38961
+ * Normalize selection after triple click
38962
+ */
38963
+ onTripleClickNormalizeSelection(e) {
38964
+ if (e.detail !== 3 || !this.j.o.select.normalizeTripleClick) {
38965
+ return;
38966
+ }
38967
+ const { s } = this.j;
38968
+ const { startContainer, startOffset } = s.range;
38969
+ if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(startContainer)) {
38970
+ s.select(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.closest(startContainer, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isBlock, this.j.editor) ||
38971
+ startContainer, true);
38972
+ }
38973
+ }
38198
38974
  onCopyNormalizeSelectionBound(e) {
38199
38975
  const { s, editor, o } = this.j;
38200
38976
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -38220,7 +38996,10 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38220
38996
  ], select.prototype, "beforeCommandCut", null);
38221
38997
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
38222
38998
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':beforeCommandSelectall'])
38223
- ], select.prototype, "beforeCommandSelectall", null);
38999
+ ], select.prototype, "beforeCommandSelectAll", null);
39000
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
39001
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':click'])
39002
+ ], select.prototype, "onTripleClickNormalizeSelection", null);
38224
39003
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
38225
39004
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':copy', ':cut'])
38226
39005
  ], select.prototype, "onCopyNormalizeSelectionBound", null);