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/es2018/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
  */
@@ -1707,7 +1707,7 @@ __webpack_require__.r(__webpack_exports__);
1707
1707
  * Released under MIT see LICENSE.txt in the project root for license information.
1708
1708
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1709
1709
  */
1710
- const APP_VERSION = "4.1.16";
1710
+ const APP_VERSION = "4.2.5";
1711
1711
  // prettier-ignore
1712
1712
  const ES = "es2018";
1713
1713
  const IS_ES_MODERN = true;
@@ -6720,6 +6720,7 @@ const offset = (elm, jodit, doc, recurse = false) => {
6720
6720
  * Calculate screen element position
6721
6721
  */
6722
6722
  function position(elm, jodit, recurse = false) {
6723
+ var _a, _b;
6723
6724
  const rect = elm.getBoundingClientRect();
6724
6725
  let xPos = rect.left, yPos = rect.top;
6725
6726
  if ((0,jodit_core_helpers_checker_is_jodit_object__WEBPACK_IMPORTED_MODULE_0__/* .isJoditObject */ .y)(jodit) &&
@@ -6733,8 +6734,8 @@ function position(elm, jodit, recurse = false) {
6733
6734
  return {
6734
6735
  left: Math.round(xPos),
6735
6736
  top: Math.round(yPos),
6736
- width: Math.round(elm.offsetWidth),
6737
- height: Math.round(elm.offsetHeight)
6737
+ width: Math.round((_a = elm.offsetWidth) !== null && _a !== void 0 ? _a : rect.width),
6738
+ height: Math.round((_b = elm.offsetHeight) !== null && _b !== void 0 ? _b : rect.height)
6738
6739
  };
6739
6740
  }
6740
6741
 
@@ -8770,9 +8771,9 @@ const getXPathByElement = (element, root) => {
8770
8771
  * Find all `ref` or `data-ref` elements inside HTMLElement
8771
8772
  */
8772
8773
  const refs = (root) => {
8773
- // if (Component.isInstanceOf<UIElement>(root, UIElement)) {
8774
- // root = root.container;
8775
- // }
8774
+ if ('container' in root) {
8775
+ root = root.container;
8776
+ }
8776
8777
  return $$('[ref],[data-ref]', root).reduce((def, child) => {
8777
8778
  const key = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(child, '-ref');
8778
8779
  if (key && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_4__/* .isString */ .K)(key)) {
@@ -13315,7 +13316,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13315
13316
  view.o.showTooltip &&
13316
13317
  !view.o.useNativeTooltip) {
13317
13318
  view.hookStatus(jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .STATUSES */ .f.ready, () => {
13318
- // TODO Move it inside __open method. Now it is here becous testcase failed with capturing
13319
+ // TODO Move it inside __open method. Now it is here because testcase failed with capturing
13319
13320
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .getContainer */ .My)(this.j, UITooltip_1).appendChild(this.container);
13320
13321
  view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
13321
13322
  capture: true
@@ -13331,6 +13332,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13331
13332
  const view = this.j;
13332
13333
  view.e
13333
13334
  .on(view.ow, 'scroll.tooltip', this.__hide)
13335
+ .on(view.ow, 'joditCloseDialog', this.__hide)
13334
13336
  .on(view.container, 'mouseleave.tooltip', this.__hide)
13335
13337
  .on([
13336
13338
  'escape.tooltip',
@@ -15348,7 +15350,7 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_7__/* .UI
15348
15350
  }
15349
15351
  let pe = this.parentElement;
15350
15352
  while (pe) {
15351
- if (checkView(j)) {
15353
+ if (checkView(pe.j)) {
15352
15354
  return;
15353
15355
  }
15354
15356
  if (pe.container.style.zIndex) {
@@ -17844,6 +17846,7 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
17844
17846
  * Fired when dialog box is started moving
17845
17847
  */
17846
17848
  this.e.fire(this, 'startMove');
17849
+ this.e.fire('closeAllPopups');
17847
17850
  }
17848
17851
  }
17849
17852
  onMouseMove(e) {
@@ -19790,7 +19793,15 @@ let FileBrowser = class FileBrowser extends jodit_core_view_view_with_toolbar__W
19790
19793
  this.__updateToolbarButtons();
19791
19794
  this._dialog.open(this.browser, header);
19792
19795
  this.e.fire('sort.filebrowser', this.state.sortBy);
19793
- (0,_fetch_load_tree__WEBPACK_IMPORTED_MODULE_10__/* .loadTree */ .r)(this).then(resolve, reject);
19796
+ (0,_fetch_load_tree__WEBPACK_IMPORTED_MODULE_10__/* .loadTree */ .r)(this)
19797
+ .then(resolve, reject)
19798
+ .finally(() => {
19799
+ var _a;
19800
+ if (this.isInDestruct) {
19801
+ return;
19802
+ }
19803
+ (_a = this === null || this === void 0 ? void 0 : this.e) === null || _a === void 0 ? void 0 : _a.fire('fileBrowserReady.filebrowser');
19804
+ });
19794
19805
  })
19795
19806
  .catch((e) => {
19796
19807
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
@@ -21663,11 +21674,12 @@ const act = (el, className = 'jodti-image-editor_active') => el ? className : ''
21663
21674
  const form = (editor, o) => {
21664
21675
  const i = editor.i18n.bind(editor);
21665
21676
  const switcher = (label, ref, active = true) => `<div class="jodit-form__group">
21666
- <label>${i(label)}</label>
21667
-
21668
- <label class='jodit-switcher'>
21669
- <input ${act(active, 'checked')} data-ref="${ref}" type="checkbox"/>
21670
- <span class="jodit-switcher__slider"></span>
21677
+ <label class="jodit-switcher-wrapper">
21678
+ <span class='jodit-switcher'>
21679
+ <input ${act(active, 'checked')} data-ref="${ref}" type="checkbox"/>
21680
+ <span class="jodit-switcher__slider"></span>
21681
+ </span>
21682
+ <span>${i(label)}</span>
21671
21683
  </label>
21672
21684
  </div>`;
21673
21685
  return editor.create.fromHTML(`<form class="${jie} jodit-properties">
@@ -24748,11 +24760,13 @@ const TabsWidget = (jodit, tabs, state) => {
24748
24760
  return;
24749
24761
  }
24750
24762
  buttonList.forEach(b => {
24763
+ b.state.variant = 'initial';
24751
24764
  b.state.activated = false;
24752
24765
  });
24753
24766
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('.jodit-tab', tabBox).forEach(a => {
24754
24767
  a.classList.remove('jodit-tab_active');
24755
24768
  });
24769
+ nameToTab[tab].button.state.variant = 'outline';
24756
24770
  nameToTab[tab].button.state.activated = true;
24757
24771
  nameToTab[tab].tab.classList.add('jodit-tab_active');
24758
24772
  };
@@ -24781,7 +24795,7 @@ const TabsWidget = (jodit, tabs, state) => {
24781
24795
  content.call(jodit);
24782
24796
  }
24783
24797
  if (state) {
24784
- state.__activeTab = name;
24798
+ state.activeTab = name;
24785
24799
  }
24786
24800
  return false;
24787
24801
  });
@@ -24797,20 +24811,20 @@ const TabsWidget = (jodit, tabs, state) => {
24797
24811
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('a', buttons).forEach(a => {
24798
24812
  a.style.width = (100 / tabCount).toFixed(10) + '%';
24799
24813
  });
24800
- const tab = !state || !state.__activeTab || !nameToTab[state.__activeTab]
24814
+ const tab = !state || !state.activeTab || !nameToTab[state.activeTab]
24801
24815
  ? firstTab
24802
- : state.__activeTab;
24816
+ : state.activeTab;
24803
24817
  setActive(tab);
24804
24818
  if (state) {
24805
- let __activeTab = state.__activeTab;
24806
- Object.defineProperty(state, '__activeTab', {
24819
+ let activeTab = state.activeTab;
24820
+ Object.defineProperty(state, 'activeTab', {
24807
24821
  configurable: true,
24808
24822
  enumerable: false,
24809
24823
  get() {
24810
- return __activeTab;
24824
+ return activeTab;
24811
24825
  },
24812
24826
  set(value) {
24813
- __activeTab = value;
24827
+ activeTab = value;
24814
24828
  setActive(value);
24815
24829
  }
24816
24830
  });
@@ -25225,7 +25239,7 @@ class aiAssistant extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_3__/
25225
25239
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .extendLang */ .JW)(_langs__WEBPACK_IMPORTED_MODULE_6__);
25226
25240
  }
25227
25241
  /** @override */
25228
- afterInit(jodit) { }
25242
+ afterInit() { }
25229
25243
  onGenerateAiAssistantForm(prompt) {
25230
25244
  this.__dialog.open(this.__container, 'AI Assistant');
25231
25245
  this.__container.setPrompt(prompt);
@@ -31106,9 +31120,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .pluginSystem */ .fg.add('image
31106
31120
  * Released under MIT see LICENSE.txt in the project root for license information.
31107
31121
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31108
31122
  */
31109
- /**
31110
- * @module plugins/image-properties
31111
- */
31112
31123
 
31113
31124
  jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
31114
31125
  dialogWidth: 600,
@@ -31138,18 +31149,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
31138
31149
 
31139
31150
  "use strict";
31140
31151
  /* unused harmony export imageProperties */
31141
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(31635);
31152
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(31635);
31142
31153
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22664);
31143
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56298);
31144
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31145
- /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35265);
31146
- /* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(37435);
31147
- /* harmony import */ var jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(53804);
31148
- /* harmony import */ var jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16116);
31149
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(24654);
31150
- /* harmony import */ var _templates_form__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(22254);
31151
- /* harmony import */ var _templates_main_tab__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75263);
31152
- /* harmony import */ var _templates_position_tab__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(57837);
31154
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
31155
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
31156
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65147);
31157
+ /* harmony import */ var jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29866);
31158
+ /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(35265);
31159
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(24654);
31160
+ /* harmony import */ var _ui_ui_image_form__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31970);
31161
+ /* harmony import */ var _utils_open_image_editor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80778);
31162
+ /* harmony import */ var _utils_open_image_popup__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(33733);
31163
+ /* harmony import */ var _readers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(5549);
31164
+ /* harmony import */ var _writers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(30393);
31153
31165
  /*!
31154
31166
  * Jodit Editor (https://xdsoft.net/jodit/)
31155
31167
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -31181,55 +31193,93 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
31181
31193
  * });
31182
31194
  * ```
31183
31195
  */
31184
- const normalSizeToString = (value) => {
31185
- value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(value);
31186
- return /^[0-9]+$/.test(value) ? value + 'px' : value;
31187
- };
31188
- const normalSizeFromString = (value) => {
31189
- return /^[-+]?[0-9.]+px$/.test(value.toString())
31190
- ? parseFloat(value.toString())
31191
- : value;
31192
- };
31193
31196
  /**
31194
31197
  * Show dialog with image's options
31195
31198
  */
31196
- class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin {
31199
+ class imageProperties extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k {
31197
31200
  constructor() {
31198
31201
  super(...arguments);
31199
31202
  this.state = {
31200
31203
  image: new Image(),
31204
+ sourceImage: new Image(),
31201
31205
  get ratio() {
31202
- return this.image.naturalWidth / this.image.naturalHeight || 1;
31206
+ const { naturalWidth, naturalHeight } = this.image;
31207
+ return naturalWidth / naturalHeight || 1;
31203
31208
  },
31204
31209
  sizeIsLocked: true,
31205
- marginIsLocked: true
31210
+ marginIsLocked: true,
31211
+ values: {
31212
+ style: '',
31213
+ imageSrc: '',
31214
+ borderRadius: 0,
31215
+ imageTitle: '',
31216
+ imageAlt: '',
31217
+ imageLink: '',
31218
+ imageLinkOpenInNewTab: false,
31219
+ imageWidth: 0,
31220
+ imageHeight: 0,
31221
+ marginTop: 0,
31222
+ marginRight: 0,
31223
+ marginBottom: 0,
31224
+ marginLeft: 0,
31225
+ classes: '',
31226
+ id: '',
31227
+ align: ''
31228
+ }
31206
31229
  };
31207
31230
  this.activeTabState = {
31208
- __activeTab: 'Image'
31231
+ activeTab: 'Image'
31209
31232
  };
31210
31233
  }
31211
- onChangeMarginIsLocked() {
31212
- if (!this.form) {
31213
- return;
31214
- }
31215
- const { marginRight, marginBottom, marginLeft, lockMargin } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31216
- [marginRight, marginBottom, marginLeft].forEach(elm => {
31217
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'disabled', this.state.marginIsLocked || null);
31234
+ get form() {
31235
+ return new _ui_ui_image_form__WEBPACK_IMPORTED_MODULE_7__/* .UIImagePropertiesForm */ .l(this.j, this.state, this.activeTabState, {
31236
+ openImageEditor: () => (0,_utils_open_image_editor__WEBPACK_IMPORTED_MODULE_8__/* .openImageEditorDialog */ .v)(this.j, this.state),
31237
+ openImagePopup: target => (0,_utils_open_image_popup__WEBPACK_IMPORTED_MODULE_9__/* .openImagePopup */ .q)(this.j, this.dialog, this.state, target)
31218
31238
  });
31219
- lockMargin.innerHTML = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Icon.get(this.state.marginIsLocked ? 'lock' : 'unlock');
31220
31239
  }
31221
- onChangeSizeIsLocked() {
31222
- if (!this.form) {
31223
- return;
31224
- }
31225
- const { lockSize, imageWidth } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31226
- lockSize.innerHTML = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Icon.get(this.state.sizeIsLocked ? 'lock' : 'unlock');
31227
- lockSize.classList.remove('jodit-properties__lock');
31228
- lockSize.classList.remove('jodit-properties__unlock');
31229
- lockSize.classList.add(this.state.sizeIsLocked
31230
- ? 'jodit-properties__lock'
31231
- : 'jodit-properties__unlock');
31232
- this.j.e.fire(imageWidth, 'change');
31240
+ /**
31241
+ * Dialog for form
31242
+ */
31243
+ get dialog() {
31244
+ const { j } = this;
31245
+ const dialog = j.dlg({
31246
+ minWidth: Math.min(400, screen.width),
31247
+ minHeight: 590,
31248
+ buttons: ['fullsize', 'dialog.close']
31249
+ });
31250
+ const buttons = this.__buttons;
31251
+ buttons.check.onAction(() => {
31252
+ (0,_writers__WEBPACK_IMPORTED_MODULE_11__/* .applyValuesToImage */ .j)(j, this.state, this.state.sourceImage);
31253
+ j.synchronizeValues();
31254
+ dialog.close();
31255
+ });
31256
+ buttons.remove.onAction(() => {
31257
+ j.s.removeNode(this.state.sourceImage);
31258
+ dialog.close();
31259
+ });
31260
+ buttons.cancel.onAction(() => {
31261
+ dialog.close();
31262
+ });
31263
+ dialog.setHeader(j.i18n('Image properties'));
31264
+ dialog.setContent(this.form);
31265
+ dialog.setFooter([[buttons.cancel, buttons.remove], buttons.check]);
31266
+ j.e.on(dialog, 'afterClose', () => {
31267
+ if (this.state.image.parentNode &&
31268
+ j.o.image.selectImageAfterClose) {
31269
+ j.s.select(this.state.sourceImage);
31270
+ }
31271
+ });
31272
+ dialog.setSize(j.o.image.dialogWidth);
31273
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.markOwner)(j, dialog.container);
31274
+ return dialog;
31275
+ }
31276
+ get __buttons() {
31277
+ const { j } = this;
31278
+ return {
31279
+ check: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'ok', 'Apply', 'primary'),
31280
+ remove: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'bin', 'Delete'),
31281
+ cancel: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'cancel', 'Cancel')
31282
+ };
31233
31283
  }
31234
31284
  /**
31235
31285
  * Open dialog editing image properties
@@ -31246,358 +31296,24 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31246
31296
  * ```
31247
31297
  */
31248
31298
  open() {
31249
- this.makeForm();
31250
- this.activeTabState.__activeTab = 'Image';
31251
- this.j.e.fire('hidePopup');
31252
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.markOwner)(this.j, this.dialog.container);
31253
- this.state.marginIsLocked = true;
31254
- this.state.sizeIsLocked = true;
31255
- this.onChangeMarginIsLocked();
31256
- this.onChangeSizeIsLocked();
31257
- this.updateValues();
31299
+ this.activeTabState.activeTab = 'Image';
31300
+ this.__lock();
31258
31301
  this.dialog.open().setModal(true).setPosition();
31302
+ this.async
31303
+ .promise((resolve, reject) => (0,_readers__WEBPACK_IMPORTED_MODULE_10__/* .readValuesFromImage */ .U)(this.j, this.state).then(resolve, reject))
31304
+ .catch((e) => this.dialog.message.error(e.message))
31305
+ .finally(() => this.__unlock());
31259
31306
  return false;
31260
31307
  }
31261
- /**
31262
- * Create form for edit image properties
31263
- */
31264
- makeForm() {
31265
- if (this.dialog) {
31266
- return;
31267
- }
31268
- this.dialog = this.j.dlg({
31269
- minWidth: Math.min(400, screen.width),
31270
- minHeight: 590,
31271
- buttons: ['fullsize', 'dialog.close']
31272
- });
31273
- const editor = this.j, opt = editor.o, i18n = editor.i18n.bind(editor), buttons = {
31274
- check: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(editor, 'ok', 'Apply', 'primary'),
31275
- remove: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(editor, 'bin', 'Delete')
31276
- };
31277
- editor.e.on(this.dialog, 'afterClose', () => {
31278
- if (this.state.image.parentNode &&
31279
- opt.image.selectImageAfterClose) {
31280
- editor.s.select(this.state.image);
31281
- }
31282
- });
31283
- buttons.remove.onAction(() => {
31284
- editor.s.removeNode(this.state.image);
31285
- this.dialog.close();
31286
- });
31287
- const { dialog } = this;
31288
- dialog.setHeader(i18n('Image properties'));
31289
- const mainForm = (0,_templates_form__WEBPACK_IMPORTED_MODULE_8__/* .form */ .Z)(editor);
31290
- this.form = mainForm;
31291
- dialog.setContent(mainForm);
31292
- const { tabsBox } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31293
- if (tabsBox) {
31294
- tabsBox.appendChild((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__/* .TabsWidget */ .Zg)(editor, [
31295
- { name: 'Image', content: (0,_templates_main_tab__WEBPACK_IMPORTED_MODULE_9__/* .mainTab */ .J)(editor) },
31296
- { name: 'Advanced', content: (0,_templates_position_tab__WEBPACK_IMPORTED_MODULE_10__/* .positionTab */ .b)(editor) }
31297
- ], this.activeTabState));
31298
- }
31299
- buttons.check.onAction(this.onApply);
31300
- const { changeImage, editImage } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31301
- editor.e.on(changeImage, 'click', this.openImagePopup);
31302
- if (opt.image.useImageEditor) {
31303
- editor.e.on(editImage, 'click', this.openImageEditor);
31304
- }
31305
- const { lockSize, lockMargin, imageWidth, imageHeight } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(mainForm);
31306
- if (lockSize) {
31307
- editor.e.on(lockSize, 'click', () => {
31308
- this.state.sizeIsLocked = !this.state.sizeIsLocked;
31309
- });
31310
- }
31311
- editor.e.on(lockMargin, 'click', (e) => {
31312
- this.state.marginIsLocked = !this.state.marginIsLocked;
31313
- e.preventDefault();
31314
- });
31315
- const changeSizes = (event) => {
31316
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageWidth.value) || !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageHeight.value)) {
31317
- return;
31318
- }
31319
- const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
31320
- if (event.target === imageWidth) {
31321
- imageHeight.value = Math.round(w / this.state.ratio).toString();
31322
- }
31323
- else {
31324
- imageWidth.value = Math.round(h * this.state.ratio).toString();
31325
- }
31326
- };
31327
- editor.e.on([imageWidth, imageHeight], 'change keydown mousedown paste', (event) => {
31328
- if (!this.state.sizeIsLocked) {
31329
- return;
31330
- }
31331
- editor.async.setTimeout(changeSizes.bind(this, event), {
31332
- timeout: editor.defaultTimeout,
31333
- label: 'image-properties-changeSize'
31334
- });
31335
- });
31336
- dialog.setFooter([buttons.remove, buttons.check]);
31337
- dialog.setSize(this.j.o.image.dialogWidth);
31308
+ __lock() {
31309
+ this.dialog.lock();
31310
+ this.form.setMod('lock', true);
31311
+ Object.values(this.__buttons).forEach(b => (b.state.disabled = true));
31338
31312
  }
31339
- /**
31340
- * Set input values from image
31341
- */
31342
- updateValues() {
31343
- const opt = this.j.o;
31344
- const { image } = this.state;
31345
- 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);
31346
- const updateLock = () => {
31347
- lockMargin.checked = this.state.marginIsLocked;
31348
- lockSize.checked = this.state.sizeIsLocked;
31349
- }, updateAlign = () => {
31350
- if (image.style.cssFloat &&
31351
- ['left', 'right'].indexOf(image.style.cssFloat.toLowerCase()) !== -1) {
31352
- align.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float');
31353
- }
31354
- else {
31355
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'display') === 'block' &&
31356
- image.style.marginLeft === 'auto' &&
31357
- image.style.marginRight === 'auto') {
31358
- align.value = 'center';
31359
- }
31360
- }
31361
- }, updateBorderRadius = () => {
31362
- borderRadius.value = (parseInt(image.style.borderRadius || '0', 10) || '0').toString();
31363
- }, updateId = () => {
31364
- id.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'id') || '';
31365
- }, updateStyle = () => {
31366
- style.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'style') || '';
31367
- }, updateClasses = () => {
31368
- classes.value = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
31369
- }, updateMargins = () => {
31370
- if (!opt.image.editMargins) {
31371
- return;
31372
- }
31373
- let equal = true, wasEmptyField = false;
31374
- [marginTop, marginRight, marginBottom, marginLeft].forEach(elm => {
31375
- const id = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'data-ref') || '';
31376
- let value = image.style.getPropertyValue((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.kebabCase)(id));
31377
- if (!value) {
31378
- wasEmptyField = true;
31379
- elm.value = '';
31380
- return;
31381
- }
31382
- if (/^[0-9]+(px)?$/.test(value)) {
31383
- value = parseInt(value, 10);
31384
- }
31385
- elm.value = value.toString() || '';
31386
- if ((wasEmptyField && elm.value) ||
31387
- (equal &&
31388
- id !== 'marginTop' &&
31389
- elm.value !== marginTop.value)) {
31390
- equal = false;
31391
- }
31392
- });
31393
- this.state.marginIsLocked = equal;
31394
- }, updateSizes = () => {
31395
- const width = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width') ||
31396
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'width', true) ||
31397
- false, height = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height') ||
31398
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'height', true) ||
31399
- false;
31400
- imageWidth.value =
31401
- width !== false
31402
- ? normalSizeFromString(width).toString()
31403
- : image.offsetWidth.toString();
31404
- imageHeight.value =
31405
- height !== false
31406
- ? normalSizeFromString(height).toString()
31407
- : image.offsetHeight.toString();
31408
- this.state.sizeIsLocked = (() => {
31409
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageWidth.value) ||
31410
- !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageHeight.value)) {
31411
- return false;
31412
- }
31413
- const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
31414
- return Math.abs(w - h * this.state.ratio) < 1;
31415
- })();
31416
- }, updateText = () => {
31417
- imageTitle.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'title') || '';
31418
- imageAlt.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt') || '';
31419
- const a = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(image, 'a', this.j.editor);
31420
- if (a) {
31421
- imageLink.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(a, 'href') || '';
31422
- imageLinkOpenInNewTab.checked =
31423
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(a, 'target') === '_blank';
31424
- }
31425
- else {
31426
- imageLink.value = '';
31427
- imageLinkOpenInNewTab.checked = false;
31428
- }
31429
- }, updateSrc = () => {
31430
- imageSrc.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src') || '';
31431
- if (imageViewSrc) {
31432
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(imageViewSrc, 'src', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src') || '');
31433
- }
31434
- };
31435
- updateLock();
31436
- updateSrc();
31437
- updateText();
31438
- updateSizes();
31439
- updateMargins();
31440
- updateClasses();
31441
- updateId();
31442
- updateBorderRadius();
31443
- updateAlign();
31444
- updateStyle();
31445
- }
31446
- /**
31447
- * Apply form's values to image
31448
- */
31449
- onApply() {
31450
- 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);
31451
- const opt = this.j.o;
31452
- const { image } = this.state;
31453
- // styles
31454
- if (opt.image.editStyle) {
31455
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'style', style.value || null);
31456
- }
31457
- // Src
31458
- if (imageSrc.value) {
31459
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src', imageSrc.value);
31460
- }
31461
- else {
31462
- jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(image);
31463
- this.dialog.close();
31464
- return;
31465
- }
31466
- // Border radius
31467
- if (borderRadius.value !== '0' && /^[0-9]+$/.test(borderRadius.value)) {
31468
- image.style.borderRadius = borderRadius.value + 'px';
31469
- }
31470
- else {
31471
- image.style.borderRadius = '';
31472
- }
31473
- // Title
31474
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'title', imageTitle.value || null);
31475
- // Alt
31476
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt', imageAlt.value || null);
31477
- // Link
31478
- let link = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(image, 'a', this.j.editor);
31479
- if (imageLink.value) {
31480
- if (!link) {
31481
- link = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(image, 'a', this.j.createInside);
31482
- }
31483
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'href', imageLink.value);
31484
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'target', imageLinkOpenInNewTab.checked ? '_blank' : null);
31485
- }
31486
- else {
31487
- if (link && link.parentNode) {
31488
- link.parentNode.replaceChild(image, link);
31489
- }
31490
- }
31491
- // Size
31492
- if (imageWidth.value !== image.offsetWidth.toString() ||
31493
- imageHeight.value !== image.offsetHeight.toString()) {
31494
- const updatedtWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(imageWidth.value)
31495
- ? normalSizeToString(imageWidth.value)
31496
- : null;
31497
- const updatedHeight = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(imageHeight.value)
31498
- ? normalSizeToString(imageHeight.value)
31499
- : null;
31500
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, {
31501
- width: updatedtWidth,
31502
- height: updatedHeight
31503
- });
31504
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width') ? updatedtWidth : null);
31505
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height') ? updatedHeight : null);
31506
- }
31507
- const margins = [marginTop, marginRight, marginBottom, marginLeft];
31508
- if (opt.image.editMargins) {
31509
- if (!this.state.marginIsLocked) {
31510
- margins.forEach((margin) => {
31511
- const side = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(margin, 'data-ref') || '';
31512
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, side, normalSizeToString(margin.value));
31513
- });
31514
- }
31515
- else {
31516
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'margin', normalSizeToString(marginTop.value));
31517
- }
31518
- }
31519
- if (opt.image.editClass) {
31520
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'class', classes.value || null);
31521
- }
31522
- if (opt.image.editId) {
31523
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'id', id.value || null);
31524
- }
31525
- if (opt.image.editAlign) {
31526
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(image, align.value);
31527
- }
31528
- this.j.synchronizeValues();
31529
- this.dialog.close();
31530
- }
31531
- /**
31532
- * Open image editor dialog
31533
- */
31534
- openImageEditor() {
31535
- const url = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src') || '', a = this.j.c.element('a'), loadExternal = () => {
31536
- if (a.host !== location.host) {
31537
- this.j.confirm('You can only edit your own images. Download this image on the host?', yes => {
31538
- if (yes && this.j.uploader) {
31539
- this.j.uploader.uploadRemoteImage(a.href.toString(), resp => {
31540
- this.j.alert('The image has been successfully uploaded to the host!', () => {
31541
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isString)(resp.newfilename)) {
31542
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', resp.baseurl +
31543
- resp.newfilename);
31544
- this.updateValues();
31545
- }
31546
- });
31547
- }, error => {
31548
- this.j.alert('There was an error loading %s', error.message);
31549
- });
31550
- }
31551
- });
31552
- return;
31553
- }
31554
- };
31555
- a.href = url;
31556
- this.j.filebrowser.dataProvider
31557
- .getPathByUrl(a.href.toString())
31558
- .then(resp => {
31559
- jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_5__/* .openImageEditor */ .B.call(this.j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
31560
- const timestamp = new Date().getTime();
31561
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', url +
31562
- (url.indexOf('?') !== -1 ? '' : '?') +
31563
- '&_tmp=' +
31564
- timestamp.toString());
31565
- this.updateValues();
31566
- }, error => {
31567
- this.j.alert(error.message);
31568
- });
31569
- })
31570
- .catch(error => {
31571
- this.j.alert(error.message, loadExternal);
31572
- });
31573
- }
31574
- /**
31575
- * Open popup with filebrowser/uploader buttons for image
31576
- */
31577
- openImagePopup(event) {
31578
- const popup = new jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Popup(this.j), { changeImage } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31579
- popup.setZIndex(this.dialog.getZIndex() + 1);
31580
- popup
31581
- .setContent((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__/* .FileSelectorWidget */ .kG)(this.j, {
31582
- upload: (data) => {
31583
- if (data.files && data.files.length) {
31584
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', data.baseurl + data.files[0]);
31585
- }
31586
- this.updateValues();
31587
- popup.close();
31588
- },
31589
- filebrowser: (data) => {
31590
- if (data &&
31591
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isArray)(data.files) &&
31592
- data.files.length) {
31593
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', data.files[0]);
31594
- popup.close();
31595
- this.updateValues();
31596
- }
31597
- }
31598
- }, this.state.image, popup.close))
31599
- .open(() => (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.position)(changeImage));
31600
- event.stopPropagation();
31313
+ __unlock() {
31314
+ this.dialog.unlock();
31315
+ this.form.setMod('lock', false);
31316
+ Object.values(this.__buttons).forEach(b => (b.state.disabled = false));
31601
31317
  }
31602
31318
  /** @override **/
31603
31319
  afterInit(editor) {
@@ -31608,7 +31324,7 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31608
31324
  .off(editor.editor, '.imageproperties')
31609
31325
  .on(editor.editor, 'dblclick.imageproperties', (e) => {
31610
31326
  const image = e.target;
31611
- if (!jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(image, 'img')) {
31327
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(image, 'img')) {
31612
31328
  return;
31613
31329
  }
31614
31330
  if (editor.o.image.openOnDblClick) {
@@ -31616,7 +31332,8 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31616
31332
  false) {
31617
31333
  return;
31618
31334
  }
31619
- self.state.image = image;
31335
+ self.state.sourceImage = image;
31336
+ self.state.image = image.cloneNode(true);
31620
31337
  if (!editor.o.readonly) {
31621
31338
  e.stopImmediatePropagation();
31622
31339
  e.preventDefault();
@@ -31630,206 +31347,1253 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31630
31347
  });
31631
31348
  })
31632
31349
  .on('openImageProperties.imageproperties', (image) => {
31633
- this.state.image = image;
31350
+ self.state.sourceImage = image;
31351
+ this.state.image = image.cloneNode(true);
31634
31352
  this.open();
31635
31353
  });
31636
31354
  }
31355
+ async onStateValuesImageSrcChange() {
31356
+ const { image, values } = this.state;
31357
+ if (!image.src) {
31358
+ return;
31359
+ }
31360
+ try {
31361
+ this.__lock();
31362
+ await image.decode();
31363
+ if (this.state.sizeIsLocked && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isNumeric)(values.imageWidth)) {
31364
+ const w = parseFloat(values.imageWidth.toString());
31365
+ values.imageHeight = Math.round(w / this.state.ratio);
31366
+ }
31367
+ this.j.e.fire('updateImageProperties.imageproperties', image);
31368
+ }
31369
+ catch (e) {
31370
+ this.j.alert(e.message);
31371
+ }
31372
+ finally {
31373
+ this.__unlock();
31374
+ }
31375
+ }
31637
31376
  /** @override */
31638
31377
  beforeDestruct(editor) {
31639
- this.dialog && this.dialog.destruct();
31378
+ var _a, _b, _c;
31379
+ Object.values((_a = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, '__buttons')) !== null && _a !== void 0 ? _a : {}).forEach(b => b.destruct());
31380
+ (_b = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, 'dialog')) === null || _b === void 0 ? void 0 : _b.destruct();
31381
+ (_c = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, 'form')) === null || _c === void 0 ? void 0 : _c.destruct();
31640
31382
  editor.e.off(editor.editor, '.imageproperties').off('.imageproperties');
31641
31383
  }
31642
31384
  }
31643
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31644
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.marginIsLocked')
31645
- ], imageProperties.prototype, "onChangeMarginIsLocked", null);
31646
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31647
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.sizeIsLocked')
31648
- ], imageProperties.prototype, "onChangeSizeIsLocked", null);
31649
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31650
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31651
- ], imageProperties.prototype, "onApply", null);
31652
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31653
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31654
- ], imageProperties.prototype, "openImageEditor", null);
31655
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31656
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31657
- ], imageProperties.prototype, "openImagePopup", null);
31658
- jodit_core_global__WEBPACK_IMPORTED_MODULE_1__/* .pluginSystem */ .fg.add('imageProperties', imageProperties);
31385
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31386
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
31387
+ ], imageProperties.prototype, "form", null);
31388
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31389
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
31390
+ ], imageProperties.prototype, "dialog", null);
31391
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31392
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
31393
+ ], imageProperties.prototype, "__buttons", null);
31394
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
31395
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.image')
31396
+ ], imageProperties.prototype, "onStateValuesImageSrcChange", null);
31397
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .pluginSystem */ .fg.add('imageProperties', imageProperties);
31659
31398
 
31660
31399
 
31661
31400
  /***/ }),
31662
31401
 
31663
- /***/ 22254:
31402
+ /***/ 74260:
31664
31403
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31665
31404
 
31666
31405
  "use strict";
31667
31406
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31668
- /* harmony export */ Z: function() { return /* binding */ form; }
31407
+ /* harmony export */ g: function() { return /* binding */ readAlign; }
31669
31408
  /* harmony export */ });
31670
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31409
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38322);
31410
+ /*!
31411
+ * Jodit Editor (https://xdsoft.net/jodit/)
31412
+ * Released under MIT see LICENSE.txt in the project root for license information.
31413
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31414
+ */
31415
+
31416
+ /** @private */
31417
+ function readAlign(image, values) {
31418
+ // Align
31419
+ if (image.style.cssFloat &&
31420
+ ['left', 'right'].indexOf(image.style.cssFloat.toLowerCase()) !== -1) {
31421
+ values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__/* .css */ .A)(image, 'float');
31422
+ }
31423
+ else {
31424
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__/* .css */ .A)(image, 'display') === 'block' &&
31425
+ image.style.marginLeft === 'auto' &&
31426
+ image.style.marginRight === 'auto') {
31427
+ values.align = 'center';
31428
+ }
31429
+ else {
31430
+ values.align = '';
31431
+ }
31432
+ }
31433
+ }
31434
+
31435
+
31436
+ /***/ }),
31437
+
31438
+ /***/ 5549:
31439
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31440
+
31441
+ "use strict";
31442
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31443
+ /* harmony export */ U: function() { return /* binding */ readValuesFromImage; }
31444
+ /* harmony export */ });
31445
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
31446
+ /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74260);
31447
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
31448
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(85079);
31449
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17880);
31450
+ /*!
31451
+ * Jodit Editor (https://xdsoft.net/jodit/)
31452
+ * Released under MIT see LICENSE.txt in the project root for license information.
31453
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31454
+ */
31455
+
31456
+
31457
+
31458
+
31459
+
31460
+ /**
31461
+ * Read values from image and set it to state
31462
+ * @private
31463
+ */
31464
+ async function readValuesFromImage(j, state) {
31465
+ const { sourceImage: image, values } = state;
31466
+ (0,_align__WEBPACK_IMPORTED_MODULE_3__/* .readAlign */ .g)(image, values);
31467
+ // Border radius
31468
+ values.borderRadius = parseInt(image.style.borderRadius || '0', 10) || 0;
31469
+ // Id
31470
+ values.id = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'id') || '';
31471
+ // Title
31472
+ values.imageTitle = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'title') || '';
31473
+ // Alt
31474
+ values.imageAlt = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'alt') || '';
31475
+ // Style
31476
+ values.style = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'style') || '';
31477
+ // Classes
31478
+ values.classes = ((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
31479
+ // Margins
31480
+ (0,_margin__WEBPACK_IMPORTED_MODULE_4__/* .readMargins */ .E)(image, values, state);
31481
+ // Link
31482
+ (0,_link__WEBPACK_IMPORTED_MODULE_1__/* .readLink */ .X)(state, j, values);
31483
+ // Src
31484
+ values.imageSrc = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'src') || '';
31485
+ // Image size
31486
+ return (0,_size__WEBPACK_IMPORTED_MODULE_2__/* .readSizes */ .P)(image, values, state);
31487
+ }
31488
+
31489
+
31490
+ /***/ }),
31491
+
31492
+ /***/ 33201:
31493
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31494
+
31495
+ "use strict";
31496
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31497
+ /* harmony export */ X: function() { return /* binding */ readLink; }
31498
+ /* harmony export */ });
31499
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
31500
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26150);
31501
+ /*!
31502
+ * Jodit Editor (https://xdsoft.net/jodit/)
31503
+ * Released under MIT see LICENSE.txt in the project root for license information.
31504
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31505
+ */
31506
+
31507
+
31508
+ /** @private */
31509
+ function readLink(state, j, values) {
31510
+ const a = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.closest(state.sourceImage, 'a', j.editor);
31511
+ if (a) {
31512
+ values.imageLink = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(a, 'href') || '';
31513
+ values.imageLinkOpenInNewTab = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(a, 'target') === '_blank';
31514
+ }
31515
+ else {
31516
+ values.imageLink = '';
31517
+ values.imageLinkOpenInNewTab = false;
31518
+ }
31519
+ }
31520
+
31521
+
31522
+ /***/ }),
31523
+
31524
+ /***/ 85079:
31525
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31526
+
31527
+ "use strict";
31528
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31529
+ /* harmony export */ E: function() { return /* binding */ readMargins; }
31530
+ /* harmony export */ });
31531
+ /* harmony import */ var jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(449);
31671
31532
  /*!
31672
31533
  * Jodit Editor (https://xdsoft.net/jodit/)
31673
31534
  * Released under MIT see LICENSE.txt in the project root for license information.
31674
31535
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31675
31536
  */
31676
31537
 
31677
- function form(editor) {
31678
- 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);
31679
- return editor.c.fromHTML(`<form class="jodit-properties">
31538
+ /** @private */
31539
+ function readMargins(image, values, state) {
31540
+ // Margins
31541
+ let equal = true, wasEmptyField = false;
31542
+ ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(id => {
31543
+ let value = image.style.getPropertyValue((0,jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_0__/* .kebabCase */ .k)(id));
31544
+ if (!value) {
31545
+ wasEmptyField = true;
31546
+ values[id] = 0;
31547
+ return;
31548
+ }
31549
+ if (/^[0-9]+(px)?$/.test(value)) {
31550
+ value = parseInt(value, 10);
31551
+ }
31552
+ values[id] = value;
31553
+ if ((wasEmptyField && values[id]) ||
31554
+ (equal && id !== 'marginTop' && values[id] !== values.marginTop)) {
31555
+ equal = false;
31556
+ }
31557
+ });
31558
+ state.marginIsLocked = equal;
31559
+ }
31560
+
31561
+
31562
+ /***/ }),
31563
+
31564
+ /***/ 17880:
31565
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31566
+
31567
+ "use strict";
31568
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31569
+ /* harmony export */ P: function() { return /* binding */ readSizes; }
31570
+ /* harmony export */ });
31571
+ /* harmony import */ var jodit_core_helpers_checker_is_numeric__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12461);
31572
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
31573
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38322);
31574
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9645);
31575
+ /*!
31576
+ * Jodit Editor (https://xdsoft.net/jodit/)
31577
+ * Released under MIT see LICENSE.txt in the project root for license information.
31578
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31579
+ */
31580
+
31581
+
31582
+
31583
+
31584
+ /** @private */
31585
+ async function readSizes(image, values, state) {
31586
+ await image.decode();
31587
+ 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;
31588
+ 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;
31589
+ values.imageWidth =
31590
+ width !== false
31591
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeFromString */ .G)(width)
31592
+ : image.offsetWidth || image.naturalWidth;
31593
+ values.imageHeight =
31594
+ height !== false
31595
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeFromString */ .G)(height)
31596
+ : image.offsetHeight || image.naturalHeight;
31597
+ const { imageWidth, imageHeight } = values;
31598
+ const w = parseFloat(imageWidth.toString());
31599
+ 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)) {
31600
+ state.sizeIsLocked = false;
31601
+ return;
31602
+ }
31603
+ if (height === false) {
31604
+ values.imageHeight = Math.round(w / state.ratio);
31605
+ state.sizeIsLocked = true;
31606
+ return;
31607
+ }
31608
+ const h = parseFloat(imageHeight.toString());
31609
+ state.sizeIsLocked = Math.abs(w - h * state.ratio) < 1;
31610
+ }
31611
+
31612
+
31613
+ /***/ }),
31614
+
31615
+ /***/ 31970:
31616
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31617
+
31618
+ "use strict";
31619
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31620
+ /* harmony export */ l: function() { return /* binding */ UIImagePropertiesForm; }
31621
+ /* harmony export */ });
31622
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635);
31623
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22664);
31624
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(24767);
31625
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65147);
31626
+ /* harmony import */ var jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6455);
31627
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(931);
31628
+ /* harmony import */ var jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16116);
31629
+ /* harmony import */ var _ui_image_main_tab__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33403);
31630
+ /* harmony import */ var _ui_image_position_tab__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46681);
31631
+ /*!
31632
+ * Jodit Editor (https://xdsoft.net/jodit/)
31633
+ * Released under MIT see LICENSE.txt in the project root for license information.
31634
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31635
+ */
31636
+
31637
+
31638
+
31639
+
31640
+
31641
+
31642
+
31643
+
31644
+
31645
+
31646
+ /** @private */
31647
+ let UIImagePropertiesForm = class UIImagePropertiesForm extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_2__/* .UIGroup */ .U {
31648
+ className() {
31649
+ return 'UIImagePropertiesForm';
31650
+ }
31651
+ appendChildToContainer() { }
31652
+ getElm(elementName) {
31653
+ const selfElm = super.getElm(elementName);
31654
+ if (selfElm) {
31655
+ return selfElm;
31656
+ }
31657
+ for (const child of this.elements) {
31658
+ const elm = child.getElm(elementName);
31659
+ if (elm) {
31660
+ return elm;
31661
+ }
31662
+ }
31663
+ return null;
31664
+ }
31665
+ constructor(jodit, state, activeTabState, handlers) {
31666
+ super(jodit);
31667
+ this.state = state;
31668
+ this.handlers = handlers;
31669
+ this.__mainTab = new _ui_image_main_tab__WEBPACK_IMPORTED_MODULE_5__/* .UIImageMainTab */ .k(this.jodit, this.state, this.handlers);
31670
+ this.__positionTab = new _ui_image_position_tab__WEBPACK_IMPORTED_MODULE_6__/* .UIImagePositionTab */ ._(this.jodit, this.state, this.handlers);
31671
+ this.getElm('tabsBox').appendChild((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__/* .TabsWidget */ .Zg)(jodit, [
31672
+ { name: 'Image', content: this.__mainTab },
31673
+ { name: 'Advanced', content: this.__positionTab }
31674
+ ], activeTabState));
31675
+ this.setMod('lock-size', this.state.sizeIsLocked);
31676
+ this.append(this.__mainTab).append(this.__positionTab);
31677
+ }
31678
+ render() {
31679
+ return `<form>
31680
31680
  <div class="jodit-grid jodit-grid_xs-column">
31681
31681
  <div class="jodit_col-lg-2-5 jodit_col-xs-5-5">
31682
- <div class="jodit-properties_view_box">
31683
- <div style="${!showPreview ? 'display:none' : ''}" class="jodit-properties_image_view">
31684
- <img data-ref="imageViewSrc" src="" alt=""/>
31682
+ <div class="&__view-box">
31683
+ <div class="&__imageView">
31684
+ <img class="&__imageViewSrc" src="" alt=""/>
31685
31685
  </div>
31686
- <div style="${!editSize ? 'display:none' : ''}" class="jodit-form__group jodit-properties_image_sizes">
31687
- <input data-ref="imageWidth" type="text" class="jodit-input"/>
31688
- <a data-ref="lockSize" class="jodit-properties__lock">${gi('lock')}</a>
31689
- <input data-ref="imageHeight" type="text" class="imageHeight jodit-input"/>
31686
+ <div class="jodit-form__group &__imageSizes">
31687
+ <input type="text" class="jodit-input &__imageWidth"/>
31688
+ <a class="&__lockSize">${jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__/* .Icon */ .I.get('lock')}</a>
31689
+ <input type="text" class="&__imageHeight jodit-input"/>
31690
31690
  </div>
31691
31691
  </div>
31692
31692
  </div>
31693
- <div data-ref="tabsBox" class="jodit_col-lg-3-5 jodit_col-xs-5-5"></div>
31693
+ <div class="jodit_col-lg-3-5 jodit_col-xs-5-5 &__tabsBox"></div>
31694
31694
  </div>
31695
- </form>`);
31696
- }
31695
+ </form>`;
31696
+ }
31697
+ onChangeSizeIsLocked() {
31698
+ const lockSize = this.getElm('lockSize');
31699
+ const imageWidth = this.getElm('imageWidth');
31700
+ lockSize.innerHTML = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__/* .Icon */ .I.get(this.state.sizeIsLocked ? 'lock' : 'unlock');
31701
+ this.setMod('lock-size', this.state.sizeIsLocked);
31702
+ this.j.e.fire(imageWidth, 'change');
31703
+ }
31704
+ onLockSizeClick() {
31705
+ this.state.sizeIsLocked = !this.state.sizeIsLocked;
31706
+ }
31707
+ onStateValuesSizeChange() {
31708
+ const imageWidth = this.getElm('imageWidth');
31709
+ const imageHeight = this.getElm('imageHeight');
31710
+ if (imageWidth !== this.j.od.activeElement) {
31711
+ imageWidth.value = this.state.values.imageWidth.toString();
31712
+ }
31713
+ if (imageHeight !== this.j.od.activeElement) {
31714
+ imageHeight.value = this.state.values.imageHeight.toString();
31715
+ }
31716
+ }
31717
+ onImageWidthChange(e) {
31718
+ const imageWidth = this.getElm('imageWidth');
31719
+ const imageHeight = this.getElm('imageHeight');
31720
+ if (!this.state.sizeIsLocked ||
31721
+ !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isNumeric)(imageWidth.value) ||
31722
+ !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isNumeric)(imageHeight.value)) {
31723
+ this.state.values.imageWidth = imageWidth.value;
31724
+ this.state.values.imageHeight = imageHeight.value;
31725
+ return;
31726
+ }
31727
+ const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
31728
+ if (e.target === imageWidth) {
31729
+ this.state.values.imageWidth = w;
31730
+ this.state.values.imageHeight = Math.round(w / this.state.ratio);
31731
+ }
31732
+ else {
31733
+ this.state.values.imageWidth = Math.round(h * this.state.ratio);
31734
+ this.state.values.imageHeight = h;
31735
+ }
31736
+ }
31737
+ onStateValuesImageSrcChange() {
31738
+ const { imageSrc } = this.state.values;
31739
+ if (!imageSrc) {
31740
+ return;
31741
+ }
31742
+ const imageViewSrc = this.getElm('imageViewSrc');
31743
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(imageViewSrc, 'src', imageSrc);
31744
+ const image = new Image();
31745
+ image.src = imageSrc;
31746
+ this.state.image = image;
31747
+ }
31748
+ hideFieldByOptions() {
31749
+ const opt = this.j.o.image;
31750
+ [
31751
+ ['editSize', 'imageSizes'],
31752
+ ['showPreview', 'imageView']
31753
+ ].forEach(([optKey, elmKey]) => {
31754
+ const elm = this.getElm(elmKey);
31755
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.css)(elm, 'display', opt[optKey] ? null : 'none');
31756
+ });
31757
+ }
31758
+ };
31759
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31760
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31761
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.sizeIsLocked')
31762
+ ], UIImagePropertiesForm.prototype, "onChangeSizeIsLocked", null);
31763
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31764
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('lockSize:click')
31765
+ ], UIImagePropertiesForm.prototype, "onLockSizeClick", null);
31766
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31767
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31768
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)(['state.values.imageWidth', 'state.values.imageHeight'])
31769
+ ], UIImagePropertiesForm.prototype, "onStateValuesSizeChange", null);
31770
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31771
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([
31772
+ 'imageWidth:change',
31773
+ 'imageHeight:change',
31774
+ 'imageWidth:keydown',
31775
+ 'imageHeight:keydown',
31776
+ 'imageWidth:mousedown',
31777
+ 'imageHeight:mousedown',
31778
+ 'imageWidth:paste',
31779
+ 'imageHeight:paste'
31780
+ ]),
31781
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.debounce)()
31782
+ ], UIImagePropertiesForm.prototype, "onImageWidthChange", null);
31783
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31784
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31785
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.values.imageSrc')
31786
+ ], UIImagePropertiesForm.prototype, "onStateValuesImageSrcChange", null);
31787
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31788
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready')
31789
+ ], UIImagePropertiesForm.prototype, "hideFieldByOptions", null);
31790
+ UIImagePropertiesForm = (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31791
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__/* .component */ .s
31792
+ ], UIImagePropertiesForm);
31793
+
31697
31794
 
31698
31795
 
31699
31796
  /***/ }),
31700
31797
 
31701
- /***/ 75263:
31798
+ /***/ 33403:
31702
31799
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31703
31800
 
31704
31801
  "use strict";
31705
31802
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31706
- /* harmony export */ J: function() { return /* binding */ mainTab; }
31803
+ /* harmony export */ k: function() { return /* binding */ UIImageMainTab; }
31707
31804
  /* harmony export */ });
31708
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31805
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31635);
31806
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24767);
31807
+ /* harmony import */ var jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71151);
31808
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
31809
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31810
+ /* harmony import */ var jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6455);
31709
31811
  /*!
31710
31812
  * Jodit Editor (https://xdsoft.net/jodit/)
31711
31813
  * Released under MIT see LICENSE.txt in the project root for license information.
31712
31814
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31713
31815
  */
31714
31816
 
31715
- function mainTab(editor) {
31716
- 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;
31717
- return editor.c.fromHTML(`<div style="${!opt.image.editSrc ? 'display:none' : ''}" class="jodit-form__group">
31718
- <label>${i18n('Src')}</label>
31817
+
31818
+
31819
+
31820
+
31821
+
31822
+ /** @private */
31823
+ let UIImageMainTab = class UIImageMainTab extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__/* .UIGroup */ .U {
31824
+ className() {
31825
+ return 'UIImageMainTab';
31826
+ }
31827
+ appendChildToContainer() {
31828
+ // Do nothing
31829
+ }
31830
+ constructor(view, state, handlers) {
31831
+ super(view);
31832
+ this.state = state;
31833
+ this.handlers = handlers;
31834
+ }
31835
+ render() {
31836
+ return `<div class="jodit-form__group &__editSrc">
31837
+ <label>~Src~</label>
31719
31838
  <div class="jodit-input_group">
31720
- <input data-ref="imageSrc" class="jodit-input" type="text"/>
31721
- <div
31722
- class="jodit-input_group-buttons"
31723
- style="${hasFbUrl ? '' : 'display: none'}"
31724
- >
31725
- <a
31726
- data-ref="changeImage"
31727
- class="jodit-button"
31728
- >${gi('image')}</a>
31729
- <a
31730
- data-ref="editImage"
31731
- class="jodit-button"
31732
- style="${hasEditor ? '' : 'display: none'}"
31733
- >${gi('crop')}</a>
31839
+ <input class="jodit-input &__imageSrc" type="text"/>
31840
+ <div class="jodit-input_group-buttons &__fixImage">
31841
+ <a class="jodit-button &__changeImage">*image*</a>
31842
+ <a class="jodit-button &__editImage">*crop*</a>
31734
31843
  </div>
31735
31844
  </div>
31736
31845
  </div>
31737
- <div style="${!opt.image.editTitle ? 'display:none' : ''}" class="jodit-form__group">
31738
- <label>${i18n('Title')}</label>
31739
- <input data-ref="imageTitle" type="text" class="jodit-input"/>
31846
+ <div class="jodit-form__group &__editTitle">
31847
+ <label>~Title~</label>
31848
+ <input type="text" class="jodit-input &__imageTitle"/>
31740
31849
  </div>
31741
- <div style="${!opt.image.editAlt ? 'display:none' : ''}" class="jodit-form__group">
31742
- <label>${i18n('Alternative')}</label>
31743
- <input data-ref="imageAlt" type="text" class="jodit-input"/>
31850
+ <div class="jodit-form__group &__editAlt">
31851
+ <label>~Alternative~</label>
31852
+ <input type="text" class="jodit-input &__imageAlt"/>
31744
31853
  </div>
31745
- <div style="${!opt.image.editLink ? 'display:none' : ''}" class="jodit-form__group">
31746
- <label>${i18n('Link')}</label>
31747
- <input data-ref="imageLink" type="text" class="jodit-input"/>
31854
+ <div class="jodit-form__group &__editLink">
31855
+ <label>~Link~</label>
31856
+ <input type="text" class="jodit-input &__imageLink"/>
31748
31857
  </div>
31749
- <div style="${!opt.image.editLink ? 'display:none' : ''}" class="jodit-form__group">
31858
+ <div class="jodit-form__group &__editLinkTarget">
31750
31859
  <label class="jodit_vertical_middle">
31751
- <input data-ref="imageLinkOpenInNewTab" type="checkbox" class="jodit-checkbox"/>
31752
- <span>${i18n('Open link in new tab')}</span>
31860
+ <input type="checkbox" class="jodit-checkbox &__imageLinkOpenInNewTab"/>
31861
+ <span>~Open link in new tab~</span>
31753
31862
  </label>
31754
- </div>`);
31755
- }
31863
+ </div>`;
31864
+ }
31865
+ async onStateImageSrcChange() {
31866
+ const imageSrc = this.getElm('imageSrc');
31867
+ imageSrc.value = this.state.values.imageSrc;
31868
+ }
31869
+ onImageSrcChange() {
31870
+ this.state.values.imageSrc = this.getElm('imageSrc').value;
31871
+ }
31872
+ /**
31873
+ * Open image editor
31874
+ */
31875
+ onEditImageClick(e) {
31876
+ this.handlers.openImageEditor();
31877
+ e.stopPropagation();
31878
+ }
31879
+ /**
31880
+ * Open popup with filebrowser/uploader buttons for image
31881
+ */
31882
+ onChangeImageClick(e) {
31883
+ this.handlers.openImagePopup(this.getElm('changeImage'));
31884
+ e.stopPropagation();
31885
+ }
31886
+ onStateTitleChange() {
31887
+ const title = this.getElm('imageTitle');
31888
+ title.value = this.state.values.imageTitle;
31889
+ }
31890
+ onTitleChange() {
31891
+ this.state.values.imageTitle = this.getElm('imageTitle').value;
31892
+ }
31893
+ onStateAltChange() {
31894
+ const alt = this.getElm('imageAlt');
31895
+ alt.value = this.state.values.imageAlt;
31896
+ }
31897
+ onAltChange() {
31898
+ this.state.values.imageAlt = this.getElm('imageAlt').value;
31899
+ }
31900
+ onStateImageLinkChange() {
31901
+ const imageLink = this.getElm('imageLink');
31902
+ imageLink.value = this.state.values.imageLink;
31903
+ }
31904
+ onImageLinkChange() {
31905
+ this.state.values.imageLink = this.getElm('imageLink').value;
31906
+ }
31907
+ onStateImageLinkOpenInNewTabChange() {
31908
+ const imageLinkOpenInNewTab = this.getElm('imageLinkOpenInNewTab');
31909
+ imageLinkOpenInNewTab.checked = this.state.values.imageLinkOpenInNewTab;
31910
+ }
31911
+ onImageLinkOpenInNewTabChange() {
31912
+ this.state.values.imageLinkOpenInNewTab = this.getElm('imageLinkOpenInNewTab').checked;
31913
+ }
31914
+ hideFieldByOptions() {
31915
+ const o = this.j.o;
31916
+ const opt = o.image;
31917
+ [
31918
+ ['editSrc', 'editSrc'],
31919
+ ['editTitle', 'editTitle'],
31920
+ ['editAlt', 'editAlt'],
31921
+ ['editLink', 'editLink'],
31922
+ ['editLink', 'editLinkTarget'],
31923
+ ['useImageEditor', 'editImage']
31924
+ ].forEach(([optKey, elmKey]) => {
31925
+ const elm = this.getElm(elmKey);
31926
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display', opt[optKey] ? null : 'none');
31927
+ });
31928
+ const changeImage = this.getElm('changeImage');
31929
+ const needShowChangeImage = Boolean(o.filebrowser.ajax.url || o.uploader.url);
31930
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(changeImage, 'display', needShowChangeImage ? null : 'none');
31931
+ const editImage = this.getElm('editImage');
31932
+ const needShowEditImage = Boolean(o.filebrowser.ajax.url) && opt.useImageEditor;
31933
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(editImage, 'display', needShowEditImage ? null : 'none');
31934
+ const fixImage = this.getElm('fixImage');
31935
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(fixImage, 'display', needShowChangeImage || needShowEditImage ? null : 'none');
31936
+ }
31937
+ };
31938
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31939
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageSrc')
31940
+ ], UIImageMainTab.prototype, "onStateImageSrcChange", null);
31941
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31942
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageSrc:change')
31943
+ ], UIImageMainTab.prototype, "onImageSrcChange", null);
31944
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31945
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('editImage:click')
31946
+ ], UIImageMainTab.prototype, "onEditImageClick", null);
31947
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31948
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('changeImage:click')
31949
+ ], UIImageMainTab.prototype, "onChangeImageClick", null);
31950
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31951
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageTitle')
31952
+ ], UIImageMainTab.prototype, "onStateTitleChange", null);
31953
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31954
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageTitle:change')
31955
+ ], UIImageMainTab.prototype, "onTitleChange", null);
31956
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31957
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageAlt')
31958
+ ], UIImageMainTab.prototype, "onStateAltChange", null);
31959
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31960
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageAlt:change')
31961
+ ], UIImageMainTab.prototype, "onAltChange", null);
31962
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31963
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageLink')
31964
+ ], UIImageMainTab.prototype, "onStateImageLinkChange", null);
31965
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31966
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageLink:change')
31967
+ ], UIImageMainTab.prototype, "onImageLinkChange", null);
31968
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31969
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageLinkOpenInNewTab')
31970
+ ], UIImageMainTab.prototype, "onStateImageLinkOpenInNewTabChange", null);
31971
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31972
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageLinkOpenInNewTab:change')
31973
+ ], UIImageMainTab.prototype, "onImageLinkOpenInNewTabChange", null);
31974
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31975
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready')
31976
+ ], UIImageMainTab.prototype, "hideFieldByOptions", null);
31977
+ UIImageMainTab = (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31978
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_5__/* .component */ .s
31979
+ ], UIImageMainTab);
31980
+
31756
31981
 
31757
31982
 
31758
31983
  /***/ }),
31759
31984
 
31760
- /***/ 57837:
31985
+ /***/ 46681:
31761
31986
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31762
31987
 
31763
31988
  "use strict";
31764
31989
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31765
- /* harmony export */ b: function() { return /* binding */ positionTab; }
31990
+ /* harmony export */ _: function() { return /* binding */ UIImagePositionTab; }
31766
31991
  /* harmony export */ });
31767
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31992
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(31635);
31993
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(24767);
31994
+ /* harmony import */ var jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71151);
31995
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
31996
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31997
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(98253);
31998
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26150);
31999
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29780);
32000
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(931);
32001
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9645);
31768
32002
  /*!
31769
32003
  * Jodit Editor (https://xdsoft.net/jodit/)
31770
32004
  * Released under MIT see LICENSE.txt in the project root for license information.
31771
32005
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31772
32006
  */
31773
32007
 
31774
- function positionTab(editor) {
31775
- 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);
31776
- const classInput = [];
31777
- if (opt.image.availableClasses.length > 0) {
31778
- classInput.push('<select data-ref="classes" class="jodit-input jodit-select">');
31779
- opt.image.availableClasses.forEach(item => {
31780
- if (typeof item === 'string') {
31781
- classInput.push(`<option value="${item}">${item}</option>`);
31782
- }
31783
- else {
31784
- classInput.push(`<option value="${item[0]}">${item[1]}</option>`);
31785
- }
31786
- });
31787
- classInput.push('</select>');
32008
+
32009
+
32010
+
32011
+
32012
+
32013
+
32014
+
32015
+
32016
+
32017
+ /** @private */
32018
+ let UIImagePositionTab = class UIImagePositionTab extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_4__/* .UIElement */ .D {
32019
+ className() {
32020
+ return 'UIImagePositionTab';
31788
32021
  }
31789
- else {
31790
- classInput.push('<input data-ref="classes" type="text" class="jodit-input"/>');
32022
+ constructor(jodit, state, handlers) {
32023
+ super(jodit, {
32024
+ availableClasses: jodit.o.image.availableClasses
32025
+ });
32026
+ this.state = state;
32027
+ this.handlers = handlers;
31791
32028
  }
31792
- return editor.c.fromHTML(`<div style="${!opt.image.editMargins ? 'display:none' : ''}" class="jodit-form__group">
31793
- <label>${i18n('Margins')}</label>
32029
+ render({ availableClasses }) {
32030
+ return `<div class="jodit-form__group &__editMargins">
32031
+ <label>~Margins~</label>
31794
32032
  <div class="jodit-grid jodit_vertical_middle">
31795
- <input class="jodit_col-lg-1-5 jodit-input" data-ref="marginTop" type="text" placeholder="${i18n('top')}"/>
31796
- <a style="text-align: center;" data-ref="lockMargin" class="jodit-properties__lock jodit_col-lg-1-5">${gi('lock')}</a>
31797
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginRight" type="text" placeholder="${i18n('right')}"/>
31798
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginBottom" type="text" placeholder="${i18n('bottom')}"/>
31799
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginLeft" type="text" placeholder="${i18n('left')}"/>
32033
+ <input class="jodit_col-lg-1-5 jodit-input &__marginTop" type="text" placeholder="~top~"/>
32034
+ <a style="text-align: center;" class="jodit-properties__lock jodit_col-lg-1-5 &__lockMargin">*lock*</a>
32035
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginRight" type="text" placeholder="~right~"/>
32036
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginBottom" type="text" placeholder="~bottom~"/>
32037
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginLeft" type="text" placeholder="~left~"/>
31800
32038
  </div>
31801
32039
  </div>
31802
- <div
31803
- style="${!opt.image.editAlign ? 'display:none' : ''}"
31804
- class="jodit-form__group"
31805
- >
31806
- <label>${i18n('Align')}</label>
31807
- <select data-ref="align" class="jodit-select">
31808
- <option value="">${i18n('--Not Set--')}</option>
31809
- <option value="left">${i18n('Left')}</option>
31810
- <option value="center">${i18n('Center')}</option>
31811
- <option value="right">${i18n('Right')}</option>
32040
+ <div class="jodit-form__group &__editAlign">
32041
+ <label>~Align~</label>
32042
+ <select class="jodit-select &__align">
32043
+ <option value="">~--Not Set--~</option>
32044
+ <option value="left">~Left~</option>
32045
+ <option value="center">~Center~</option>
32046
+ <option value="right">~Right~</option>
31812
32047
  </select>
31813
32048
  </div>
31814
- <div style="${!opt.image.editStyle ? 'display:none' : ''}" class="jodit-form__group">
31815
- <label>${i18n('Styles')}</label>
31816
- <input data-ref="style" type="text" class="jodit-input"/>
32049
+ <div class="jodit-form__group &__editStyle">
32050
+ <label>~Styles~</label>
32051
+ <input type="text" class="jodit-input &__style"/>
31817
32052
  </div>
31818
- <div style="${!opt.image.editClass ? 'display:none' : ''}" class="jodit-form__group">
31819
- <label>${i18n('Classes')}</label>
31820
- ${classInput.join('')}
32053
+ <div class="jodit-form__group &__editClass">
32054
+ <label>~Classes~</label>
32055
+ ${(() => {
32056
+ const classInput = [];
32057
+ if (availableClasses && availableClasses.length > 0) {
32058
+ classInput.push('<select class="jodit-input jodit-select &__classes">');
32059
+ availableClasses.forEach(item => {
32060
+ if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__/* .isString */ .K)(item)) {
32061
+ classInput.push(`<option value="${item}">${item}</option>`);
32062
+ }
32063
+ else {
32064
+ classInput.push(`<option value="${item[0]}">${item[1]}</option>`);
32065
+ }
32066
+ });
32067
+ classInput.push('</select>');
32068
+ }
32069
+ else {
32070
+ classInput.push('<input type="text" class="jodit-input &__classes"/>');
32071
+ }
32072
+ return classInput.join('');
32073
+ })()}
31821
32074
  </div>
31822
- <div style="${!opt.image.editId ? 'display:none' : ''}" class="jodit-form__group">
32075
+ <div class="jodit-form__group &__editId">
31823
32076
  <label>Id</label>
31824
- <input data-ref="id" type="text" class="jodit-input"/>
32077
+ <input type="text" class="jodit-input &__id"/>
31825
32078
  </div>
31826
32079
  <div
31827
- style="${!opt.image.editBorderRadius ? 'display:none' : ''}"
31828
- class="jodit-form__group"
32080
+ class="jodit-form__group &__editBorderRadius"
31829
32081
  >
31830
- <label>${i18n('Border radius')}</label>
31831
- <input data-ref="borderRadius" type="number" class="jodit-input"/>
31832
- </div>`);
32082
+ <label>~Border radius~</label>
32083
+ <input type="number" class="jodit-input &__borderRadius"/>
32084
+ </div>`;
32085
+ }
32086
+ onStateAlignChange() {
32087
+ const align = this.getElm('align');
32088
+ align.value = this.state.values.align;
32089
+ }
32090
+ onChangeAlign() {
32091
+ const align = this.getElm('align');
32092
+ this.state.values.align = align.value;
32093
+ }
32094
+ onStateValuesBorderRadiusChange() {
32095
+ const borderRadius = this.getElm('borderRadius');
32096
+ borderRadius.value = this.state.values.borderRadius.toString();
32097
+ }
32098
+ onChangeBorderRadius() {
32099
+ const borderRadius = this.getElm('borderRadius');
32100
+ this.state.values.borderRadius = parseFloat(borderRadius.value);
32101
+ }
32102
+ onStateValuesIdChange() {
32103
+ const id = this.getElm('id');
32104
+ id.value = this.state.values.id;
32105
+ }
32106
+ onChangeId() {
32107
+ const id = this.getElm('id');
32108
+ this.state.values.id = id.value;
32109
+ }
32110
+ onStateValuesStyleChange() {
32111
+ const style = this.getElm('style');
32112
+ style.value = this.state.values.style;
32113
+ }
32114
+ onChangeStyle() {
32115
+ const style = this.getElm('style');
32116
+ this.state.values.style = style.value;
32117
+ }
32118
+ onStateValuesClassesChange() {
32119
+ const classes = this.getElm('classes');
32120
+ classes.value = this.state.values.classes;
32121
+ }
32122
+ onChangClasses() {
32123
+ const classes = this.getElm('classes');
32124
+ this.state.values.classes = classes.value;
32125
+ }
32126
+ onLockMarginClick(e) {
32127
+ this.state.marginIsLocked = !this.state.marginIsLocked;
32128
+ e.preventDefault();
32129
+ }
32130
+ onChangeMarginIsLocked() {
32131
+ const marginBottom = this.getElm('marginBottom');
32132
+ const marginRight = this.getElm('marginRight');
32133
+ const marginLeft = this.getElm('marginLeft');
32134
+ const lockMargin = this.getElm('lockMargin');
32135
+ [marginRight, marginBottom, marginLeft].forEach(elm => {
32136
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__/* .attr */ .C)(elm, 'disabled', this.state.marginIsLocked || null);
32137
+ });
32138
+ lockMargin.innerHTML = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__/* .Icon */ .I.get(this.state.marginIsLocked ? 'lock' : 'unlock');
32139
+ if (this.state.marginIsLocked) {
32140
+ const marginTop = this.state.values.marginTop;
32141
+ this.state.values.marginRight = marginTop;
32142
+ this.state.values.marginBottom = marginTop;
32143
+ this.state.values.marginLeft = marginTop;
32144
+ }
32145
+ }
32146
+ onStateValuesMarginChange() {
32147
+ const marginTop = this.getElm('marginTop');
32148
+ const marginRight = this.getElm('marginRight');
32149
+ const marginBottom = this.getElm('marginBottom');
32150
+ const marginLeft = this.getElm('marginLeft');
32151
+ marginTop.value = this.state.values.marginTop.toString();
32152
+ marginRight.value = this.state.values.marginRight.toString();
32153
+ marginBottom.value = this.state.values.marginBottom.toString();
32154
+ marginLeft.value = this.state.values.marginLeft.toString();
32155
+ }
32156
+ onChangeMargin() {
32157
+ const marginTop = this.getElm('marginTop');
32158
+ const marginRight = this.getElm('marginRight');
32159
+ const marginBottom = this.getElm('marginBottom');
32160
+ const marginLeft = this.getElm('marginLeft');
32161
+ this.state.values.marginTop = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginTop.value);
32162
+ if (this.state.marginIsLocked) {
32163
+ this.state.values.marginRight = this.state.values.marginTop;
32164
+ this.state.values.marginBottom = this.state.values.marginTop;
32165
+ this.state.values.marginLeft = this.state.values.marginTop;
32166
+ }
32167
+ else {
32168
+ this.state.values.marginRight = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginRight.value);
32169
+ this.state.values.marginBottom = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginBottom.value);
32170
+ this.state.values.marginLeft = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginLeft.value);
32171
+ }
32172
+ }
32173
+ hideFieldByOptions() {
32174
+ const opt = this.j.o.image;
32175
+ [
32176
+ ['editMargins', 'editMargins'],
32177
+ ['editAlign', 'editAlign'],
32178
+ ['editStyle', 'editStyle'],
32179
+ ['editClass', 'editClass'],
32180
+ ['editId', 'editId'],
32181
+ ['editBorderRadius', 'editBorderRadius']
32182
+ ].forEach(([optKey, elmKey]) => {
32183
+ const elm = this.getElm(elmKey);
32184
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display', opt[optKey] ? null : 'none');
32185
+ });
32186
+ }
32187
+ };
32188
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32189
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32190
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.align')
32191
+ ], UIImagePositionTab.prototype, "onStateAlignChange", null);
32192
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32193
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('align:change')
32194
+ ], UIImagePositionTab.prototype, "onChangeAlign", null);
32195
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32196
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32197
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.borderRadius')
32198
+ ], UIImagePositionTab.prototype, "onStateValuesBorderRadiusChange", null);
32199
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32200
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('borderRadius:change')
32201
+ ], UIImagePositionTab.prototype, "onChangeBorderRadius", null);
32202
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32203
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32204
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.id')
32205
+ ], UIImagePositionTab.prototype, "onStateValuesIdChange", null);
32206
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32207
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('id:change')
32208
+ ], UIImagePositionTab.prototype, "onChangeId", null);
32209
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32210
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32211
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.style')
32212
+ ], UIImagePositionTab.prototype, "onStateValuesStyleChange", null);
32213
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32214
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('style:change')
32215
+ ], UIImagePositionTab.prototype, "onChangeStyle", null);
32216
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32217
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32218
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.classes')
32219
+ ], UIImagePositionTab.prototype, "onStateValuesClassesChange", null);
32220
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32221
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('classes:change')
32222
+ ], UIImagePositionTab.prototype, "onChangClasses", null);
32223
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32224
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('lockMargin:click')
32225
+ ], UIImagePositionTab.prototype, "onLockMarginClick", null);
32226
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32227
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32228
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.marginIsLocked')
32229
+ ], UIImagePositionTab.prototype, "onChangeMarginIsLocked", null);
32230
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32231
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
32232
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)([
32233
+ 'state.values.marginTop',
32234
+ 'state.values.marginRight',
32235
+ 'state.values.marginBottom',
32236
+ 'state.values.marginLeft'
32237
+ ])
32238
+ ], UIImagePositionTab.prototype, "onStateValuesMarginChange", null);
32239
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32240
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)([
32241
+ 'marginTop:change',
32242
+ 'marginRight:change',
32243
+ 'marginBottom:change',
32244
+ 'marginLeft:change'
32245
+ ])
32246
+ ], UIImagePositionTab.prototype, "onChangeMargin", null);
32247
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32248
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready')
32249
+ ], UIImagePositionTab.prototype, "hideFieldByOptions", null);
32250
+ UIImagePositionTab = (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
32251
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_9__/* .component */ .s
32252
+ ], UIImagePositionTab);
32253
+
32254
+
32255
+
32256
+ /***/ }),
32257
+
32258
+ /***/ 80778:
32259
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32260
+
32261
+ "use strict";
32262
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32263
+ /* harmony export */ v: function() { return /* binding */ openImageEditorDialog; }
32264
+ /* harmony export */ });
32265
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(98253);
32266
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
32267
+ /* harmony import */ var jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53804);
32268
+ /*!
32269
+ * Jodit Editor (https://xdsoft.net/jodit/)
32270
+ * Released under MIT see LICENSE.txt in the project root for license information.
32271
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32272
+ */
32273
+
32274
+
32275
+
32276
+ /**
32277
+ * Open image editor dialog
32278
+ * @private
32279
+ */
32280
+ function openImageEditorDialog(j, state) {
32281
+ const url = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(state.image, 'src') || '', a = j.c.element('a'), loadExternal = () => {
32282
+ if (a.host !== location.host) {
32283
+ j.confirm('You can only edit your own images. Download this image on the host?', yes => {
32284
+ if (yes && j.uploader) {
32285
+ j.uploader.uploadRemoteImage(a.href.toString(), resp => {
32286
+ j.alert('The image has been successfully uploaded to the host!', () => {
32287
+ if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .K)(resp.newfilename)) {
32288
+ state.values.imageSrc =
32289
+ resp.baseurl +
32290
+ resp.newfilename;
32291
+ }
32292
+ });
32293
+ }, error => {
32294
+ j.alert('There was an error loading %s', error.message);
32295
+ });
32296
+ }
32297
+ });
32298
+ return;
32299
+ }
32300
+ };
32301
+ a.href = url;
32302
+ j.filebrowser.dataProvider
32303
+ .getPathByUrl(a.href.toString())
32304
+ .then(resp => {
32305
+ jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_1__/* .openImageEditor */ .B.call(j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
32306
+ const timestamp = new Date().getTime();
32307
+ state.values.imageSrc =
32308
+ url +
32309
+ (url.indexOf('?') !== -1 ? '' : '?') +
32310
+ '&_tmp=' +
32311
+ timestamp.toString();
32312
+ }, error => {
32313
+ j.alert(error.message);
32314
+ });
32315
+ })
32316
+ .catch(error => {
32317
+ j.alert(error.message, loadExternal);
32318
+ });
32319
+ }
32320
+
32321
+
32322
+ /***/ }),
32323
+
32324
+ /***/ 33733:
32325
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32326
+
32327
+ "use strict";
32328
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32329
+ /* harmony export */ q: function() { return /* binding */ openImagePopup; }
32330
+ /* harmony export */ });
32331
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(37923);
32332
+ /* harmony import */ var jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27594);
32333
+ /* harmony import */ var jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80071);
32334
+ /* harmony import */ var jodit_modules_widget_file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10067);
32335
+ /*!
32336
+ * Jodit Editor (https://xdsoft.net/jodit/)
32337
+ * Released under MIT see LICENSE.txt in the project root for license information.
32338
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32339
+ */
32340
+
32341
+
32342
+
32343
+
32344
+ /** @private */
32345
+ function openImagePopup(j, dialog, state, button) {
32346
+ const popup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_0__/* .Popup */ .z(dialog);
32347
+ const closePopup = () => {
32348
+ popup.close();
32349
+ popup.destruct();
32350
+ };
32351
+ popup
32352
+ .setContent((0,jodit_modules_widget_file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__/* .FileSelectorWidget */ .k)(j, {
32353
+ upload: (data) => {
32354
+ if (data.files && data.files.length) {
32355
+ state.values.imageSrc =
32356
+ data.baseurl + data.files[0];
32357
+ }
32358
+ closePopup();
32359
+ },
32360
+ filebrowser: async (data) => {
32361
+ if (data && (0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .c)(data.files) && data.files.length) {
32362
+ state.values.imageSrc = data.files[0];
32363
+ closePopup();
32364
+ }
32365
+ }
32366
+ }, state.image, closePopup))
32367
+ .open(() => (0,jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_3__/* .position */ .G)(button));
32368
+ }
32369
+
32370
+
32371
+ /***/ }),
32372
+
32373
+ /***/ 9645:
32374
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32375
+
32376
+ "use strict";
32377
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32378
+ /* harmony export */ G: function() { return /* binding */ normalSizeFromString; },
32379
+ /* harmony export */ n: function() { return /* binding */ normalSizeToString; }
32380
+ /* harmony export */ });
32381
+ /* harmony import */ var jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2461);
32382
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59101);
32383
+ /*!
32384
+ * Jodit Editor (https://xdsoft.net/jodit/)
32385
+ * Released under MIT see LICENSE.txt in the project root for license information.
32386
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32387
+ */
32388
+
32389
+
32390
+ /** @private */
32391
+ const normalSizeFromString = (value) => {
32392
+ return /^[-+]?[0-9.]+(px)?$/.test(value.toString())
32393
+ ? parseFloat(value.toString())
32394
+ : value;
32395
+ };
32396
+ /** @private */
32397
+ const normalSizeToString = (value) => {
32398
+ if ((0,jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_1__/* .isNumber */ .E)(value)) {
32399
+ return value ? value + 'px' : value.toString();
32400
+ }
32401
+ value = (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_0__/* .trim */ .Bq)(value);
32402
+ return /^[0-9]+$/.test(value) ? value + 'px' : value;
32403
+ };
32404
+
32405
+
32406
+ /***/ }),
32407
+
32408
+ /***/ 30393:
32409
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32410
+
32411
+ "use strict";
32412
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32413
+ /* harmony export */ j: function() { return /* binding */ applyValuesToImage; }
32414
+ /* harmony export */ });
32415
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
32416
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97369);
32417
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88269);
32418
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78139);
32419
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58972);
32420
+ /*!
32421
+ * Jodit Editor (https://xdsoft.net/jodit/)
32422
+ * Released under MIT see LICENSE.txt in the project root for license information.
32423
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32424
+ */
32425
+
32426
+
32427
+
32428
+
32429
+
32430
+ /**
32431
+ * Apply form's values to image
32432
+ * @private
32433
+ */
32434
+ function applyValuesToImage(j, state, image) {
32435
+ const { style, imageSrc, borderRadius, imageTitle, imageAlt, imageLink, imageWidth, imageHeight, marginTop, marginRight, marginBottom, marginLeft, imageLinkOpenInNewTab, align, classes, id } = state.values;
32436
+ const opt = j.o;
32437
+ // styles
32438
+ if (opt.image.editStyle) {
32439
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'style', style || null);
32440
+ }
32441
+ // Src
32442
+ if (imageSrc) {
32443
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'src', imageSrc);
32444
+ }
32445
+ else {
32446
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.safeRemove(image);
32447
+ return;
32448
+ }
32449
+ // Border radius
32450
+ image.style.borderRadius = borderRadius ? borderRadius + 'px' : '';
32451
+ // Title
32452
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'title', imageTitle || null);
32453
+ // Alt
32454
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'alt', imageAlt || null);
32455
+ // Link
32456
+ (0,_link__WEBPACK_IMPORTED_MODULE_2__/* .applyLink */ .j)(j, image, imageLink, imageLinkOpenInNewTab);
32457
+ // Size
32458
+ (0,_size__WEBPACK_IMPORTED_MODULE_4__/* .applySize */ .q)(image, imageWidth, imageHeight, state.sizeIsLocked);
32459
+ // Margin
32460
+ if (j.o.image.editMargins) {
32461
+ (0,_margin__WEBPACK_IMPORTED_MODULE_3__/* .applyMargin */ .N)(j, marginTop, marginRight, marginBottom, marginLeft, image, state.marginIsLocked);
32462
+ }
32463
+ if (opt.image.editClass) {
32464
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'class', classes || null);
32465
+ }
32466
+ if (opt.image.editId) {
32467
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
32468
+ }
32469
+ if (opt.image.editAlign) {
32470
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
32471
+ }
32472
+ }
32473
+
32474
+
32475
+ /***/ }),
32476
+
32477
+ /***/ 88269:
32478
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32479
+
32480
+ "use strict";
32481
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32482
+ /* harmony export */ j: function() { return /* binding */ applyLink; }
32483
+ /* harmony export */ });
32484
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
32485
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26150);
32486
+ /*!
32487
+ * Jodit Editor (https://xdsoft.net/jodit/)
32488
+ * Released under MIT see LICENSE.txt in the project root for license information.
32489
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32490
+ */
32491
+
32492
+
32493
+ /** @private */
32494
+ function applyLink(j, image, imageLink, imageLinkOpenInNewTab) {
32495
+ // Link
32496
+ let link = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.closest(image, 'a', j.editor);
32497
+ if (imageLink) {
32498
+ if (!link) {
32499
+ link = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.wrap(image, 'a', j.createInside);
32500
+ }
32501
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(link, 'href', imageLink);
32502
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(link, 'target', imageLinkOpenInNewTab ? '_blank' : null);
32503
+ }
32504
+ else {
32505
+ if (link && link.parentNode) {
32506
+ link.parentNode.replaceChild(image, link);
32507
+ }
32508
+ }
32509
+ }
32510
+
32511
+
32512
+ /***/ }),
32513
+
32514
+ /***/ 78139:
32515
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32516
+
32517
+ "use strict";
32518
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32519
+ /* harmony export */ N: function() { return /* binding */ applyMargin; }
32520
+ /* harmony export */ });
32521
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38322);
32522
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9645);
32523
+ /*!
32524
+ * Jodit Editor (https://xdsoft.net/jodit/)
32525
+ * Released under MIT see LICENSE.txt in the project root for license information.
32526
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32527
+ */
32528
+
32529
+
32530
+ /** @private */
32531
+ function applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, image, marginIsLocked) {
32532
+ const margins = [marginTop, marginRight, marginBottom, marginLeft];
32533
+ const applyMargin = (key, value) => {
32534
+ const oldValue = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__/* .css */ .A)(image, key);
32535
+ const v = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_0__/* .normalSizeToString */ .n)(value);
32536
+ if (oldValue.toString() !== v.toString()) {
32537
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__/* .css */ .A)(image, key, v);
32538
+ }
32539
+ };
32540
+ if (!marginIsLocked) {
32541
+ const sides = [
32542
+ 'margin-top',
32543
+ 'margin-right',
32544
+ 'margin-bottom',
32545
+ 'margin-left'
32546
+ ];
32547
+ margins.forEach((margin, index) => {
32548
+ const side = sides[index];
32549
+ applyMargin(side, margin);
32550
+ });
32551
+ }
32552
+ else {
32553
+ applyMargin('margin', marginTop);
32554
+ }
32555
+ }
32556
+
32557
+
32558
+ /***/ }),
32559
+
32560
+ /***/ 58972:
32561
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32562
+
32563
+ "use strict";
32564
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32565
+ /* harmony export */ q: function() { return /* binding */ applySize; }
32566
+ /* harmony export */ });
32567
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
32568
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38322);
32569
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9645);
32570
+ /*!
32571
+ * Jodit Editor (https://xdsoft.net/jodit/)
32572
+ * Released under MIT see LICENSE.txt in the project root for license information.
32573
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32574
+ */
32575
+
32576
+
32577
+
32578
+ /** @private */
32579
+ function applySize(image, imageWidth, imageHeight, sizeIsLocked) {
32580
+ // Size
32581
+ if (imageWidth !== image.offsetWidth ||
32582
+ imageHeight !== image.offsetHeight) {
32583
+ const updatedWidth = imageWidth ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeToString */ .n)(imageWidth) : null;
32584
+ let updatedHeight = imageHeight
32585
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeToString */ .n)(imageHeight)
32586
+ : null;
32587
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__/* .css */ .A)(image, {
32588
+ width: updatedWidth,
32589
+ height: updatedWidth && sizeIsLocked ? null : updatedHeight
32590
+ });
32591
+ (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);
32592
+ if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'width') || sizeIsLocked) {
32593
+ updatedHeight = null;
32594
+ }
32595
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'height', updatedHeight);
32596
+ }
31833
32597
  }
31834
32598
 
31835
32599
 
@@ -38202,7 +38966,8 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .pluginSystem */ .fg.add('selec
38202
38966
  */
38203
38967
 
38204
38968
  jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.select = {
38205
- normalizeSelectionBeforeCutAndCopy: false
38969
+ normalizeSelectionBeforeCutAndCopy: false,
38970
+ normalizeTripleClick: true
38206
38971
  };
38207
38972
 
38208
38973
 
@@ -38278,7 +39043,7 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38278
39043
  }
38279
39044
  }
38280
39045
  /**
38281
- * @event outsideClick(e) - when user clicked in the outside of editor
39046
+ * @event outsideClick(e) - when user clicked on the outside of editor
38282
39047
  */
38283
39048
  onOutsideClick(e) {
38284
39049
  const node = e.target;
@@ -38290,7 +39055,7 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38290
39055
  this.j.e.fire('outsideClick', e);
38291
39056
  }
38292
39057
  }
38293
- beforeCommandCut(command) {
39058
+ beforeCommandCut() {
38294
39059
  const { s } = this.j;
38295
39060
  if (!s.isCollapsed()) {
38296
39061
  const current = s.current();
@@ -38299,13 +39064,27 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38299
39064
  }
38300
39065
  }
38301
39066
  }
38302
- beforeCommandSelectall(command) {
39067
+ beforeCommandSelectAll() {
38303
39068
  const { s } = this.j;
38304
39069
  s.focus();
38305
39070
  s.select(this.j.editor, true);
38306
39071
  s.expandSelection();
38307
39072
  return false;
38308
39073
  }
39074
+ /**
39075
+ * Normalize selection after triple click
39076
+ */
39077
+ onTripleClickNormalizeSelection(e) {
39078
+ if (e.detail !== 3 || !this.j.o.select.normalizeTripleClick) {
39079
+ return;
39080
+ }
39081
+ const { s } = this.j;
39082
+ const { startContainer, startOffset } = s.range;
39083
+ if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(startContainer)) {
39084
+ 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) ||
39085
+ startContainer, true);
39086
+ }
39087
+ }
38309
39088
  onCopyNormalizeSelectionBound(e) {
38310
39089
  const { s, editor, o } = this.j;
38311
39090
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -38331,7 +39110,10 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
38331
39110
  ], select.prototype, "beforeCommandCut", null);
38332
39111
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
38333
39112
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':beforeCommandSelectall'])
38334
- ], select.prototype, "beforeCommandSelectall", null);
39113
+ ], select.prototype, "beforeCommandSelectAll", null);
39114
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
39115
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':click'])
39116
+ ], select.prototype, "onTripleClickNormalizeSelection", null);
38335
39117
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
38336
39118
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':copy', ':cut'])
38337
39119
  ], select.prototype, "onCopyNormalizeSelectionBound", null);