jodit 4.1.16 → 4.2.6

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 (143) 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 +1378 -546
  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 +1364 -546
  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 +1361 -546
  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 +1361 -546
  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 +1402 -482
  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/config.d.ts +22 -0
  58. package/esm/config.js +22 -0
  59. package/esm/core/async/async.js +7 -1
  60. package/esm/core/constants.js +1 -1
  61. package/esm/core/helpers/size/position.js +2 -2
  62. package/esm/core/helpers/utils/selector.d.ts +3 -1
  63. package/esm/core/helpers/utils/selector.js +3 -3
  64. package/esm/core/ui/button/tooltip/tooltip.js +2 -1
  65. package/esm/core/ui/popup/popup.js +1 -1
  66. package/esm/modules/dialog/dialog.js +1 -0
  67. package/esm/modules/file-browser/data-provider.js +4 -1
  68. package/esm/modules/file-browser/file-browser.js +9 -2
  69. package/esm/modules/image-editor/templates/form.js +6 -5
  70. package/esm/modules/toolbar/button/button.d.ts +1 -1
  71. package/esm/modules/widget/tabs/tabs.d.ts +4 -4
  72. package/esm/modules/widget/tabs/tabs.js +9 -7
  73. package/esm/plugins/ai-assistant/ai-assistant.d.ts +1 -1
  74. package/esm/plugins/ai-assistant/ai-assistant.js +3 -3
  75. package/esm/plugins/image-properties/config.d.ts +5 -83
  76. package/esm/plugins/image-properties/config.js +0 -3
  77. package/esm/plugins/image-properties/image-properties.d.ts +22 -32
  78. package/esm/plugins/image-properties/image-properties.js +133 -402
  79. package/{types/plugins/image-properties/templates/form.d.ts → esm/plugins/image-properties/readers/align.d.ts} +3 -5
  80. package/esm/plugins/image-properties/readers/align.js +24 -0
  81. package/esm/plugins/image-properties/readers/index.d.ts +12 -0
  82. package/esm/plugins/image-properties/readers/index.js +38 -0
  83. package/esm/plugins/image-properties/readers/link.d.ts +9 -0
  84. package/esm/plugins/image-properties/readers/link.js +19 -0
  85. package/esm/plugins/image-properties/readers/margin.d.ts +8 -0
  86. package/esm/plugins/image-properties/readers/margin.js +28 -0
  87. package/esm/plugins/image-properties/readers/size.d.ts +8 -0
  88. package/esm/plugins/image-properties/readers/size.js +36 -0
  89. package/esm/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
  90. package/esm/plugins/image-properties/ui/ui-image-form.js +171 -0
  91. package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
  92. package/esm/plugins/image-properties/ui/ui-image-main-tab.js +179 -0
  93. package/esm/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
  94. package/esm/plugins/image-properties/ui/ui-image-position-tab.js +261 -0
  95. package/esm/plugins/image-properties/{templates/main-tab.d.ts → utils/open-image-editor.d.ts} +5 -3
  96. package/esm/plugins/image-properties/utils/open-image-editor.js +52 -0
  97. package/esm/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
  98. package/esm/plugins/image-properties/utils/open-image-popup.js +34 -0
  99. package/esm/plugins/image-properties/utils/utils.d.ts +9 -0
  100. package/esm/plugins/image-properties/utils/utils.js +21 -0
  101. package/esm/plugins/image-properties/writers/index.d.ts +12 -0
  102. package/esm/plugins/image-properties/writers/index.js +53 -0
  103. package/esm/plugins/image-properties/{templates/form.d.ts → writers/link.d.ts} +2 -4
  104. package/esm/plugins/image-properties/writers/link.js +24 -0
  105. package/esm/plugins/image-properties/writers/margin.d.ts +8 -0
  106. package/esm/plugins/image-properties/writers/margin.js +33 -0
  107. package/esm/plugins/image-properties/writers/size.d.ts +7 -0
  108. package/esm/plugins/image-properties/writers/size.js +28 -0
  109. package/esm/plugins/select/config.d.ts +7 -0
  110. package/esm/plugins/select/config.js +2 -1
  111. package/esm/plugins/select/select.d.ts +7 -3
  112. package/esm/plugins/select/select.js +21 -4
  113. package/esm/types/ui.d.ts +1 -1
  114. package/package.json +1 -1
  115. package/types/config.d.ts +22 -0
  116. package/types/core/helpers/utils/selector.d.ts +3 -1
  117. package/types/modules/toolbar/button/button.d.ts +1 -1
  118. package/types/modules/widget/tabs/tabs.d.ts +4 -4
  119. package/types/plugins/ai-assistant/ai-assistant.d.ts +1 -1
  120. package/types/plugins/image-properties/config.d.ts +5 -83
  121. package/types/plugins/image-properties/image-properties.d.ts +22 -32
  122. package/types/plugins/image-properties/{templates/main-tab.d.ts → readers/align.d.ts} +3 -5
  123. package/types/plugins/image-properties/readers/index.d.ts +12 -0
  124. package/types/plugins/image-properties/readers/link.d.ts +9 -0
  125. package/types/plugins/image-properties/readers/margin.d.ts +8 -0
  126. package/types/plugins/image-properties/readers/size.d.ts +8 -0
  127. package/types/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
  128. package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
  129. package/types/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
  130. package/types/plugins/image-properties/utils/open-image-editor.d.ts +12 -0
  131. package/types/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
  132. package/types/plugins/image-properties/utils/utils.d.ts +9 -0
  133. package/types/plugins/image-properties/writers/index.d.ts +12 -0
  134. package/{esm/plugins/image-properties/templates/position-tab.d.ts → types/plugins/image-properties/writers/link.d.ts} +2 -4
  135. package/types/plugins/image-properties/writers/margin.d.ts +8 -0
  136. package/types/plugins/image-properties/writers/size.d.ts +7 -0
  137. package/types/plugins/select/config.d.ts +7 -0
  138. package/types/plugins/select/select.d.ts +7 -3
  139. package/types/types/ui.d.ts +1 -1
  140. package/esm/plugins/image-properties/templates/form.js +0 -26
  141. package/esm/plugins/image-properties/templates/main-tab.js +0 -47
  142. package/esm/plugins/image-properties/templates/position-tab.js +0 -66
  143. package/types/plugins/image-properties/templates/position-tab.d.ts +0 -10
@@ -0,0 +1,261 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
7
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
9
+ r = Reflect.decorate(decorators, target, key, desc);
10
+ else
11
+ for (var i = decorators.length - 1; i >= 0; i--)
12
+ if (d = decorators[i])
13
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
15
+ };
16
+ import { component } from "jodit/esm/core/decorators/component/component.js";
17
+ import { hook } from "jodit/esm/core/decorators/hook/hook.js";
18
+ import { watch } from "jodit/esm/core/decorators/watch/watch.js";
19
+ import { css } from "jodit/esm/core/helpers/index.js";
20
+ import { isString } from "jodit/esm/core/helpers/checker/is-string.js";
21
+ import { attr } from "jodit/esm/core/helpers/utils/attr.js";
22
+ import { UIElement } from "jodit/esm/core/ui/element.js";
23
+ import { Icon } from "jodit/esm/core/ui/icon.js";
24
+ import { normalSizeFromString } from "../utils/utils";
25
+ /** @private */
26
+ let UIImagePositionTab = class UIImagePositionTab extends UIElement {
27
+ className() {
28
+ return 'UIImagePositionTab';
29
+ }
30
+ constructor(jodit, state, handlers) {
31
+ super(jodit, {
32
+ availableClasses: jodit.o.image.availableClasses
33
+ });
34
+ this.state = state;
35
+ this.handlers = handlers;
36
+ }
37
+ render({ availableClasses }) {
38
+ return `<div class="jodit-form__group &__editMargins">
39
+ <label>~Margins~</label>
40
+ <div class="jodit-grid jodit_vertical_middle">
41
+ <input class="jodit_col-lg-1-5 jodit-input &__marginTop" type="text" placeholder="~top~"/>
42
+ <a style="text-align: center;" class="jodit-properties__lock jodit_col-lg-1-5 &__lockMargin">*lock*</a>
43
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginRight" type="text" placeholder="~right~"/>
44
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginBottom" type="text" placeholder="~bottom~"/>
45
+ <input disabled="disabled" class="jodit_col-lg-1-5 jodit-input &__marginLeft" type="text" placeholder="~left~"/>
46
+ </div>
47
+ </div>
48
+ <div class="jodit-form__group &__editAlign">
49
+ <label>~Align~</label>
50
+ <select class="jodit-select &__align">
51
+ <option value="">~--Not Set--~</option>
52
+ <option value="left">~Left~</option>
53
+ <option value="center">~Center~</option>
54
+ <option value="right">~Right~</option>
55
+ </select>
56
+ </div>
57
+ <div class="jodit-form__group &__editStyle">
58
+ <label>~Styles~</label>
59
+ <input type="text" class="jodit-input &__style"/>
60
+ </div>
61
+ <div class="jodit-form__group &__editClass">
62
+ <label>~Classes~</label>
63
+ ${(() => {
64
+ const classInput = [];
65
+ if (availableClasses && availableClasses.length > 0) {
66
+ classInput.push('<select class="jodit-input jodit-select &__classes">');
67
+ availableClasses.forEach(item => {
68
+ if (isString(item)) {
69
+ classInput.push(`<option value="${item}">${item}</option>`);
70
+ }
71
+ else {
72
+ classInput.push(`<option value="${item[0]}">${item[1]}</option>`);
73
+ }
74
+ });
75
+ classInput.push('</select>');
76
+ }
77
+ else {
78
+ classInput.push('<input type="text" class="jodit-input &__classes"/>');
79
+ }
80
+ return classInput.join('');
81
+ })()}
82
+ </div>
83
+ <div class="jodit-form__group &__editId">
84
+ <label>Id</label>
85
+ <input type="text" class="jodit-input &__id"/>
86
+ </div>
87
+ <div
88
+ class="jodit-form__group &__editBorderRadius"
89
+ >
90
+ <label>~Border radius~</label>
91
+ <input type="number" class="jodit-input &__borderRadius"/>
92
+ </div>`;
93
+ }
94
+ onStateAlignChange() {
95
+ const align = this.getElm('align');
96
+ align.value = this.state.values.align;
97
+ }
98
+ onChangeAlign() {
99
+ const align = this.getElm('align');
100
+ this.state.values.align = align.value;
101
+ }
102
+ onStateValuesBorderRadiusChange() {
103
+ const borderRadius = this.getElm('borderRadius');
104
+ borderRadius.value = this.state.values.borderRadius.toString();
105
+ }
106
+ onChangeBorderRadius() {
107
+ const borderRadius = this.getElm('borderRadius');
108
+ this.state.values.borderRadius = parseFloat(borderRadius.value);
109
+ }
110
+ onStateValuesIdChange() {
111
+ const id = this.getElm('id');
112
+ id.value = this.state.values.id;
113
+ }
114
+ onChangeId() {
115
+ const id = this.getElm('id');
116
+ this.state.values.id = id.value;
117
+ }
118
+ onStateValuesStyleChange() {
119
+ const style = this.getElm('style');
120
+ style.value = this.state.values.style;
121
+ }
122
+ onChangeStyle() {
123
+ const style = this.getElm('style');
124
+ this.state.values.style = style.value;
125
+ }
126
+ onStateValuesClassesChange() {
127
+ const classes = this.getElm('classes');
128
+ classes.value = this.state.values.classes;
129
+ }
130
+ onChangClasses() {
131
+ const classes = this.getElm('classes');
132
+ this.state.values.classes = classes.value;
133
+ }
134
+ onLockMarginClick(e) {
135
+ this.state.marginIsLocked = !this.state.marginIsLocked;
136
+ e.preventDefault();
137
+ }
138
+ onChangeMarginIsLocked() {
139
+ const marginBottom = this.getElm('marginBottom');
140
+ const marginRight = this.getElm('marginRight');
141
+ const marginLeft = this.getElm('marginLeft');
142
+ const lockMargin = this.getElm('lockMargin');
143
+ [marginRight, marginBottom, marginLeft].forEach(elm => {
144
+ attr(elm, 'disabled', this.state.marginIsLocked || null);
145
+ });
146
+ lockMargin.innerHTML = Icon.get(this.state.marginIsLocked ? 'lock' : 'unlock');
147
+ if (this.state.marginIsLocked) {
148
+ const marginTop = this.state.values.marginTop;
149
+ this.state.values.marginRight = marginTop;
150
+ this.state.values.marginBottom = marginTop;
151
+ this.state.values.marginLeft = marginTop;
152
+ }
153
+ }
154
+ onStateValuesMarginChange() {
155
+ const marginTop = this.getElm('marginTop');
156
+ const marginRight = this.getElm('marginRight');
157
+ const marginBottom = this.getElm('marginBottom');
158
+ const marginLeft = this.getElm('marginLeft');
159
+ marginTop.value = this.state.values.marginTop.toString();
160
+ marginRight.value = this.state.values.marginRight.toString();
161
+ marginBottom.value = this.state.values.marginBottom.toString();
162
+ marginLeft.value = this.state.values.marginLeft.toString();
163
+ }
164
+ onChangeMargin() {
165
+ const marginTop = this.getElm('marginTop');
166
+ const marginRight = this.getElm('marginRight');
167
+ const marginBottom = this.getElm('marginBottom');
168
+ const marginLeft = this.getElm('marginLeft');
169
+ this.state.values.marginTop = normalSizeFromString(marginTop.value);
170
+ if (this.state.marginIsLocked) {
171
+ this.state.values.marginRight = this.state.values.marginTop;
172
+ this.state.values.marginBottom = this.state.values.marginTop;
173
+ this.state.values.marginLeft = this.state.values.marginTop;
174
+ }
175
+ else {
176
+ this.state.values.marginRight = normalSizeFromString(marginRight.value);
177
+ this.state.values.marginBottom = normalSizeFromString(marginBottom.value);
178
+ this.state.values.marginLeft = normalSizeFromString(marginLeft.value);
179
+ }
180
+ }
181
+ hideFieldByOptions() {
182
+ const opt = this.j.o.image;
183
+ [
184
+ ['editMargins', 'editMargins'],
185
+ ['editAlign', 'editAlign'],
186
+ ['editStyle', 'editStyle'],
187
+ ['editClass', 'editClass'],
188
+ ['editId', 'editId'],
189
+ ['editBorderRadius', 'editBorderRadius']
190
+ ].forEach(([optKey, elmKey]) => {
191
+ const elm = this.getElm(elmKey);
192
+ css(elm, 'display', opt[optKey] ? null : 'none');
193
+ });
194
+ }
195
+ };
196
+ __decorate([
197
+ hook('ready'),
198
+ watch('state.values.align')
199
+ ], UIImagePositionTab.prototype, "onStateAlignChange", null);
200
+ __decorate([
201
+ watch('align:change')
202
+ ], UIImagePositionTab.prototype, "onChangeAlign", null);
203
+ __decorate([
204
+ hook('ready'),
205
+ watch('state.values.borderRadius')
206
+ ], UIImagePositionTab.prototype, "onStateValuesBorderRadiusChange", null);
207
+ __decorate([
208
+ watch('borderRadius:change')
209
+ ], UIImagePositionTab.prototype, "onChangeBorderRadius", null);
210
+ __decorate([
211
+ hook('ready'),
212
+ watch('state.values.id')
213
+ ], UIImagePositionTab.prototype, "onStateValuesIdChange", null);
214
+ __decorate([
215
+ watch('id:change')
216
+ ], UIImagePositionTab.prototype, "onChangeId", null);
217
+ __decorate([
218
+ hook('ready'),
219
+ watch('state.values.style')
220
+ ], UIImagePositionTab.prototype, "onStateValuesStyleChange", null);
221
+ __decorate([
222
+ watch('style:change')
223
+ ], UIImagePositionTab.prototype, "onChangeStyle", null);
224
+ __decorate([
225
+ hook('ready'),
226
+ watch('state.values.classes')
227
+ ], UIImagePositionTab.prototype, "onStateValuesClassesChange", null);
228
+ __decorate([
229
+ watch('classes:change')
230
+ ], UIImagePositionTab.prototype, "onChangClasses", null);
231
+ __decorate([
232
+ watch('lockMargin:click')
233
+ ], UIImagePositionTab.prototype, "onLockMarginClick", null);
234
+ __decorate([
235
+ hook('ready'),
236
+ watch('state.marginIsLocked')
237
+ ], UIImagePositionTab.prototype, "onChangeMarginIsLocked", null);
238
+ __decorate([
239
+ hook('ready'),
240
+ watch([
241
+ 'state.values.marginTop',
242
+ 'state.values.marginRight',
243
+ 'state.values.marginBottom',
244
+ 'state.values.marginLeft'
245
+ ])
246
+ ], UIImagePositionTab.prototype, "onStateValuesMarginChange", null);
247
+ __decorate([
248
+ watch([
249
+ 'marginTop:change',
250
+ 'marginRight:change',
251
+ 'marginBottom:change',
252
+ 'marginLeft:change'
253
+ ])
254
+ ], UIImagePositionTab.prototype, "onChangeMargin", null);
255
+ __decorate([
256
+ hook('ready')
257
+ ], UIImagePositionTab.prototype, "hideFieldByOptions", null);
258
+ UIImagePositionTab = __decorate([
259
+ component
260
+ ], UIImagePositionTab);
261
+ export { UIImagePositionTab };
@@ -3,8 +3,10 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ import type { IJodit } from "jodit/esm/types";
7
+ import type { ImagePropertiesState } from "../interface";
6
8
  /**
7
- * @module plugins/image-properties
9
+ * Open image editor dialog
10
+ * @private
8
11
  */
9
- import type { IJodit } from "jodit/esm/types";
10
- export declare function mainTab(editor: IJodit): HTMLElement;
12
+ export declare function openImageEditorDialog(j: IJodit, state: ImagePropertiesState): void;
@@ -0,0 +1,52 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { isString } from "jodit/esm/core/helpers/checker/is-string.js";
7
+ import { attr } from "jodit/esm/core/helpers/utils/attr.js";
8
+ import { openImageEditor } from "jodit/esm/modules/image-editor/image-editor.js";
9
+ /**
10
+ * Open image editor dialog
11
+ * @private
12
+ */
13
+ export function openImageEditorDialog(j, state) {
14
+ const url = attr(state.image, 'src') || '', a = j.c.element('a'), loadExternal = () => {
15
+ if (a.host !== location.host) {
16
+ j.confirm('You can only edit your own images. Download this image on the host?', yes => {
17
+ if (yes && j.uploader) {
18
+ j.uploader.uploadRemoteImage(a.href.toString(), resp => {
19
+ j.alert('The image has been successfully uploaded to the host!', () => {
20
+ if (isString(resp.newfilename)) {
21
+ state.values.imageSrc =
22
+ resp.baseurl +
23
+ resp.newfilename;
24
+ }
25
+ });
26
+ }, error => {
27
+ j.alert('There was an error loading %s', error.message);
28
+ });
29
+ }
30
+ });
31
+ return;
32
+ }
33
+ };
34
+ a.href = url;
35
+ j.filebrowser.dataProvider
36
+ .getPathByUrl(a.href.toString())
37
+ .then(resp => {
38
+ openImageEditor.call(j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
39
+ const timestamp = new Date().getTime();
40
+ state.values.imageSrc =
41
+ url +
42
+ (url.indexOf('?') !== -1 ? '' : '?') +
43
+ '&_tmp=' +
44
+ timestamp.toString();
45
+ }, error => {
46
+ j.alert(error.message);
47
+ });
48
+ })
49
+ .catch(error => {
50
+ j.alert(error.message, loadExternal);
51
+ });
52
+ }
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import type { IDialog, IJodit } from "jodit/esm/types";
7
+ import type { ImagePropertiesState } from "../interface";
8
+ /** @private */
9
+ export declare function openImagePopup(j: IJodit, dialog: IDialog, state: ImagePropertiesState, button: HTMLElement): void;
@@ -0,0 +1,34 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { isArray } from "jodit/esm/core/helpers/checker/is-array.js";
7
+ import { position } from "jodit/esm/core/helpers/size/position.js";
8
+ import { Popup } from "jodit/esm/core/ui/popup/popup.js";
9
+ import { FileSelectorWidget } from "jodit/esm/modules/widget/file-selector/file-selector.js";
10
+ /** @private */
11
+ export function openImagePopup(j, dialog, state, button) {
12
+ const popup = new Popup(dialog);
13
+ const closePopup = () => {
14
+ popup.close();
15
+ popup.destruct();
16
+ };
17
+ popup
18
+ .setContent(FileSelectorWidget(j, {
19
+ upload: (data) => {
20
+ if (data.files && data.files.length) {
21
+ state.values.imageSrc =
22
+ data.baseurl + data.files[0];
23
+ }
24
+ closePopup();
25
+ },
26
+ filebrowser: async (data) => {
27
+ if (data && isArray(data.files) && data.files.length) {
28
+ state.values.imageSrc = data.files[0];
29
+ closePopup();
30
+ }
31
+ }
32
+ }, state.image, closePopup))
33
+ .open(() => position(button));
34
+ }
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /** @private */
7
+ export declare const normalSizeFromString: (value: string | number) => string | number;
8
+ /** @private */
9
+ export declare const normalSizeToString: (value: string | number) => string;
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { isNumber } from "jodit/esm/core/helpers/checker/is-number.js";
7
+ import { trim } from "jodit/esm/core/helpers/string/trim.js";
8
+ /** @private */
9
+ export const normalSizeFromString = (value) => {
10
+ return /^[-+]?[0-9.]+(px)?$/.test(value.toString())
11
+ ? parseFloat(value.toString())
12
+ : value;
13
+ };
14
+ /** @private */
15
+ export const normalSizeToString = (value) => {
16
+ if (isNumber(value)) {
17
+ return value ? value + 'px' : value.toString();
18
+ }
19
+ value = trim(value);
20
+ return /^[0-9]+$/.test(value) ? value + 'px' : value;
21
+ };
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import type { IJodit } from "jodit/esm/types";
7
+ import type { ImagePropertiesState } from "../interface";
8
+ /**
9
+ * Apply form's values to image
10
+ * @private
11
+ */
12
+ export declare function applyValuesToImage(j: IJodit, state: ImagePropertiesState, image: HTMLImageElement): void;
@@ -0,0 +1,53 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { Dom } from "jodit/esm/core/dom/dom.js";
7
+ import { attr, hAlignElement } from "jodit/esm/core/helpers/utils/index.js";
8
+ import { applyLink } from "./link";
9
+ import { applyMargin } from "./margin";
10
+ import { applySize } from "./size";
11
+ /**
12
+ * Apply form's values to image
13
+ * @private
14
+ */
15
+ export function applyValuesToImage(j, state, image) {
16
+ const { style, imageSrc, borderRadius, imageTitle, imageAlt, imageLink, imageWidth, imageHeight, marginTop, marginRight, marginBottom, marginLeft, imageLinkOpenInNewTab, align, classes, id } = state.values;
17
+ const opt = j.o;
18
+ // styles
19
+ if (opt.image.editStyle) {
20
+ attr(image, 'style', style || null);
21
+ }
22
+ // Src
23
+ if (imageSrc) {
24
+ attr(image, 'src', imageSrc);
25
+ }
26
+ else {
27
+ Dom.safeRemove(image);
28
+ return;
29
+ }
30
+ // Border radius
31
+ image.style.borderRadius = borderRadius ? borderRadius + 'px' : '';
32
+ // Title
33
+ attr(image, 'title', imageTitle || null);
34
+ // Alt
35
+ attr(image, 'alt', imageAlt || null);
36
+ // Link
37
+ applyLink(j, image, imageLink, imageLinkOpenInNewTab);
38
+ // Size
39
+ applySize(image, imageWidth, imageHeight, state.sizeIsLocked);
40
+ // Margin
41
+ if (j.o.image.editMargins) {
42
+ applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, image, state.marginIsLocked);
43
+ }
44
+ if (opt.image.editClass) {
45
+ attr(image, 'class', classes || null);
46
+ }
47
+ if (opt.image.editId) {
48
+ attr(image, 'id', id || null);
49
+ }
50
+ if (opt.image.editAlign) {
51
+ hAlignElement(image, align);
52
+ }
53
+ }
@@ -3,8 +3,6 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- /**
7
- * @module plugins/image-properties
8
- */
9
6
  import type { IJodit } from "jodit/esm/types";
10
- export declare function form(editor: IJodit): HTMLElement;
7
+ /** @private */
8
+ export declare function applyLink(j: IJodit, image: HTMLImageElement, imageLink: string, imageLinkOpenInNewTab: boolean): void;
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { Dom } from "jodit/esm/core/dom/dom.js";
7
+ import { attr } from "jodit/esm/core/helpers/utils/attr.js";
8
+ /** @private */
9
+ export function applyLink(j, image, imageLink, imageLinkOpenInNewTab) {
10
+ // Link
11
+ let link = Dom.closest(image, 'a', j.editor);
12
+ if (imageLink) {
13
+ if (!link) {
14
+ link = Dom.wrap(image, 'a', j.createInside);
15
+ }
16
+ attr(link, 'href', imageLink);
17
+ attr(link, 'target', imageLinkOpenInNewTab ? '_blank' : null);
18
+ }
19
+ else {
20
+ if (link && link.parentNode) {
21
+ link.parentNode.replaceChild(image, link);
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import type { IJodit } from "jodit/esm/types";
7
+ /** @private */
8
+ export declare function applyMargin(j: IJodit, marginTop: number | string, marginRight: number | string, marginBottom: number | string, marginLeft: number | string, image: HTMLImageElement, marginIsLocked: boolean): void;
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { css } from "jodit/esm/core/helpers/utils/css.js";
7
+ import { normalSizeToString } from "../utils/utils";
8
+ /** @private */
9
+ export function applyMargin(j, marginTop, marginRight, marginBottom, marginLeft, image, marginIsLocked) {
10
+ const margins = [marginTop, marginRight, marginBottom, marginLeft];
11
+ const applyMargin = (key, value) => {
12
+ const oldValue = css(image, key);
13
+ const v = normalSizeToString(value);
14
+ if (oldValue.toString() !== v.toString()) {
15
+ css(image, key, v);
16
+ }
17
+ };
18
+ if (!marginIsLocked) {
19
+ const sides = [
20
+ 'margin-top',
21
+ 'margin-right',
22
+ 'margin-bottom',
23
+ 'margin-left'
24
+ ];
25
+ margins.forEach((margin, index) => {
26
+ const side = sides[index];
27
+ applyMargin(side, margin);
28
+ });
29
+ }
30
+ else {
31
+ applyMargin('margin', marginTop);
32
+ }
33
+ }
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /** @private */
7
+ export declare function applySize(image: HTMLImageElement, imageWidth: number | string, imageHeight: number | string, sizeIsLocked: boolean): void;
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { attr } from "jodit/esm/core/helpers/utils/attr.js";
7
+ import { css } from "jodit/esm/core/helpers/utils/css.js";
8
+ import { normalSizeToString } from "../utils/utils";
9
+ /** @private */
10
+ export function applySize(image, imageWidth, imageHeight, sizeIsLocked) {
11
+ // Size
12
+ if (imageWidth !== image.offsetWidth ||
13
+ imageHeight !== image.offsetHeight) {
14
+ const updatedWidth = imageWidth ? normalSizeToString(imageWidth) : null;
15
+ let updatedHeight = imageHeight
16
+ ? normalSizeToString(imageHeight)
17
+ : null;
18
+ css(image, {
19
+ width: updatedWidth,
20
+ height: updatedWidth && sizeIsLocked ? null : updatedHeight
21
+ });
22
+ attr(image, 'width', attr(image, 'width') ? updatedWidth : null);
23
+ if (!attr(image, 'width') || sizeIsLocked) {
24
+ updatedHeight = null;
25
+ }
26
+ attr(image, 'height', updatedHeight);
27
+ }
28
+ }
@@ -15,6 +15,13 @@ declare module 'jodit/config' {
15
15
  * `<ul><li>|test|</li><li>|test</li></ul>` will be `<ul>|<li>test</li><li>|test</li></ul>`
16
16
  */
17
17
  normalizeSelectionBeforeCutAndCopy: boolean;
18
+ /**
19
+ * Normalize selection after triple click
20
+ * @example
21
+ *
22
+ * `<ul><li>|test</li><li>|pop</li></ul>` will be `<ul><li>|test|</li><li>pop</li</ul>|`
23
+ */
24
+ normalizeTripleClick: boolean;
18
25
  };
19
26
  }
20
27
  }
@@ -8,5 +8,6 @@
8
8
  */
9
9
  import { Config } from "jodit/esm/config.js";
10
10
  Config.prototype.select = {
11
- normalizeSelectionBeforeCutAndCopy: false
11
+ normalizeSelectionBeforeCutAndCopy: false,
12
+ normalizeTripleClick: true
12
13
  };
@@ -28,10 +28,14 @@ export declare class select extends Plugin {
28
28
  protected beforeDestruct(jodit: IJodit): void;
29
29
  private onStartSelection;
30
30
  /**
31
- * @event outsideClick(e) - when user clicked in the outside of editor
31
+ * @event outsideClick(e) - when user clicked on the outside of editor
32
32
  */
33
33
  protected onOutsideClick(e: MouseEvent): void;
34
- protected beforeCommandCut(command: string): void | false;
35
- protected beforeCommandSelectall(command: string): false;
34
+ protected beforeCommandCut(): void | false;
35
+ protected beforeCommandSelectAll(): false;
36
+ /**
37
+ * Normalize selection after triple click
38
+ */
39
+ protected onTripleClickNormalizeSelection(e: MouseEvent): void;
36
40
  protected onCopyNormalizeSelectionBound(e?: ClipboardEvent): void;
37
41
  }