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
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.1.16
4
+ * Version: v4.2.5
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1708,7 +1708,7 @@ __webpack_require__.r(__webpack_exports__);
1708
1708
  * Released under MIT see LICENSE.txt in the project root for license information.
1709
1709
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1710
1710
  */
1711
- const APP_VERSION = "4.1.16";
1711
+ const APP_VERSION = "4.2.5";
1712
1712
  // prettier-ignore
1713
1713
  const ES = "es2021";
1714
1714
  const IS_ES_MODERN = true;
@@ -6717,8 +6717,8 @@ function position(elm, jodit, recurse = false) {
6717
6717
  return {
6718
6718
  left: Math.round(xPos),
6719
6719
  top: Math.round(yPos),
6720
- width: Math.round(elm.offsetWidth),
6721
- height: Math.round(elm.offsetHeight)
6720
+ width: Math.round(elm.offsetWidth ?? rect.width),
6721
+ height: Math.round(elm.offsetHeight ?? rect.height)
6722
6722
  };
6723
6723
  }
6724
6724
 
@@ -8751,9 +8751,9 @@ const getXPathByElement = (element, root) => {
8751
8751
  * Find all `ref` or `data-ref` elements inside HTMLElement
8752
8752
  */
8753
8753
  const refs = (root) => {
8754
- // if (Component.isInstanceOf<UIElement>(root, UIElement)) {
8755
- // root = root.container;
8756
- // }
8754
+ if ('container' in root) {
8755
+ root = root.container;
8756
+ }
8757
8757
  return $$('[ref],[data-ref]', root).reduce((def, child) => {
8758
8758
  const key = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(child, '-ref');
8759
8759
  if (key && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_4__/* .isString */ .K)(key)) {
@@ -13275,7 +13275,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13275
13275
  view.o.showTooltip &&
13276
13276
  !view.o.useNativeTooltip) {
13277
13277
  view.hookStatus(jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .STATUSES */ .f.ready, () => {
13278
- // TODO Move it inside __open method. Now it is here becous testcase failed with capturing
13278
+ // TODO Move it inside __open method. Now it is here because testcase failed with capturing
13279
13279
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .getContainer */ .My)(this.j, UITooltip_1).appendChild(this.container);
13280
13280
  view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
13281
13281
  capture: true
@@ -13291,6 +13291,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends jodit_core_ui_element__WEB
13291
13291
  const view = this.j;
13292
13292
  view.e
13293
13293
  .on(view.ow, 'scroll.tooltip', this.__hide)
13294
+ .on(view.ow, 'joditCloseDialog', this.__hide)
13294
13295
  .on(view.container, 'mouseleave.tooltip', this.__hide)
13295
13296
  .on([
13296
13297
  'escape.tooltip',
@@ -15300,7 +15301,7 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_7__/* .UI
15300
15301
  }
15301
15302
  let pe = this.parentElement;
15302
15303
  while (pe) {
15303
- if (checkView(j)) {
15304
+ if (checkView(pe.j)) {
15304
15305
  return;
15305
15306
  }
15306
15307
  if (pe.container.style.zIndex) {
@@ -17775,6 +17776,7 @@ let Dialog = Dialog_1 = class Dialog extends jodit_core_view_view_with_toolbar__
17775
17776
  * Fired when dialog box is started moving
17776
17777
  */
17777
17778
  this.e.fire(this, 'startMove');
17779
+ this.e.fire('closeAllPopups');
17778
17780
  }
17779
17781
  }
17780
17782
  onMouseMove(e) {
@@ -19715,7 +19717,14 @@ let FileBrowser = class FileBrowser extends jodit_core_view_view_with_toolbar__W
19715
19717
  this.__updateToolbarButtons();
19716
19718
  this._dialog.open(this.browser, header);
19717
19719
  this.e.fire('sort.filebrowser', this.state.sortBy);
19718
- (0,_fetch_load_tree__WEBPACK_IMPORTED_MODULE_10__/* .loadTree */ .r)(this).then(resolve, reject);
19720
+ (0,_fetch_load_tree__WEBPACK_IMPORTED_MODULE_10__/* .loadTree */ .r)(this)
19721
+ .then(resolve, reject)
19722
+ .finally(() => {
19723
+ if (this.isInDestruct) {
19724
+ return;
19725
+ }
19726
+ this?.e?.fire('fileBrowserReady.filebrowser');
19727
+ });
19719
19728
  })
19720
19729
  .catch((e) => {
19721
19730
  if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.IS_PROD) {
@@ -21584,11 +21593,12 @@ const act = (el, className = 'jodti-image-editor_active') => el ? className : ''
21584
21593
  const form = (editor, o) => {
21585
21594
  const i = editor.i18n.bind(editor);
21586
21595
  const switcher = (label, ref, active = true) => `<div class="jodit-form__group">
21587
- <label>${i(label)}</label>
21588
-
21589
- <label class='jodit-switcher'>
21590
- <input ${act(active, 'checked')} data-ref="${ref}" type="checkbox"/>
21591
- <span class="jodit-switcher__slider"></span>
21596
+ <label class="jodit-switcher-wrapper">
21597
+ <span class='jodit-switcher'>
21598
+ <input ${act(active, 'checked')} data-ref="${ref}" type="checkbox"/>
21599
+ <span class="jodit-switcher__slider"></span>
21600
+ </span>
21601
+ <span>${i(label)}</span>
21592
21602
  </label>
21593
21603
  </div>`;
21594
21604
  return editor.create.fromHTML(`<form class="${jie} jodit-properties">
@@ -24652,11 +24662,13 @@ const TabsWidget = (jodit, tabs, state) => {
24652
24662
  return;
24653
24663
  }
24654
24664
  buttonList.forEach(b => {
24665
+ b.state.variant = 'initial';
24655
24666
  b.state.activated = false;
24656
24667
  });
24657
24668
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('.jodit-tab', tabBox).forEach(a => {
24658
24669
  a.classList.remove('jodit-tab_active');
24659
24670
  });
24671
+ nameToTab[tab].button.state.variant = 'outline';
24660
24672
  nameToTab[tab].button.state.activated = true;
24661
24673
  nameToTab[tab].tab.classList.add('jodit-tab_active');
24662
24674
  };
@@ -24685,7 +24697,7 @@ const TabsWidget = (jodit, tabs, state) => {
24685
24697
  content.call(jodit);
24686
24698
  }
24687
24699
  if (state) {
24688
- state.__activeTab = name;
24700
+ state.activeTab = name;
24689
24701
  }
24690
24702
  return false;
24691
24703
  });
@@ -24701,20 +24713,20 @@ const TabsWidget = (jodit, tabs, state) => {
24701
24713
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.$$)('a', buttons).forEach(a => {
24702
24714
  a.style.width = (100 / tabCount).toFixed(10) + '%';
24703
24715
  });
24704
- const tab = !state || !state.__activeTab || !nameToTab[state.__activeTab]
24716
+ const tab = !state || !state.activeTab || !nameToTab[state.activeTab]
24705
24717
  ? firstTab
24706
- : state.__activeTab;
24718
+ : state.activeTab;
24707
24719
  setActive(tab);
24708
24720
  if (state) {
24709
- let __activeTab = state.__activeTab;
24710
- Object.defineProperty(state, '__activeTab', {
24721
+ let activeTab = state.activeTab;
24722
+ Object.defineProperty(state, 'activeTab', {
24711
24723
  configurable: true,
24712
24724
  enumerable: false,
24713
24725
  get() {
24714
- return __activeTab;
24726
+ return activeTab;
24715
24727
  },
24716
24728
  set(value) {
24717
- __activeTab = value;
24729
+ activeTab = value;
24718
24730
  setActive(value);
24719
24731
  }
24720
24732
  });
@@ -25129,7 +25141,7 @@ class aiAssistant extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_3__/
25129
25141
  (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .extendLang */ .JW)(_langs__WEBPACK_IMPORTED_MODULE_6__);
25130
25142
  }
25131
25143
  /** @override */
25132
- afterInit(jodit) { }
25144
+ afterInit() { }
25133
25145
  onGenerateAiAssistantForm(prompt) {
25134
25146
  this.__dialog.open(this.__container, 'AI Assistant');
25135
25147
  this.__container.setPrompt(prompt);
@@ -30541,9 +30553,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .pluginSystem */ .fg.add('image
30541
30553
  * Released under MIT see LICENSE.txt in the project root for license information.
30542
30554
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
30543
30555
  */
30544
- /**
30545
- * @module plugins/image-properties
30546
- */
30547
30556
 
30548
30557
  jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
30549
30558
  dialogWidth: 600,
@@ -30573,18 +30582,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
30573
30582
 
30574
30583
  "use strict";
30575
30584
  /* unused harmony export imageProperties */
30576
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(31635);
30585
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(31635);
30577
30586
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22664);
30578
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56298);
30579
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
30580
- /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35265);
30581
- /* harmony import */ var jodit_modules__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(37435);
30582
- /* harmony import */ var jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(53804);
30583
- /* harmony import */ var jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16116);
30584
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(24654);
30585
- /* harmony import */ var _templates_form__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(22254);
30586
- /* harmony import */ var _templates_main_tab__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75263);
30587
- /* harmony import */ var _templates_position_tab__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(57837);
30587
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55186);
30588
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
30589
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65147);
30590
+ /* harmony import */ var jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29866);
30591
+ /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(35265);
30592
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(24654);
30593
+ /* harmony import */ var _ui_ui_image_form__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31970);
30594
+ /* harmony import */ var _utils_open_image_editor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80778);
30595
+ /* harmony import */ var _utils_open_image_popup__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(33733);
30596
+ /* harmony import */ var _readers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(5549);
30597
+ /* harmony import */ var _writers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(30393);
30588
30598
  /*!
30589
30599
  * Jodit Editor (https://xdsoft.net/jodit/)
30590
30600
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -30616,55 +30626,93 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.image = {
30616
30626
  * });
30617
30627
  * ```
30618
30628
  */
30619
- const normalSizeToString = (value) => {
30620
- value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(value);
30621
- return /^[0-9]+$/.test(value) ? value + 'px' : value;
30622
- };
30623
- const normalSizeFromString = (value) => {
30624
- return /^[-+]?[0-9.]+px$/.test(value.toString())
30625
- ? parseFloat(value.toString())
30626
- : value;
30627
- };
30628
30629
  /**
30629
30630
  * Show dialog with image's options
30630
30631
  */
30631
- class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin {
30632
+ class imageProperties extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k {
30632
30633
  constructor() {
30633
30634
  super(...arguments);
30634
30635
  this.state = {
30635
30636
  image: new Image(),
30637
+ sourceImage: new Image(),
30636
30638
  get ratio() {
30637
- return this.image.naturalWidth / this.image.naturalHeight || 1;
30639
+ const { naturalWidth, naturalHeight } = this.image;
30640
+ return naturalWidth / naturalHeight || 1;
30638
30641
  },
30639
30642
  sizeIsLocked: true,
30640
- marginIsLocked: true
30643
+ marginIsLocked: true,
30644
+ values: {
30645
+ style: '',
30646
+ imageSrc: '',
30647
+ borderRadius: 0,
30648
+ imageTitle: '',
30649
+ imageAlt: '',
30650
+ imageLink: '',
30651
+ imageLinkOpenInNewTab: false,
30652
+ imageWidth: 0,
30653
+ imageHeight: 0,
30654
+ marginTop: 0,
30655
+ marginRight: 0,
30656
+ marginBottom: 0,
30657
+ marginLeft: 0,
30658
+ classes: '',
30659
+ id: '',
30660
+ align: ''
30661
+ }
30641
30662
  };
30642
30663
  this.activeTabState = {
30643
- __activeTab: 'Image'
30664
+ activeTab: 'Image'
30644
30665
  };
30645
30666
  }
30646
- onChangeMarginIsLocked() {
30647
- if (!this.form) {
30648
- return;
30649
- }
30650
- const { marginRight, marginBottom, marginLeft, lockMargin } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
30651
- [marginRight, marginBottom, marginLeft].forEach(elm => {
30652
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'disabled', this.state.marginIsLocked || null);
30667
+ get form() {
30668
+ return new _ui_ui_image_form__WEBPACK_IMPORTED_MODULE_7__/* .UIImagePropertiesForm */ .l(this.j, this.state, this.activeTabState, {
30669
+ openImageEditor: () => (0,_utils_open_image_editor__WEBPACK_IMPORTED_MODULE_8__/* .openImageEditorDialog */ .v)(this.j, this.state),
30670
+ openImagePopup: target => (0,_utils_open_image_popup__WEBPACK_IMPORTED_MODULE_9__/* .openImagePopup */ .q)(this.j, this.dialog, this.state, target)
30653
30671
  });
30654
- lockMargin.innerHTML = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Icon.get(this.state.marginIsLocked ? 'lock' : 'unlock');
30655
30672
  }
30656
- onChangeSizeIsLocked() {
30657
- if (!this.form) {
30658
- return;
30659
- }
30660
- const { lockSize, imageWidth } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
30661
- lockSize.innerHTML = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Icon.get(this.state.sizeIsLocked ? 'lock' : 'unlock');
30662
- lockSize.classList.remove('jodit-properties__lock');
30663
- lockSize.classList.remove('jodit-properties__unlock');
30664
- lockSize.classList.add(this.state.sizeIsLocked
30665
- ? 'jodit-properties__lock'
30666
- : 'jodit-properties__unlock');
30667
- this.j.e.fire(imageWidth, 'change');
30673
+ /**
30674
+ * Dialog for form
30675
+ */
30676
+ get dialog() {
30677
+ const { j } = this;
30678
+ const dialog = j.dlg({
30679
+ minWidth: Math.min(400, screen.width),
30680
+ minHeight: 590,
30681
+ buttons: ['fullsize', 'dialog.close']
30682
+ });
30683
+ const buttons = this.__buttons;
30684
+ buttons.check.onAction(() => {
30685
+ (0,_writers__WEBPACK_IMPORTED_MODULE_11__/* .applyValuesToImage */ .j)(j, this.state, this.state.sourceImage);
30686
+ j.synchronizeValues();
30687
+ dialog.close();
30688
+ });
30689
+ buttons.remove.onAction(() => {
30690
+ j.s.removeNode(this.state.sourceImage);
30691
+ dialog.close();
30692
+ });
30693
+ buttons.cancel.onAction(() => {
30694
+ dialog.close();
30695
+ });
30696
+ dialog.setHeader(j.i18n('Image properties'));
30697
+ dialog.setContent(this.form);
30698
+ dialog.setFooter([[buttons.cancel, buttons.remove], buttons.check]);
30699
+ j.e.on(dialog, 'afterClose', () => {
30700
+ if (this.state.image.parentNode &&
30701
+ j.o.image.selectImageAfterClose) {
30702
+ j.s.select(this.state.sourceImage);
30703
+ }
30704
+ });
30705
+ dialog.setSize(j.o.image.dialogWidth);
30706
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.markOwner)(j, dialog.container);
30707
+ return dialog;
30708
+ }
30709
+ get __buttons() {
30710
+ const { j } = this;
30711
+ return {
30712
+ check: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'ok', 'Apply', 'primary'),
30713
+ remove: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'bin', 'Delete'),
30714
+ cancel: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__/* .Button */ .$n)(j, 'cancel', 'Cancel')
30715
+ };
30668
30716
  }
30669
30717
  /**
30670
30718
  * Open dialog editing image properties
@@ -30681,358 +30729,24 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
30681
30729
  * ```
30682
30730
  */
30683
30731
  open() {
30684
- this.makeForm();
30685
- this.activeTabState.__activeTab = 'Image';
30686
- this.j.e.fire('hidePopup');
30687
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.markOwner)(this.j, this.dialog.container);
30688
- this.state.marginIsLocked = true;
30689
- this.state.sizeIsLocked = true;
30690
- this.onChangeMarginIsLocked();
30691
- this.onChangeSizeIsLocked();
30692
- this.updateValues();
30732
+ this.activeTabState.activeTab = 'Image';
30733
+ this.__lock();
30693
30734
  this.dialog.open().setModal(true).setPosition();
30735
+ this.async
30736
+ .promise((resolve, reject) => (0,_readers__WEBPACK_IMPORTED_MODULE_10__/* .readValuesFromImage */ .U)(this.j, this.state).then(resolve, reject))
30737
+ .catch((e) => this.dialog.message.error(e.message))
30738
+ .finally(() => this.__unlock());
30694
30739
  return false;
30695
30740
  }
30696
- /**
30697
- * Create form for edit image properties
30698
- */
30699
- makeForm() {
30700
- if (this.dialog) {
30701
- return;
30702
- }
30703
- this.dialog = this.j.dlg({
30704
- minWidth: Math.min(400, screen.width),
30705
- minHeight: 590,
30706
- buttons: ['fullsize', 'dialog.close']
30707
- });
30708
- const editor = this.j, opt = editor.o, i18n = editor.i18n.bind(editor), buttons = {
30709
- check: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(editor, 'ok', 'Apply', 'primary'),
30710
- remove: (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_3__/* .Button */ .$n)(editor, 'bin', 'Delete')
30711
- };
30712
- editor.e.on(this.dialog, 'afterClose', () => {
30713
- if (this.state.image.parentNode &&
30714
- opt.image.selectImageAfterClose) {
30715
- editor.s.select(this.state.image);
30716
- }
30717
- });
30718
- buttons.remove.onAction(() => {
30719
- editor.s.removeNode(this.state.image);
30720
- this.dialog.close();
30721
- });
30722
- const { dialog } = this;
30723
- dialog.setHeader(i18n('Image properties'));
30724
- const mainForm = (0,_templates_form__WEBPACK_IMPORTED_MODULE_8__/* .form */ .Z)(editor);
30725
- this.form = mainForm;
30726
- dialog.setContent(mainForm);
30727
- const { tabsBox } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
30728
- if (tabsBox) {
30729
- tabsBox.appendChild((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__/* .TabsWidget */ .Zg)(editor, [
30730
- { name: 'Image', content: (0,_templates_main_tab__WEBPACK_IMPORTED_MODULE_9__/* .mainTab */ .J)(editor) },
30731
- { name: 'Advanced', content: (0,_templates_position_tab__WEBPACK_IMPORTED_MODULE_10__/* .positionTab */ .b)(editor) }
30732
- ], this.activeTabState));
30733
- }
30734
- buttons.check.onAction(this.onApply);
30735
- const { changeImage, editImage } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
30736
- editor.e.on(changeImage, 'click', this.openImagePopup);
30737
- if (opt.image.useImageEditor) {
30738
- editor.e.on(editImage, 'click', this.openImageEditor);
30739
- }
30740
- const { lockSize, lockMargin, imageWidth, imageHeight } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(mainForm);
30741
- if (lockSize) {
30742
- editor.e.on(lockSize, 'click', () => {
30743
- this.state.sizeIsLocked = !this.state.sizeIsLocked;
30744
- });
30745
- }
30746
- editor.e.on(lockMargin, 'click', (e) => {
30747
- this.state.marginIsLocked = !this.state.marginIsLocked;
30748
- e.preventDefault();
30749
- });
30750
- const changeSizes = (event) => {
30751
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageWidth.value) || !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageHeight.value)) {
30752
- return;
30753
- }
30754
- const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
30755
- if (event.target === imageWidth) {
30756
- imageHeight.value = Math.round(w / this.state.ratio).toString();
30757
- }
30758
- else {
30759
- imageWidth.value = Math.round(h * this.state.ratio).toString();
30760
- }
30761
- };
30762
- editor.e.on([imageWidth, imageHeight], 'change keydown mousedown paste', (event) => {
30763
- if (!this.state.sizeIsLocked) {
30764
- return;
30765
- }
30766
- editor.async.setTimeout(changeSizes.bind(this, event), {
30767
- timeout: editor.defaultTimeout,
30768
- label: 'image-properties-changeSize'
30769
- });
30770
- });
30771
- dialog.setFooter([buttons.remove, buttons.check]);
30772
- dialog.setSize(this.j.o.image.dialogWidth);
30773
- }
30774
- /**
30775
- * Set input values from image
30776
- */
30777
- updateValues() {
30778
- const opt = this.j.o;
30779
- const { image } = this.state;
30780
- 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);
30781
- const updateLock = () => {
30782
- lockMargin.checked = this.state.marginIsLocked;
30783
- lockSize.checked = this.state.sizeIsLocked;
30784
- }, updateAlign = () => {
30785
- if (image.style.cssFloat &&
30786
- ['left', 'right'].indexOf(image.style.cssFloat.toLowerCase()) !== -1) {
30787
- align.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float');
30788
- }
30789
- else {
30790
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'display') === 'block' &&
30791
- image.style.marginLeft === 'auto' &&
30792
- image.style.marginRight === 'auto') {
30793
- align.value = 'center';
30794
- }
30795
- }
30796
- }, updateBorderRadius = () => {
30797
- borderRadius.value = (parseInt(image.style.borderRadius || '0', 10) || '0').toString();
30798
- }, updateId = () => {
30799
- id.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'id') || '';
30800
- }, updateStyle = () => {
30801
- style.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'style') || '';
30802
- }, updateClasses = () => {
30803
- classes.value = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
30804
- }, updateMargins = () => {
30805
- if (!opt.image.editMargins) {
30806
- return;
30807
- }
30808
- let equal = true, wasEmptyField = false;
30809
- [marginTop, marginRight, marginBottom, marginLeft].forEach(elm => {
30810
- const id = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'data-ref') || '';
30811
- let value = image.style.getPropertyValue((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.kebabCase)(id));
30812
- if (!value) {
30813
- wasEmptyField = true;
30814
- elm.value = '';
30815
- return;
30816
- }
30817
- if (/^[0-9]+(px)?$/.test(value)) {
30818
- value = parseInt(value, 10);
30819
- }
30820
- elm.value = value.toString() || '';
30821
- if ((wasEmptyField && elm.value) ||
30822
- (equal &&
30823
- id !== 'marginTop' &&
30824
- elm.value !== marginTop.value)) {
30825
- equal = false;
30826
- }
30827
- });
30828
- this.state.marginIsLocked = equal;
30829
- }, updateSizes = () => {
30830
- const width = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width') ||
30831
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'width', true) ||
30832
- false, height = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height') ||
30833
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'height', true) ||
30834
- false;
30835
- imageWidth.value =
30836
- width !== false
30837
- ? normalSizeFromString(width).toString()
30838
- : image.offsetWidth.toString();
30839
- imageHeight.value =
30840
- height !== false
30841
- ? normalSizeFromString(height).toString()
30842
- : image.offsetHeight.toString();
30843
- this.state.sizeIsLocked = (() => {
30844
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageWidth.value) ||
30845
- !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isNumeric)(imageHeight.value)) {
30846
- return false;
30847
- }
30848
- const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
30849
- return Math.abs(w - h * this.state.ratio) < 1;
30850
- })();
30851
- }, updateText = () => {
30852
- imageTitle.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'title') || '';
30853
- imageAlt.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt') || '';
30854
- const a = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(image, 'a', this.j.editor);
30855
- if (a) {
30856
- imageLink.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(a, 'href') || '';
30857
- imageLinkOpenInNewTab.checked =
30858
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(a, 'target') === '_blank';
30859
- }
30860
- else {
30861
- imageLink.value = '';
30862
- imageLinkOpenInNewTab.checked = false;
30863
- }
30864
- }, updateSrc = () => {
30865
- imageSrc.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src') || '';
30866
- if (imageViewSrc) {
30867
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(imageViewSrc, 'src', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src') || '');
30868
- }
30869
- };
30870
- updateLock();
30871
- updateSrc();
30872
- updateText();
30873
- updateSizes();
30874
- updateMargins();
30875
- updateClasses();
30876
- updateId();
30877
- updateBorderRadius();
30878
- updateAlign();
30879
- updateStyle();
30880
- }
30881
- /**
30882
- * Apply form's values to image
30883
- */
30884
- onApply() {
30885
- 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);
30886
- const opt = this.j.o;
30887
- const { image } = this.state;
30888
- // styles
30889
- if (opt.image.editStyle) {
30890
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'style', style.value || null);
30891
- }
30892
- // Src
30893
- if (imageSrc.value) {
30894
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src', imageSrc.value);
30895
- }
30896
- else {
30897
- jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(image);
30898
- this.dialog.close();
30899
- return;
30900
- }
30901
- // Border radius
30902
- if (borderRadius.value !== '0' && /^[0-9]+$/.test(borderRadius.value)) {
30903
- image.style.borderRadius = borderRadius.value + 'px';
30904
- }
30905
- else {
30906
- image.style.borderRadius = '';
30907
- }
30908
- // Title
30909
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'title', imageTitle.value || null);
30910
- // Alt
30911
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt', imageAlt.value || null);
30912
- // Link
30913
- let link = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(image, 'a', this.j.editor);
30914
- if (imageLink.value) {
30915
- if (!link) {
30916
- link = jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(image, 'a', this.j.createInside);
30917
- }
30918
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'href', imageLink.value);
30919
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'target', imageLinkOpenInNewTab.checked ? '_blank' : null);
30920
- }
30921
- else {
30922
- if (link && link.parentNode) {
30923
- link.parentNode.replaceChild(image, link);
30924
- }
30925
- }
30926
- // Size
30927
- if (imageWidth.value !== image.offsetWidth.toString() ||
30928
- imageHeight.value !== image.offsetHeight.toString()) {
30929
- const updatedtWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(imageWidth.value)
30930
- ? normalSizeToString(imageWidth.value)
30931
- : null;
30932
- const updatedHeight = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.trim)(imageHeight.value)
30933
- ? normalSizeToString(imageHeight.value)
30934
- : null;
30935
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, {
30936
- width: updatedtWidth,
30937
- height: updatedHeight
30938
- });
30939
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'width') ? updatedtWidth : null);
30940
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'height') ? updatedHeight : null);
30941
- }
30942
- const margins = [marginTop, marginRight, marginBottom, marginLeft];
30943
- if (opt.image.editMargins) {
30944
- if (!this.state.marginIsLocked) {
30945
- margins.forEach((margin) => {
30946
- const side = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(margin, 'data-ref') || '';
30947
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, side, normalSizeToString(margin.value));
30948
- });
30949
- }
30950
- else {
30951
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'margin', normalSizeToString(marginTop.value));
30952
- }
30953
- }
30954
- if (opt.image.editClass) {
30955
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'class', classes.value || null);
30956
- }
30957
- if (opt.image.editId) {
30958
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'id', id.value || null);
30959
- }
30960
- if (opt.image.editAlign) {
30961
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(image, align.value);
30962
- }
30963
- this.j.synchronizeValues();
30964
- this.dialog.close();
30965
- }
30966
- /**
30967
- * Open image editor dialog
30968
- */
30969
- openImageEditor() {
30970
- const url = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src') || '', a = this.j.c.element('a'), loadExternal = () => {
30971
- if (a.host !== location.host) {
30972
- this.j.confirm('You can only edit your own images. Download this image on the host?', yes => {
30973
- if (yes && this.j.uploader) {
30974
- this.j.uploader.uploadRemoteImage(a.href.toString(), resp => {
30975
- this.j.alert('The image has been successfully uploaded to the host!', () => {
30976
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isString)(resp.newfilename)) {
30977
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', resp.baseurl +
30978
- resp.newfilename);
30979
- this.updateValues();
30980
- }
30981
- });
30982
- }, error => {
30983
- this.j.alert('There was an error loading %s', error.message);
30984
- });
30985
- }
30986
- });
30987
- return;
30988
- }
30989
- };
30990
- a.href = url;
30991
- this.j.filebrowser.dataProvider
30992
- .getPathByUrl(a.href.toString())
30993
- .then(resp => {
30994
- jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_5__/* .openImageEditor */ .B.call(this.j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
30995
- const timestamp = new Date().getTime();
30996
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', url +
30997
- (url.indexOf('?') !== -1 ? '' : '?') +
30998
- '&_tmp=' +
30999
- timestamp.toString());
31000
- this.updateValues();
31001
- }, error => {
31002
- this.j.alert(error.message);
31003
- });
31004
- })
31005
- .catch(error => {
31006
- this.j.alert(error.message, loadExternal);
31007
- });
30741
+ __lock() {
30742
+ this.dialog.lock();
30743
+ this.form.setMod('lock', true);
30744
+ Object.values(this.__buttons).forEach(b => (b.state.disabled = true));
31008
30745
  }
31009
- /**
31010
- * Open popup with filebrowser/uploader buttons for image
31011
- */
31012
- openImagePopup(event) {
31013
- const popup = new jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Popup(this.j), { changeImage } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.refs)(this.form);
31014
- popup.setZIndex(this.dialog.getZIndex() + 1);
31015
- popup
31016
- .setContent((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_6__/* .FileSelectorWidget */ .kG)(this.j, {
31017
- upload: (data) => {
31018
- if (data.files && data.files.length) {
31019
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', data.baseurl + data.files[0]);
31020
- }
31021
- this.updateValues();
31022
- popup.close();
31023
- },
31024
- filebrowser: (data) => {
31025
- if (data &&
31026
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isArray)(data.files) &&
31027
- data.files.length) {
31028
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.attr)(this.state.image, 'src', data.files[0]);
31029
- popup.close();
31030
- this.updateValues();
31031
- }
31032
- }
31033
- }, this.state.image, popup.close))
31034
- .open(() => (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.position)(changeImage));
31035
- event.stopPropagation();
30746
+ __unlock() {
30747
+ this.dialog.unlock();
30748
+ this.form.setMod('lock', false);
30749
+ Object.values(this.__buttons).forEach(b => (b.state.disabled = false));
31036
30750
  }
31037
30751
  /** @override **/
31038
30752
  afterInit(editor) {
@@ -31043,7 +30757,7 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31043
30757
  .off(editor.editor, '.imageproperties')
31044
30758
  .on(editor.editor, 'dblclick.imageproperties', (e) => {
31045
30759
  const image = e.target;
31046
- if (!jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(image, 'img')) {
30760
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(image, 'img')) {
31047
30761
  return;
31048
30762
  }
31049
30763
  if (editor.o.image.openOnDblClick) {
@@ -31051,7 +30765,8 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31051
30765
  false) {
31052
30766
  return;
31053
30767
  }
31054
- self.state.image = image;
30768
+ self.state.sourceImage = image;
30769
+ self.state.image = image.cloneNode(true);
31055
30770
  if (!editor.o.readonly) {
31056
30771
  e.stopImmediatePropagation();
31057
30772
  e.preventDefault();
@@ -31065,206 +30780,1252 @@ class imageProperties extends jodit_modules__WEBPACK_IMPORTED_MODULE_4__.Plugin
31065
30780
  });
31066
30781
  })
31067
30782
  .on('openImageProperties.imageproperties', (image) => {
31068
- this.state.image = image;
30783
+ self.state.sourceImage = image;
30784
+ this.state.image = image.cloneNode(true);
31069
30785
  this.open();
31070
30786
  });
31071
30787
  }
30788
+ async onStateValuesImageSrcChange() {
30789
+ const { image, values } = this.state;
30790
+ if (!image.src) {
30791
+ return;
30792
+ }
30793
+ try {
30794
+ this.__lock();
30795
+ await image.decode();
30796
+ if (this.state.sizeIsLocked && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isNumeric)(values.imageWidth)) {
30797
+ const w = parseFloat(values.imageWidth.toString());
30798
+ values.imageHeight = Math.round(w / this.state.ratio);
30799
+ }
30800
+ this.j.e.fire('updateImageProperties.imageproperties', image);
30801
+ }
30802
+ catch (e) {
30803
+ this.j.alert(e.message);
30804
+ }
30805
+ finally {
30806
+ this.__unlock();
30807
+ }
30808
+ }
31072
30809
  /** @override */
31073
30810
  beforeDestruct(editor) {
31074
- this.dialog && this.dialog.destruct();
30811
+ Object.values((0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, '__buttons') ?? {}).forEach(b => b.destruct());
30812
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, 'dialog')?.destruct();
30813
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cached)(this, 'form')?.destruct();
31075
30814
  editor.e.off(editor.editor, '.imageproperties').off('.imageproperties');
31076
30815
  }
31077
30816
  }
31078
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31079
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.marginIsLocked')
31080
- ], imageProperties.prototype, "onChangeMarginIsLocked", null);
31081
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31082
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.sizeIsLocked')
31083
- ], imageProperties.prototype, "onChangeSizeIsLocked", null);
31084
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31085
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31086
- ], imageProperties.prototype, "onApply", null);
31087
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31088
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31089
- ], imageProperties.prototype, "openImageEditor", null);
31090
- (0,tslib__WEBPACK_IMPORTED_MODULE_11__/* .__decorate */ .Cg)([
31091
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.autobind
31092
- ], imageProperties.prototype, "openImagePopup", null);
31093
- jodit_core_global__WEBPACK_IMPORTED_MODULE_1__/* .pluginSystem */ .fg.add('imageProperties', imageProperties);
30817
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
30818
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
30819
+ ], imageProperties.prototype, "form", null);
30820
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
30821
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
30822
+ ], imageProperties.prototype, "dialog", null);
30823
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
30824
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.cache
30825
+ ], imageProperties.prototype, "__buttons", null);
30826
+ (0,tslib__WEBPACK_IMPORTED_MODULE_12__/* .__decorate */ .Cg)([
30827
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.image')
30828
+ ], imageProperties.prototype, "onStateValuesImageSrcChange", null);
30829
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__/* .pluginSystem */ .fg.add('imageProperties', imageProperties);
31094
30830
 
31095
30831
 
31096
30832
  /***/ }),
31097
30833
 
31098
- /***/ 22254:
30834
+ /***/ 74260:
31099
30835
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31100
30836
 
31101
30837
  "use strict";
31102
30838
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31103
- /* harmony export */ Z: function() { return /* binding */ form; }
30839
+ /* harmony export */ g: function() { return /* binding */ readAlign; }
31104
30840
  /* harmony export */ });
31105
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
30841
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38322);
30842
+ /*!
30843
+ * Jodit Editor (https://xdsoft.net/jodit/)
30844
+ * Released under MIT see LICENSE.txt in the project root for license information.
30845
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
30846
+ */
30847
+
30848
+ /** @private */
30849
+ function readAlign(image, values) {
30850
+ // Align
30851
+ if (image.style.cssFloat &&
30852
+ ['left', 'right'].indexOf(image.style.cssFloat.toLowerCase()) !== -1) {
30853
+ values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__/* .css */ .A)(image, 'float');
30854
+ }
30855
+ else {
30856
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__/* .css */ .A)(image, 'display') === 'block' &&
30857
+ image.style.marginLeft === 'auto' &&
30858
+ image.style.marginRight === 'auto') {
30859
+ values.align = 'center';
30860
+ }
30861
+ else {
30862
+ values.align = '';
30863
+ }
30864
+ }
30865
+ }
30866
+
30867
+
30868
+ /***/ }),
30869
+
30870
+ /***/ 5549:
30871
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
30872
+
30873
+ "use strict";
30874
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
30875
+ /* harmony export */ U: function() { return /* binding */ readValuesFromImage; }
30876
+ /* harmony export */ });
30877
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
30878
+ /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74260);
30879
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
30880
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(85079);
30881
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17880);
30882
+ /*!
30883
+ * Jodit Editor (https://xdsoft.net/jodit/)
30884
+ * Released under MIT see LICENSE.txt in the project root for license information.
30885
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
30886
+ */
30887
+
30888
+
30889
+
30890
+
30891
+
30892
+ /**
30893
+ * Read values from image and set it to state
30894
+ * @private
30895
+ */
30896
+ async function readValuesFromImage(j, state) {
30897
+ const { sourceImage: image, values } = state;
30898
+ (0,_align__WEBPACK_IMPORTED_MODULE_3__/* .readAlign */ .g)(image, values);
30899
+ // Border radius
30900
+ values.borderRadius = parseInt(image.style.borderRadius || '0', 10) || 0;
30901
+ // Id
30902
+ values.id = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'id') || '';
30903
+ // Title
30904
+ values.imageTitle = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'title') || '';
30905
+ // Alt
30906
+ values.imageAlt = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'alt') || '';
30907
+ // Style
30908
+ values.style = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'style') || '';
30909
+ // Classes
30910
+ values.classes = ((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
30911
+ // Margins
30912
+ (0,_margin__WEBPACK_IMPORTED_MODULE_4__/* .readMargins */ .E)(image, values, state);
30913
+ // Link
30914
+ (0,_link__WEBPACK_IMPORTED_MODULE_1__/* .readLink */ .X)(state, j, values);
30915
+ // Src
30916
+ values.imageSrc = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'src') || '';
30917
+ // Image size
30918
+ return (0,_size__WEBPACK_IMPORTED_MODULE_2__/* .readSizes */ .P)(image, values, state);
30919
+ }
30920
+
30921
+
30922
+ /***/ }),
30923
+
30924
+ /***/ 33201:
30925
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
30926
+
30927
+ "use strict";
30928
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
30929
+ /* harmony export */ X: function() { return /* binding */ readLink; }
30930
+ /* harmony export */ });
30931
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
30932
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26150);
30933
+ /*!
30934
+ * Jodit Editor (https://xdsoft.net/jodit/)
30935
+ * Released under MIT see LICENSE.txt in the project root for license information.
30936
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
30937
+ */
30938
+
30939
+
30940
+ /** @private */
30941
+ function readLink(state, j, values) {
30942
+ const a = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.closest(state.sourceImage, 'a', j.editor);
30943
+ if (a) {
30944
+ values.imageLink = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(a, 'href') || '';
30945
+ values.imageLinkOpenInNewTab = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(a, 'target') === '_blank';
30946
+ }
30947
+ else {
30948
+ values.imageLink = '';
30949
+ values.imageLinkOpenInNewTab = false;
30950
+ }
30951
+ }
30952
+
30953
+
30954
+ /***/ }),
30955
+
30956
+ /***/ 85079:
30957
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
30958
+
30959
+ "use strict";
30960
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
30961
+ /* harmony export */ E: function() { return /* binding */ readMargins; }
30962
+ /* harmony export */ });
30963
+ /* harmony import */ var jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(449);
30964
+ /*!
30965
+ * Jodit Editor (https://xdsoft.net/jodit/)
30966
+ * Released under MIT see LICENSE.txt in the project root for license information.
30967
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
30968
+ */
30969
+
30970
+ /** @private */
30971
+ function readMargins(image, values, state) {
30972
+ // Margins
30973
+ let equal = true, wasEmptyField = false;
30974
+ ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(id => {
30975
+ let value = image.style.getPropertyValue((0,jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_0__/* .kebabCase */ .k)(id));
30976
+ if (!value) {
30977
+ wasEmptyField = true;
30978
+ values[id] = 0;
30979
+ return;
30980
+ }
30981
+ if (/^[0-9]+(px)?$/.test(value)) {
30982
+ value = parseInt(value, 10);
30983
+ }
30984
+ values[id] = value;
30985
+ if ((wasEmptyField && values[id]) ||
30986
+ (equal && id !== 'marginTop' && values[id] !== values.marginTop)) {
30987
+ equal = false;
30988
+ }
30989
+ });
30990
+ state.marginIsLocked = equal;
30991
+ }
30992
+
30993
+
30994
+ /***/ }),
30995
+
30996
+ /***/ 17880:
30997
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
30998
+
30999
+ "use strict";
31000
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31001
+ /* harmony export */ P: function() { return /* binding */ readSizes; }
31002
+ /* harmony export */ });
31003
+ /* harmony import */ var jodit_core_helpers_checker_is_numeric__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12461);
31004
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
31005
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38322);
31006
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9645);
31007
+ /*!
31008
+ * Jodit Editor (https://xdsoft.net/jodit/)
31009
+ * Released under MIT see LICENSE.txt in the project root for license information.
31010
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31011
+ */
31012
+
31013
+
31014
+
31015
+
31016
+ /** @private */
31017
+ async function readSizes(image, values, state) {
31018
+ await image.decode();
31019
+ 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;
31020
+ 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;
31021
+ values.imageWidth =
31022
+ width !== false
31023
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeFromString */ .G)(width)
31024
+ : image.offsetWidth || image.naturalWidth;
31025
+ values.imageHeight =
31026
+ height !== false
31027
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeFromString */ .G)(height)
31028
+ : image.offsetHeight || image.naturalHeight;
31029
+ const { imageWidth, imageHeight } = values;
31030
+ const w = parseFloat(imageWidth.toString());
31031
+ 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)) {
31032
+ state.sizeIsLocked = false;
31033
+ return;
31034
+ }
31035
+ if (height === false) {
31036
+ values.imageHeight = Math.round(w / state.ratio);
31037
+ state.sizeIsLocked = true;
31038
+ return;
31039
+ }
31040
+ const h = parseFloat(imageHeight.toString());
31041
+ state.sizeIsLocked = Math.abs(w - h * state.ratio) < 1;
31042
+ }
31043
+
31044
+
31045
+ /***/ }),
31046
+
31047
+ /***/ 31970:
31048
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31049
+
31050
+ "use strict";
31051
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31052
+ /* harmony export */ l: function() { return /* binding */ UIImagePropertiesForm; }
31053
+ /* harmony export */ });
31054
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(31635);
31055
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22664);
31056
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(24767);
31057
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65147);
31058
+ /* harmony import */ var jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6455);
31059
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(931);
31060
+ /* harmony import */ var jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16116);
31061
+ /* harmony import */ var _ui_image_main_tab__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33403);
31062
+ /* harmony import */ var _ui_image_position_tab__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46681);
31106
31063
  /*!
31107
31064
  * Jodit Editor (https://xdsoft.net/jodit/)
31108
31065
  * Released under MIT see LICENSE.txt in the project root for license information.
31109
31066
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31110
31067
  */
31111
31068
 
31112
- function form(editor) {
31113
- 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);
31114
- return editor.c.fromHTML(`<form class="jodit-properties">
31069
+
31070
+
31071
+
31072
+
31073
+
31074
+
31075
+
31076
+
31077
+
31078
+ /** @private */
31079
+ let UIImagePropertiesForm = class UIImagePropertiesForm extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_2__/* .UIGroup */ .U {
31080
+ className() {
31081
+ return 'UIImagePropertiesForm';
31082
+ }
31083
+ appendChildToContainer() { }
31084
+ getElm(elementName) {
31085
+ const selfElm = super.getElm(elementName);
31086
+ if (selfElm) {
31087
+ return selfElm;
31088
+ }
31089
+ for (const child of this.elements) {
31090
+ const elm = child.getElm(elementName);
31091
+ if (elm) {
31092
+ return elm;
31093
+ }
31094
+ }
31095
+ return null;
31096
+ }
31097
+ constructor(jodit, state, activeTabState, handlers) {
31098
+ super(jodit);
31099
+ this.state = state;
31100
+ this.handlers = handlers;
31101
+ this.__mainTab = new _ui_image_main_tab__WEBPACK_IMPORTED_MODULE_5__/* .UIImageMainTab */ .k(this.jodit, this.state, this.handlers);
31102
+ this.__positionTab = new _ui_image_position_tab__WEBPACK_IMPORTED_MODULE_6__/* .UIImagePositionTab */ ._(this.jodit, this.state, this.handlers);
31103
+ this.getElm('tabsBox').appendChild((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_4__/* .TabsWidget */ .Zg)(jodit, [
31104
+ { name: 'Image', content: this.__mainTab },
31105
+ { name: 'Advanced', content: this.__positionTab }
31106
+ ], activeTabState));
31107
+ this.setMod('lock-size', this.state.sizeIsLocked);
31108
+ this.append(this.__mainTab).append(this.__positionTab);
31109
+ }
31110
+ render() {
31111
+ return `<form>
31115
31112
  <div class="jodit-grid jodit-grid_xs-column">
31116
31113
  <div class="jodit_col-lg-2-5 jodit_col-xs-5-5">
31117
- <div class="jodit-properties_view_box">
31118
- <div style="${!showPreview ? 'display:none' : ''}" class="jodit-properties_image_view">
31119
- <img data-ref="imageViewSrc" src="" alt=""/>
31114
+ <div class="&__view-box">
31115
+ <div class="&__imageView">
31116
+ <img class="&__imageViewSrc" src="" alt=""/>
31120
31117
  </div>
31121
- <div style="${!editSize ? 'display:none' : ''}" class="jodit-form__group jodit-properties_image_sizes">
31122
- <input data-ref="imageWidth" type="text" class="jodit-input"/>
31123
- <a data-ref="lockSize" class="jodit-properties__lock">${gi('lock')}</a>
31124
- <input data-ref="imageHeight" type="text" class="imageHeight jodit-input"/>
31118
+ <div class="jodit-form__group &__imageSizes">
31119
+ <input type="text" class="jodit-input &__imageWidth"/>
31120
+ <a class="&__lockSize">${jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__/* .Icon */ .I.get('lock')}</a>
31121
+ <input type="text" class="&__imageHeight jodit-input"/>
31125
31122
  </div>
31126
31123
  </div>
31127
31124
  </div>
31128
- <div data-ref="tabsBox" class="jodit_col-lg-3-5 jodit_col-xs-5-5"></div>
31125
+ <div class="jodit_col-lg-3-5 jodit_col-xs-5-5 &__tabsBox"></div>
31129
31126
  </div>
31130
- </form>`);
31131
- }
31127
+ </form>`;
31128
+ }
31129
+ onChangeSizeIsLocked() {
31130
+ const lockSize = this.getElm('lockSize');
31131
+ const imageWidth = this.getElm('imageWidth');
31132
+ lockSize.innerHTML = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__/* .Icon */ .I.get(this.state.sizeIsLocked ? 'lock' : 'unlock');
31133
+ this.setMod('lock-size', this.state.sizeIsLocked);
31134
+ this.j.e.fire(imageWidth, 'change');
31135
+ }
31136
+ onLockSizeClick() {
31137
+ this.state.sizeIsLocked = !this.state.sizeIsLocked;
31138
+ }
31139
+ onStateValuesSizeChange() {
31140
+ const imageWidth = this.getElm('imageWidth');
31141
+ const imageHeight = this.getElm('imageHeight');
31142
+ if (imageWidth !== this.j.od.activeElement) {
31143
+ imageWidth.value = this.state.values.imageWidth.toString();
31144
+ }
31145
+ if (imageHeight !== this.j.od.activeElement) {
31146
+ imageHeight.value = this.state.values.imageHeight.toString();
31147
+ }
31148
+ }
31149
+ onImageWidthChange(e) {
31150
+ const imageWidth = this.getElm('imageWidth');
31151
+ const imageHeight = this.getElm('imageHeight');
31152
+ if (!this.state.sizeIsLocked ||
31153
+ !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isNumeric)(imageWidth.value) ||
31154
+ !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isNumeric)(imageHeight.value)) {
31155
+ this.state.values.imageWidth = imageWidth.value;
31156
+ this.state.values.imageHeight = imageHeight.value;
31157
+ return;
31158
+ }
31159
+ const w = parseFloat(imageWidth.value), h = parseFloat(imageHeight.value);
31160
+ if (e.target === imageWidth) {
31161
+ this.state.values.imageWidth = w;
31162
+ this.state.values.imageHeight = Math.round(w / this.state.ratio);
31163
+ }
31164
+ else {
31165
+ this.state.values.imageWidth = Math.round(h * this.state.ratio);
31166
+ this.state.values.imageHeight = h;
31167
+ }
31168
+ }
31169
+ onStateValuesImageSrcChange() {
31170
+ const { imageSrc } = this.state.values;
31171
+ if (!imageSrc) {
31172
+ return;
31173
+ }
31174
+ const imageViewSrc = this.getElm('imageViewSrc');
31175
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(imageViewSrc, 'src', imageSrc);
31176
+ const image = new Image();
31177
+ image.src = imageSrc;
31178
+ this.state.image = image;
31179
+ }
31180
+ hideFieldByOptions() {
31181
+ const opt = this.j.o.image;
31182
+ [
31183
+ ['editSize', 'imageSizes'],
31184
+ ['showPreview', 'imageView']
31185
+ ].forEach(([optKey, elmKey]) => {
31186
+ const elm = this.getElm(elmKey);
31187
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.css)(elm, 'display', opt[optKey] ? null : 'none');
31188
+ });
31189
+ }
31190
+ };
31191
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31192
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31193
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.sizeIsLocked')
31194
+ ], UIImagePropertiesForm.prototype, "onChangeSizeIsLocked", null);
31195
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31196
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('lockSize:click')
31197
+ ], UIImagePropertiesForm.prototype, "onLockSizeClick", null);
31198
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31199
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31200
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)(['state.values.imageWidth', 'state.values.imageHeight'])
31201
+ ], UIImagePropertiesForm.prototype, "onStateValuesSizeChange", null);
31202
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31203
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([
31204
+ 'imageWidth:change',
31205
+ 'imageHeight:change',
31206
+ 'imageWidth:keydown',
31207
+ 'imageHeight:keydown',
31208
+ 'imageWidth:mousedown',
31209
+ 'imageHeight:mousedown',
31210
+ 'imageWidth:paste',
31211
+ 'imageHeight:paste'
31212
+ ]),
31213
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.debounce)()
31214
+ ], UIImagePropertiesForm.prototype, "onImageWidthChange", null);
31215
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31216
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready'),
31217
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)('state.values.imageSrc')
31218
+ ], UIImagePropertiesForm.prototype, "onStateValuesImageSrcChange", null);
31219
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31220
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.hook)('ready')
31221
+ ], UIImagePropertiesForm.prototype, "hideFieldByOptions", null);
31222
+ UIImagePropertiesForm = (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
31223
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_8__/* .component */ .s
31224
+ ], UIImagePropertiesForm);
31225
+
31132
31226
 
31133
31227
 
31134
31228
  /***/ }),
31135
31229
 
31136
- /***/ 75263:
31230
+ /***/ 33403:
31137
31231
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31138
31232
 
31139
31233
  "use strict";
31140
31234
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31141
- /* harmony export */ J: function() { return /* binding */ mainTab; }
31235
+ /* harmony export */ k: function() { return /* binding */ UIImageMainTab; }
31142
31236
  /* harmony export */ });
31143
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31237
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31635);
31238
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24767);
31239
+ /* harmony import */ var jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71151);
31240
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
31241
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31242
+ /* harmony import */ var jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6455);
31144
31243
  /*!
31145
31244
  * Jodit Editor (https://xdsoft.net/jodit/)
31146
31245
  * Released under MIT see LICENSE.txt in the project root for license information.
31147
31246
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31148
31247
  */
31149
31248
 
31150
- function mainTab(editor) {
31151
- 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;
31152
- return editor.c.fromHTML(`<div style="${!opt.image.editSrc ? 'display:none' : ''}" class="jodit-form__group">
31153
- <label>${i18n('Src')}</label>
31249
+
31250
+
31251
+
31252
+
31253
+
31254
+ /** @private */
31255
+ let UIImageMainTab = class UIImageMainTab extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_3__/* .UIGroup */ .U {
31256
+ className() {
31257
+ return 'UIImageMainTab';
31258
+ }
31259
+ appendChildToContainer() {
31260
+ // Do nothing
31261
+ }
31262
+ constructor(view, state, handlers) {
31263
+ super(view);
31264
+ this.state = state;
31265
+ this.handlers = handlers;
31266
+ }
31267
+ render() {
31268
+ return `<div class="jodit-form__group &__editSrc">
31269
+ <label>~Src~</label>
31154
31270
  <div class="jodit-input_group">
31155
- <input data-ref="imageSrc" class="jodit-input" type="text"/>
31156
- <div
31157
- class="jodit-input_group-buttons"
31158
- style="${hasFbUrl ? '' : 'display: none'}"
31159
- >
31160
- <a
31161
- data-ref="changeImage"
31162
- class="jodit-button"
31163
- >${gi('image')}</a>
31164
- <a
31165
- data-ref="editImage"
31166
- class="jodit-button"
31167
- style="${hasEditor ? '' : 'display: none'}"
31168
- >${gi('crop')}</a>
31271
+ <input class="jodit-input &__imageSrc" type="text"/>
31272
+ <div class="jodit-input_group-buttons &__fixImage">
31273
+ <a class="jodit-button &__changeImage">*image*</a>
31274
+ <a class="jodit-button &__editImage">*crop*</a>
31169
31275
  </div>
31170
31276
  </div>
31171
31277
  </div>
31172
- <div style="${!opt.image.editTitle ? 'display:none' : ''}" class="jodit-form__group">
31173
- <label>${i18n('Title')}</label>
31174
- <input data-ref="imageTitle" type="text" class="jodit-input"/>
31278
+ <div class="jodit-form__group &__editTitle">
31279
+ <label>~Title~</label>
31280
+ <input type="text" class="jodit-input &__imageTitle"/>
31175
31281
  </div>
31176
- <div style="${!opt.image.editAlt ? 'display:none' : ''}" class="jodit-form__group">
31177
- <label>${i18n('Alternative')}</label>
31178
- <input data-ref="imageAlt" type="text" class="jodit-input"/>
31282
+ <div class="jodit-form__group &__editAlt">
31283
+ <label>~Alternative~</label>
31284
+ <input type="text" class="jodit-input &__imageAlt"/>
31179
31285
  </div>
31180
- <div style="${!opt.image.editLink ? 'display:none' : ''}" class="jodit-form__group">
31181
- <label>${i18n('Link')}</label>
31182
- <input data-ref="imageLink" type="text" class="jodit-input"/>
31286
+ <div class="jodit-form__group &__editLink">
31287
+ <label>~Link~</label>
31288
+ <input type="text" class="jodit-input &__imageLink"/>
31183
31289
  </div>
31184
- <div style="${!opt.image.editLink ? 'display:none' : ''}" class="jodit-form__group">
31290
+ <div class="jodit-form__group &__editLinkTarget">
31185
31291
  <label class="jodit_vertical_middle">
31186
- <input data-ref="imageLinkOpenInNewTab" type="checkbox" class="jodit-checkbox"/>
31187
- <span>${i18n('Open link in new tab')}</span>
31292
+ <input type="checkbox" class="jodit-checkbox &__imageLinkOpenInNewTab"/>
31293
+ <span>~Open link in new tab~</span>
31188
31294
  </label>
31189
- </div>`);
31190
- }
31295
+ </div>`;
31296
+ }
31297
+ async onStateImageSrcChange() {
31298
+ const imageSrc = this.getElm('imageSrc');
31299
+ imageSrc.value = this.state.values.imageSrc;
31300
+ }
31301
+ onImageSrcChange() {
31302
+ this.state.values.imageSrc = this.getElm('imageSrc').value;
31303
+ }
31304
+ /**
31305
+ * Open image editor
31306
+ */
31307
+ onEditImageClick(e) {
31308
+ this.handlers.openImageEditor();
31309
+ e.stopPropagation();
31310
+ }
31311
+ /**
31312
+ * Open popup with filebrowser/uploader buttons for image
31313
+ */
31314
+ onChangeImageClick(e) {
31315
+ this.handlers.openImagePopup(this.getElm('changeImage'));
31316
+ e.stopPropagation();
31317
+ }
31318
+ onStateTitleChange() {
31319
+ const title = this.getElm('imageTitle');
31320
+ title.value = this.state.values.imageTitle;
31321
+ }
31322
+ onTitleChange() {
31323
+ this.state.values.imageTitle = this.getElm('imageTitle').value;
31324
+ }
31325
+ onStateAltChange() {
31326
+ const alt = this.getElm('imageAlt');
31327
+ alt.value = this.state.values.imageAlt;
31328
+ }
31329
+ onAltChange() {
31330
+ this.state.values.imageAlt = this.getElm('imageAlt').value;
31331
+ }
31332
+ onStateImageLinkChange() {
31333
+ const imageLink = this.getElm('imageLink');
31334
+ imageLink.value = this.state.values.imageLink;
31335
+ }
31336
+ onImageLinkChange() {
31337
+ this.state.values.imageLink = this.getElm('imageLink').value;
31338
+ }
31339
+ onStateImageLinkOpenInNewTabChange() {
31340
+ const imageLinkOpenInNewTab = this.getElm('imageLinkOpenInNewTab');
31341
+ imageLinkOpenInNewTab.checked = this.state.values.imageLinkOpenInNewTab;
31342
+ }
31343
+ onImageLinkOpenInNewTabChange() {
31344
+ this.state.values.imageLinkOpenInNewTab = this.getElm('imageLinkOpenInNewTab').checked;
31345
+ }
31346
+ hideFieldByOptions() {
31347
+ const o = this.j.o;
31348
+ const opt = o.image;
31349
+ [
31350
+ ['editSrc', 'editSrc'],
31351
+ ['editTitle', 'editTitle'],
31352
+ ['editAlt', 'editAlt'],
31353
+ ['editLink', 'editLink'],
31354
+ ['editLink', 'editLinkTarget'],
31355
+ ['useImageEditor', 'editImage']
31356
+ ].forEach(([optKey, elmKey]) => {
31357
+ const elm = this.getElm(elmKey);
31358
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display', opt[optKey] ? null : 'none');
31359
+ });
31360
+ const changeImage = this.getElm('changeImage');
31361
+ const needShowChangeImage = Boolean(o.filebrowser.ajax.url || o.uploader.url);
31362
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(changeImage, 'display', needShowChangeImage ? null : 'none');
31363
+ const editImage = this.getElm('editImage');
31364
+ const needShowEditImage = Boolean(o.filebrowser.ajax.url) && opt.useImageEditor;
31365
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(editImage, 'display', needShowEditImage ? null : 'none');
31366
+ const fixImage = this.getElm('fixImage');
31367
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(fixImage, 'display', needShowChangeImage || needShowEditImage ? null : 'none');
31368
+ }
31369
+ };
31370
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31371
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageSrc')
31372
+ ], UIImageMainTab.prototype, "onStateImageSrcChange", null);
31373
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31374
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageSrc:change')
31375
+ ], UIImageMainTab.prototype, "onImageSrcChange", null);
31376
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31377
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('editImage:click')
31378
+ ], UIImageMainTab.prototype, "onEditImageClick", null);
31379
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31380
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('changeImage:click')
31381
+ ], UIImageMainTab.prototype, "onChangeImageClick", null);
31382
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31383
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageTitle')
31384
+ ], UIImageMainTab.prototype, "onStateTitleChange", null);
31385
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31386
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageTitle:change')
31387
+ ], UIImageMainTab.prototype, "onTitleChange", null);
31388
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31389
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageAlt')
31390
+ ], UIImageMainTab.prototype, "onStateAltChange", null);
31391
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31392
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageAlt:change')
31393
+ ], UIImageMainTab.prototype, "onAltChange", null);
31394
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31395
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageLink')
31396
+ ], UIImageMainTab.prototype, "onStateImageLinkChange", null);
31397
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31398
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageLink:change')
31399
+ ], UIImageMainTab.prototype, "onImageLinkChange", null);
31400
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31401
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.imageLinkOpenInNewTab')
31402
+ ], UIImageMainTab.prototype, "onStateImageLinkOpenInNewTabChange", null);
31403
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31404
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('imageLinkOpenInNewTab:change')
31405
+ ], UIImageMainTab.prototype, "onImageLinkOpenInNewTabChange", null);
31406
+ (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31407
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready')
31408
+ ], UIImageMainTab.prototype, "hideFieldByOptions", null);
31409
+ UIImageMainTab = (0,tslib__WEBPACK_IMPORTED_MODULE_4__/* .__decorate */ .Cg)([
31410
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_5__/* .component */ .s
31411
+ ], UIImageMainTab);
31412
+
31191
31413
 
31192
31414
 
31193
31415
  /***/ }),
31194
31416
 
31195
- /***/ 57837:
31417
+ /***/ 46681:
31196
31418
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31197
31419
 
31198
31420
  "use strict";
31199
31421
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31200
- /* harmony export */ b: function() { return /* binding */ positionTab; }
31422
+ /* harmony export */ _: function() { return /* binding */ UIImagePositionTab; }
31201
31423
  /* harmony export */ });
31202
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(931);
31424
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(31635);
31425
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(24767);
31426
+ /* harmony import */ var jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71151);
31427
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(66927);
31428
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65147);
31429
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(98253);
31430
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26150);
31431
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29780);
31432
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(931);
31433
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9645);
31203
31434
  /*!
31204
31435
  * Jodit Editor (https://xdsoft.net/jodit/)
31205
31436
  * Released under MIT see LICENSE.txt in the project root for license information.
31206
31437
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31207
31438
  */
31208
31439
 
31209
- function positionTab(editor) {
31210
- 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);
31211
- const classInput = [];
31212
- if (opt.image.availableClasses.length > 0) {
31213
- classInput.push('<select data-ref="classes" class="jodit-input jodit-select">');
31214
- opt.image.availableClasses.forEach(item => {
31215
- if (typeof item === 'string') {
31216
- classInput.push(`<option value="${item}">${item}</option>`);
31217
- }
31218
- else {
31219
- classInput.push(`<option value="${item[0]}">${item[1]}</option>`);
31220
- }
31221
- });
31222
- classInput.push('</select>');
31440
+
31441
+
31442
+
31443
+
31444
+
31445
+
31446
+
31447
+
31448
+
31449
+ /** @private */
31450
+ let UIImagePositionTab = class UIImagePositionTab extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_4__/* .UIElement */ .D {
31451
+ className() {
31452
+ return 'UIImagePositionTab';
31223
31453
  }
31224
- else {
31225
- classInput.push('<input data-ref="classes" type="text" class="jodit-input"/>');
31454
+ constructor(jodit, state, handlers) {
31455
+ super(jodit, {
31456
+ availableClasses: jodit.o.image.availableClasses
31457
+ });
31458
+ this.state = state;
31459
+ this.handlers = handlers;
31226
31460
  }
31227
- return editor.c.fromHTML(`<div style="${!opt.image.editMargins ? 'display:none' : ''}" class="jodit-form__group">
31228
- <label>${i18n('Margins')}</label>
31461
+ render({ availableClasses }) {
31462
+ return `<div class="jodit-form__group &__editMargins">
31463
+ <label>~Margins~</label>
31229
31464
  <div class="jodit-grid jodit_vertical_middle">
31230
- <input class="jodit_col-lg-1-5 jodit-input" data-ref="marginTop" type="text" placeholder="${i18n('top')}"/>
31231
- <a style="text-align: center;" data-ref="lockMargin" class="jodit-properties__lock jodit_col-lg-1-5">${gi('lock')}</a>
31232
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginRight" type="text" placeholder="${i18n('right')}"/>
31233
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginBottom" type="text" placeholder="${i18n('bottom')}"/>
31234
- <input disabled="true" class="jodit_col-lg-1-5 jodit-input" data-ref="marginLeft" type="text" placeholder="${i18n('left')}"/>
31465
+ <input class="jodit_col-lg-1-5 jodit-input &__marginTop" type="text" placeholder="~top~"/>
31466
+ <a style="text-align: center;" class="jodit-properties__lock jodit_col-lg-1-5 &__lockMargin">*lock*</a>
31467
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginRight" type="text" placeholder="~right~"/>
31468
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginBottom" type="text" placeholder="~bottom~"/>
31469
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginLeft" type="text" placeholder="~left~"/>
31235
31470
  </div>
31236
31471
  </div>
31237
- <div
31238
- style="${!opt.image.editAlign ? 'display:none' : ''}"
31239
- class="jodit-form__group"
31240
- >
31241
- <label>${i18n('Align')}</label>
31242
- <select data-ref="align" class="jodit-select">
31243
- <option value="">${i18n('--Not Set--')}</option>
31244
- <option value="left">${i18n('Left')}</option>
31245
- <option value="center">${i18n('Center')}</option>
31246
- <option value="right">${i18n('Right')}</option>
31472
+ <div class="jodit-form__group &__editAlign">
31473
+ <label>~Align~</label>
31474
+ <select class="jodit-select &__align">
31475
+ <option value="">~--Not Set--~</option>
31476
+ <option value="left">~Left~</option>
31477
+ <option value="center">~Center~</option>
31478
+ <option value="right">~Right~</option>
31247
31479
  </select>
31248
31480
  </div>
31249
- <div style="${!opt.image.editStyle ? 'display:none' : ''}" class="jodit-form__group">
31250
- <label>${i18n('Styles')}</label>
31251
- <input data-ref="style" type="text" class="jodit-input"/>
31481
+ <div class="jodit-form__group &__editStyle">
31482
+ <label>~Styles~</label>
31483
+ <input type="text" class="jodit-input &__style"/>
31252
31484
  </div>
31253
- <div style="${!opt.image.editClass ? 'display:none' : ''}" class="jodit-form__group">
31254
- <label>${i18n('Classes')}</label>
31255
- ${classInput.join('')}
31485
+ <div class="jodit-form__group &__editClass">
31486
+ <label>~Classes~</label>
31487
+ ${(() => {
31488
+ const classInput = [];
31489
+ if (availableClasses && availableClasses.length > 0) {
31490
+ classInput.push('<select class="jodit-input jodit-select &__classes">');
31491
+ availableClasses.forEach(item => {
31492
+ if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_7__/* .isString */ .K)(item)) {
31493
+ classInput.push(`<option value="${item}">${item}</option>`);
31494
+ }
31495
+ else {
31496
+ classInput.push(`<option value="${item[0]}">${item[1]}</option>`);
31497
+ }
31498
+ });
31499
+ classInput.push('</select>');
31500
+ }
31501
+ else {
31502
+ classInput.push('<input type="text" class="jodit-input &__classes"/>');
31503
+ }
31504
+ return classInput.join('');
31505
+ })()}
31256
31506
  </div>
31257
- <div style="${!opt.image.editId ? 'display:none' : ''}" class="jodit-form__group">
31507
+ <div class="jodit-form__group &__editId">
31258
31508
  <label>Id</label>
31259
- <input data-ref="id" type="text" class="jodit-input"/>
31509
+ <input type="text" class="jodit-input &__id"/>
31260
31510
  </div>
31261
31511
  <div
31262
- style="${!opt.image.editBorderRadius ? 'display:none' : ''}"
31263
- class="jodit-form__group"
31512
+ class="jodit-form__group &__editBorderRadius"
31264
31513
  >
31265
- <label>${i18n('Border radius')}</label>
31266
- <input data-ref="borderRadius" type="number" class="jodit-input"/>
31267
- </div>`);
31514
+ <label>~Border radius~</label>
31515
+ <input type="number" class="jodit-input &__borderRadius"/>
31516
+ </div>`;
31517
+ }
31518
+ onStateAlignChange() {
31519
+ const align = this.getElm('align');
31520
+ align.value = this.state.values.align;
31521
+ }
31522
+ onChangeAlign() {
31523
+ const align = this.getElm('align');
31524
+ this.state.values.align = align.value;
31525
+ }
31526
+ onStateValuesBorderRadiusChange() {
31527
+ const borderRadius = this.getElm('borderRadius');
31528
+ borderRadius.value = this.state.values.borderRadius.toString();
31529
+ }
31530
+ onChangeBorderRadius() {
31531
+ const borderRadius = this.getElm('borderRadius');
31532
+ this.state.values.borderRadius = parseFloat(borderRadius.value);
31533
+ }
31534
+ onStateValuesIdChange() {
31535
+ const id = this.getElm('id');
31536
+ id.value = this.state.values.id;
31537
+ }
31538
+ onChangeId() {
31539
+ const id = this.getElm('id');
31540
+ this.state.values.id = id.value;
31541
+ }
31542
+ onStateValuesStyleChange() {
31543
+ const style = this.getElm('style');
31544
+ style.value = this.state.values.style;
31545
+ }
31546
+ onChangeStyle() {
31547
+ const style = this.getElm('style');
31548
+ this.state.values.style = style.value;
31549
+ }
31550
+ onStateValuesClassesChange() {
31551
+ const classes = this.getElm('classes');
31552
+ classes.value = this.state.values.classes;
31553
+ }
31554
+ onChangClasses() {
31555
+ const classes = this.getElm('classes');
31556
+ this.state.values.classes = classes.value;
31557
+ }
31558
+ onLockMarginClick(e) {
31559
+ this.state.marginIsLocked = !this.state.marginIsLocked;
31560
+ e.preventDefault();
31561
+ }
31562
+ onChangeMarginIsLocked() {
31563
+ const marginBottom = this.getElm('marginBottom');
31564
+ const marginRight = this.getElm('marginRight');
31565
+ const marginLeft = this.getElm('marginLeft');
31566
+ const lockMargin = this.getElm('lockMargin');
31567
+ [marginRight, marginBottom, marginLeft].forEach(elm => {
31568
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_3__/* .attr */ .C)(elm, 'disabled', this.state.marginIsLocked || null);
31569
+ });
31570
+ lockMargin.innerHTML = jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__/* .Icon */ .I.get(this.state.marginIsLocked ? 'lock' : 'unlock');
31571
+ if (this.state.marginIsLocked) {
31572
+ const marginTop = this.state.values.marginTop;
31573
+ this.state.values.marginRight = marginTop;
31574
+ this.state.values.marginBottom = marginTop;
31575
+ this.state.values.marginLeft = marginTop;
31576
+ }
31577
+ }
31578
+ onStateValuesMarginChange() {
31579
+ const marginTop = this.getElm('marginTop');
31580
+ const marginRight = this.getElm('marginRight');
31581
+ const marginBottom = this.getElm('marginBottom');
31582
+ const marginLeft = this.getElm('marginLeft');
31583
+ marginTop.value = this.state.values.marginTop.toString();
31584
+ marginRight.value = this.state.values.marginRight.toString();
31585
+ marginBottom.value = this.state.values.marginBottom.toString();
31586
+ marginLeft.value = this.state.values.marginLeft.toString();
31587
+ }
31588
+ onChangeMargin() {
31589
+ const marginTop = this.getElm('marginTop');
31590
+ const marginRight = this.getElm('marginRight');
31591
+ const marginBottom = this.getElm('marginBottom');
31592
+ const marginLeft = this.getElm('marginLeft');
31593
+ this.state.values.marginTop = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginTop.value);
31594
+ if (this.state.marginIsLocked) {
31595
+ this.state.values.marginRight = this.state.values.marginTop;
31596
+ this.state.values.marginBottom = this.state.values.marginTop;
31597
+ this.state.values.marginLeft = this.state.values.marginTop;
31598
+ }
31599
+ else {
31600
+ this.state.values.marginRight = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginRight.value);
31601
+ this.state.values.marginBottom = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginBottom.value);
31602
+ this.state.values.marginLeft = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_6__/* .normalSizeFromString */ .G)(marginLeft.value);
31603
+ }
31604
+ }
31605
+ hideFieldByOptions() {
31606
+ const opt = this.j.o.image;
31607
+ [
31608
+ ['editMargins', 'editMargins'],
31609
+ ['editAlign', 'editAlign'],
31610
+ ['editStyle', 'editStyle'],
31611
+ ['editClass', 'editClass'],
31612
+ ['editId', 'editId'],
31613
+ ['editBorderRadius', 'editBorderRadius']
31614
+ ].forEach(([optKey, elmKey]) => {
31615
+ const elm = this.getElm(elmKey);
31616
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display', opt[optKey] ? null : 'none');
31617
+ });
31618
+ }
31619
+ };
31620
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31621
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
31622
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.align')
31623
+ ], UIImagePositionTab.prototype, "onStateAlignChange", null);
31624
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31625
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('align:change')
31626
+ ], UIImagePositionTab.prototype, "onChangeAlign", null);
31627
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31628
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
31629
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.borderRadius')
31630
+ ], UIImagePositionTab.prototype, "onStateValuesBorderRadiusChange", null);
31631
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31632
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('borderRadius:change')
31633
+ ], UIImagePositionTab.prototype, "onChangeBorderRadius", null);
31634
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31635
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
31636
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.id')
31637
+ ], UIImagePositionTab.prototype, "onStateValuesIdChange", null);
31638
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31639
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('id:change')
31640
+ ], UIImagePositionTab.prototype, "onChangeId", null);
31641
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31642
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
31643
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.style')
31644
+ ], UIImagePositionTab.prototype, "onStateValuesStyleChange", null);
31645
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31646
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('style:change')
31647
+ ], UIImagePositionTab.prototype, "onChangeStyle", null);
31648
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31649
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
31650
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.values.classes')
31651
+ ], UIImagePositionTab.prototype, "onStateValuesClassesChange", null);
31652
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31653
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('classes:change')
31654
+ ], UIImagePositionTab.prototype, "onChangClasses", null);
31655
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31656
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('lockMargin:click')
31657
+ ], UIImagePositionTab.prototype, "onLockMarginClick", null);
31658
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31659
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
31660
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)('state.marginIsLocked')
31661
+ ], UIImagePositionTab.prototype, "onChangeMarginIsLocked", null);
31662
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31663
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready'),
31664
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)([
31665
+ 'state.values.marginTop',
31666
+ 'state.values.marginRight',
31667
+ 'state.values.marginBottom',
31668
+ 'state.values.marginLeft'
31669
+ ])
31670
+ ], UIImagePositionTab.prototype, "onStateValuesMarginChange", null);
31671
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31672
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_1__/* .watch */ .w)([
31673
+ 'marginTop:change',
31674
+ 'marginRight:change',
31675
+ 'marginBottom:change',
31676
+ 'marginLeft:change'
31677
+ ])
31678
+ ], UIImagePositionTab.prototype, "onChangeMargin", null);
31679
+ (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31680
+ (0,jodit_core_decorators_hook_hook__WEBPACK_IMPORTED_MODULE_0__/* .hook */ .A)('ready')
31681
+ ], UIImagePositionTab.prototype, "hideFieldByOptions", null);
31682
+ UIImagePositionTab = (0,tslib__WEBPACK_IMPORTED_MODULE_8__/* .__decorate */ .Cg)([
31683
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_9__/* .component */ .s
31684
+ ], UIImagePositionTab);
31685
+
31686
+
31687
+
31688
+ /***/ }),
31689
+
31690
+ /***/ 80778:
31691
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31692
+
31693
+ "use strict";
31694
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31695
+ /* harmony export */ v: function() { return /* binding */ openImageEditorDialog; }
31696
+ /* harmony export */ });
31697
+ /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(98253);
31698
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
31699
+ /* harmony import */ var jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53804);
31700
+ /*!
31701
+ * Jodit Editor (https://xdsoft.net/jodit/)
31702
+ * Released under MIT see LICENSE.txt in the project root for license information.
31703
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31704
+ */
31705
+
31706
+
31707
+
31708
+ /**
31709
+ * Open image editor dialog
31710
+ * @private
31711
+ */
31712
+ function openImageEditorDialog(j, state) {
31713
+ const url = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(state.image, 'src') || '', a = j.c.element('a'), loadExternal = () => {
31714
+ if (a.host !== location.host) {
31715
+ j.confirm('You can only edit your own images. Download this image on the host?', yes => {
31716
+ if (yes && j.uploader) {
31717
+ j.uploader.uploadRemoteImage(a.href.toString(), resp => {
31718
+ j.alert('The image has been successfully uploaded to the host!', () => {
31719
+ if ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .K)(resp.newfilename)) {
31720
+ state.values.imageSrc =
31721
+ resp.baseurl +
31722
+ resp.newfilename;
31723
+ }
31724
+ });
31725
+ }, error => {
31726
+ j.alert('There was an error loading %s', error.message);
31727
+ });
31728
+ }
31729
+ });
31730
+ return;
31731
+ }
31732
+ };
31733
+ a.href = url;
31734
+ j.filebrowser.dataProvider
31735
+ .getPathByUrl(a.href.toString())
31736
+ .then(resp => {
31737
+ jodit_modules_image_editor_image_editor__WEBPACK_IMPORTED_MODULE_1__/* .openImageEditor */ .B.call(j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
31738
+ const timestamp = new Date().getTime();
31739
+ state.values.imageSrc =
31740
+ url +
31741
+ (url.indexOf('?') !== -1 ? '' : '?') +
31742
+ '&_tmp=' +
31743
+ timestamp.toString();
31744
+ }, error => {
31745
+ j.alert(error.message);
31746
+ });
31747
+ })
31748
+ .catch(error => {
31749
+ j.alert(error.message, loadExternal);
31750
+ });
31751
+ }
31752
+
31753
+
31754
+ /***/ }),
31755
+
31756
+ /***/ 33733:
31757
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31758
+
31759
+ "use strict";
31760
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31761
+ /* harmony export */ q: function() { return /* binding */ openImagePopup; }
31762
+ /* harmony export */ });
31763
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(37923);
31764
+ /* harmony import */ var jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27594);
31765
+ /* harmony import */ var jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80071);
31766
+ /* harmony import */ var jodit_modules_widget_file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10067);
31767
+ /*!
31768
+ * Jodit Editor (https://xdsoft.net/jodit/)
31769
+ * Released under MIT see LICENSE.txt in the project root for license information.
31770
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31771
+ */
31772
+
31773
+
31774
+
31775
+
31776
+ /** @private */
31777
+ function openImagePopup(j, dialog, state, button) {
31778
+ const popup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_0__/* .Popup */ .z(dialog);
31779
+ const closePopup = () => {
31780
+ popup.close();
31781
+ popup.destruct();
31782
+ };
31783
+ popup
31784
+ .setContent((0,jodit_modules_widget_file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__/* .FileSelectorWidget */ .k)(j, {
31785
+ upload: (data) => {
31786
+ if (data.files && data.files.length) {
31787
+ state.values.imageSrc =
31788
+ data.baseurl + data.files[0];
31789
+ }
31790
+ closePopup();
31791
+ },
31792
+ filebrowser: async (data) => {
31793
+ if (data && (0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_2__/* .isArray */ .c)(data.files) && data.files.length) {
31794
+ state.values.imageSrc = data.files[0];
31795
+ closePopup();
31796
+ }
31797
+ }
31798
+ }, state.image, closePopup))
31799
+ .open(() => (0,jodit_core_helpers_size_position__WEBPACK_IMPORTED_MODULE_3__/* .position */ .G)(button));
31800
+ }
31801
+
31802
+
31803
+ /***/ }),
31804
+
31805
+ /***/ 9645:
31806
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31807
+
31808
+ "use strict";
31809
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31810
+ /* harmony export */ G: function() { return /* binding */ normalSizeFromString; },
31811
+ /* harmony export */ n: function() { return /* binding */ normalSizeToString; }
31812
+ /* harmony export */ });
31813
+ /* harmony import */ var jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2461);
31814
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59101);
31815
+ /*!
31816
+ * Jodit Editor (https://xdsoft.net/jodit/)
31817
+ * Released under MIT see LICENSE.txt in the project root for license information.
31818
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31819
+ */
31820
+
31821
+
31822
+ /** @private */
31823
+ const normalSizeFromString = (value) => {
31824
+ return /^[-+]?[0-9.]+(px)?$/.test(value.toString())
31825
+ ? parseFloat(value.toString())
31826
+ : value;
31827
+ };
31828
+ /** @private */
31829
+ const normalSizeToString = (value) => {
31830
+ if ((0,jodit_core_helpers_checker_is_number__WEBPACK_IMPORTED_MODULE_1__/* .isNumber */ .E)(value)) {
31831
+ return value ? value + 'px' : value.toString();
31832
+ }
31833
+ value = (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_0__/* .trim */ .Bq)(value);
31834
+ return /^[0-9]+$/.test(value) ? value + 'px' : value;
31835
+ };
31836
+
31837
+
31838
+ /***/ }),
31839
+
31840
+ /***/ 30393:
31841
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31842
+
31843
+ "use strict";
31844
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31845
+ /* harmony export */ j: function() { return /* binding */ applyValuesToImage; }
31846
+ /* harmony export */ });
31847
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
31848
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97369);
31849
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88269);
31850
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78139);
31851
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58972);
31852
+ /*!
31853
+ * Jodit Editor (https://xdsoft.net/jodit/)
31854
+ * Released under MIT see LICENSE.txt in the project root for license information.
31855
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31856
+ */
31857
+
31858
+
31859
+
31860
+
31861
+
31862
+ /**
31863
+ * Apply form's values to image
31864
+ * @private
31865
+ */
31866
+ function applyValuesToImage(j, state, image) {
31867
+ const { style, imageSrc, borderRadius, imageTitle, imageAlt, imageLink, imageWidth, imageHeight, marginTop, marginRight, marginBottom, marginLeft, imageLinkOpenInNewTab, align, classes, id } = state.values;
31868
+ const opt = j.o;
31869
+ // styles
31870
+ if (opt.image.editStyle) {
31871
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'style', style || null);
31872
+ }
31873
+ // Src
31874
+ if (imageSrc) {
31875
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'src', imageSrc);
31876
+ }
31877
+ else {
31878
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.safeRemove(image);
31879
+ return;
31880
+ }
31881
+ // Border radius
31882
+ image.style.borderRadius = borderRadius ? borderRadius + 'px' : '';
31883
+ // Title
31884
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'title', imageTitle || null);
31885
+ // Alt
31886
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'alt', imageAlt || null);
31887
+ // Link
31888
+ (0,_link__WEBPACK_IMPORTED_MODULE_2__/* .applyLink */ .j)(j, image, imageLink, imageLinkOpenInNewTab);
31889
+ // Size
31890
+ (0,_size__WEBPACK_IMPORTED_MODULE_4__/* .applySize */ .q)(image, imageWidth, imageHeight, state.sizeIsLocked);
31891
+ // Margin
31892
+ if (j.o.image.editMargins) {
31893
+ (0,_margin__WEBPACK_IMPORTED_MODULE_3__/* .applyMargin */ .N)(j, marginTop, marginRight, marginBottom, marginLeft, image, state.marginIsLocked);
31894
+ }
31895
+ if (opt.image.editClass) {
31896
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'class', classes || null);
31897
+ }
31898
+ if (opt.image.editId) {
31899
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
31900
+ }
31901
+ if (opt.image.editAlign) {
31902
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
31903
+ }
31904
+ }
31905
+
31906
+
31907
+ /***/ }),
31908
+
31909
+ /***/ 88269:
31910
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31911
+
31912
+ "use strict";
31913
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31914
+ /* harmony export */ j: function() { return /* binding */ applyLink; }
31915
+ /* harmony export */ });
31916
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55186);
31917
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26150);
31918
+ /*!
31919
+ * Jodit Editor (https://xdsoft.net/jodit/)
31920
+ * Released under MIT see LICENSE.txt in the project root for license information.
31921
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31922
+ */
31923
+
31924
+
31925
+ /** @private */
31926
+ function applyLink(j, image, imageLink, imageLinkOpenInNewTab) {
31927
+ // Link
31928
+ let link = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.closest(image, 'a', j.editor);
31929
+ if (imageLink) {
31930
+ if (!link) {
31931
+ link = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.wrap(image, 'a', j.createInside);
31932
+ }
31933
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(link, 'href', imageLink);
31934
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__/* .attr */ .C)(link, 'target', imageLinkOpenInNewTab ? '_blank' : null);
31935
+ }
31936
+ else {
31937
+ if (link && link.parentNode) {
31938
+ link.parentNode.replaceChild(image, link);
31939
+ }
31940
+ }
31941
+ }
31942
+
31943
+
31944
+ /***/ }),
31945
+
31946
+ /***/ 78139:
31947
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31948
+
31949
+ "use strict";
31950
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31951
+ /* harmony export */ N: function() { return /* binding */ applyMargin; }
31952
+ /* harmony export */ });
31953
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38322);
31954
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9645);
31955
+ /*!
31956
+ * Jodit Editor (https://xdsoft.net/jodit/)
31957
+ * Released under MIT see LICENSE.txt in the project root for license information.
31958
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
31959
+ */
31960
+
31961
+
31962
+ /** @private */
31963
+ function applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, image, marginIsLocked) {
31964
+ const margins = [marginTop, marginRight, marginBottom, marginLeft];
31965
+ const applyMargin = (key, value) => {
31966
+ const oldValue = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__/* .css */ .A)(image, key);
31967
+ const v = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_0__/* .normalSizeToString */ .n)(value);
31968
+ if (oldValue.toString() !== v.toString()) {
31969
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__/* .css */ .A)(image, key, v);
31970
+ }
31971
+ };
31972
+ if (!marginIsLocked) {
31973
+ const sides = [
31974
+ 'margin-top',
31975
+ 'margin-right',
31976
+ 'margin-bottom',
31977
+ 'margin-left'
31978
+ ];
31979
+ margins.forEach((margin, index) => {
31980
+ const side = sides[index];
31981
+ applyMargin(side, margin);
31982
+ });
31983
+ }
31984
+ else {
31985
+ applyMargin('margin', marginTop);
31986
+ }
31987
+ }
31988
+
31989
+
31990
+ /***/ }),
31991
+
31992
+ /***/ 58972:
31993
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
31994
+
31995
+ "use strict";
31996
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31997
+ /* harmony export */ q: function() { return /* binding */ applySize; }
31998
+ /* harmony export */ });
31999
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26150);
32000
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38322);
32001
+ /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9645);
32002
+ /*!
32003
+ * Jodit Editor (https://xdsoft.net/jodit/)
32004
+ * Released under MIT see LICENSE.txt in the project root for license information.
32005
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
32006
+ */
32007
+
32008
+
32009
+
32010
+ /** @private */
32011
+ function applySize(image, imageWidth, imageHeight, sizeIsLocked) {
32012
+ // Size
32013
+ if (imageWidth !== image.offsetWidth ||
32014
+ imageHeight !== image.offsetHeight) {
32015
+ const updatedWidth = imageWidth ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeToString */ .n)(imageWidth) : null;
32016
+ let updatedHeight = imageHeight
32017
+ ? (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__/* .normalSizeToString */ .n)(imageHeight)
32018
+ : null;
32019
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__/* .css */ .A)(image, {
32020
+ width: updatedWidth,
32021
+ height: updatedWidth && sizeIsLocked ? null : updatedHeight
32022
+ });
32023
+ (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);
32024
+ if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'width') || sizeIsLocked) {
32025
+ updatedHeight = null;
32026
+ }
32027
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__/* .attr */ .C)(image, 'height', updatedHeight);
32028
+ }
31268
32029
  }
31269
32030
 
31270
32031
 
@@ -37226,7 +37987,8 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__/* .pluginSystem */ .fg.add('selec
37226
37987
  */
37227
37988
 
37228
37989
  jodit_config__WEBPACK_IMPORTED_MODULE_0__/* .Config */ .T.prototype.select = {
37229
- normalizeSelectionBeforeCutAndCopy: false
37990
+ normalizeSelectionBeforeCutAndCopy: false,
37991
+ normalizeTripleClick: true
37230
37992
  };
37231
37993
 
37232
37994
 
@@ -37302,7 +38064,7 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
37302
38064
  }
37303
38065
  }
37304
38066
  /**
37305
- * @event outsideClick(e) - when user clicked in the outside of editor
38067
+ * @event outsideClick(e) - when user clicked on the outside of editor
37306
38068
  */
37307
38069
  onOutsideClick(e) {
37308
38070
  const node = e.target;
@@ -37314,7 +38076,7 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
37314
38076
  this.j.e.fire('outsideClick', e);
37315
38077
  }
37316
38078
  }
37317
- beforeCommandCut(command) {
38079
+ beforeCommandCut() {
37318
38080
  const { s } = this.j;
37319
38081
  if (!s.isCollapsed()) {
37320
38082
  const current = s.current();
@@ -37323,13 +38085,27 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
37323
38085
  }
37324
38086
  }
37325
38087
  }
37326
- beforeCommandSelectall(command) {
38088
+ beforeCommandSelectAll() {
37327
38089
  const { s } = this.j;
37328
38090
  s.focus();
37329
38091
  s.select(this.j.editor, true);
37330
38092
  s.expandSelection();
37331
38093
  return false;
37332
38094
  }
38095
+ /**
38096
+ * Normalize selection after triple click
38097
+ */
38098
+ onTripleClickNormalizeSelection(e) {
38099
+ if (e.detail !== 3 || !this.j.o.select.normalizeTripleClick) {
38100
+ return;
38101
+ }
38102
+ const { s } = this.j;
38103
+ const { startContainer, startOffset } = s.range;
38104
+ if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(startContainer)) {
38105
+ 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) ||
38106
+ startContainer, true);
38107
+ }
38108
+ }
37333
38109
  onCopyNormalizeSelectionBound(e) {
37334
38110
  const { s, editor, o } = this.j;
37335
38111
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
@@ -37355,7 +38131,10 @@ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_3__/* .Plugin */
37355
38131
  ], select.prototype, "beforeCommandCut", null);
37356
38132
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37357
38133
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':beforeCommandSelectall'])
37358
- ], select.prototype, "beforeCommandSelectall", null);
38134
+ ], select.prototype, "beforeCommandSelectAll", null);
38135
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
38136
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':click'])
38137
+ ], select.prototype, "onTripleClickNormalizeSelection", null);
37359
38138
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37360
38139
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_0__.watch)([':copy', ':cut'])
37361
38140
  ], select.prototype, "onCopyNormalizeSelectionBound", null);