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.
- package/CHANGELOG.md +22 -5
- package/es2015/jodit.css +82 -31
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +1339 -543
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +2 -2
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.css +82 -31
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +1325 -543
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.js +1 -1
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +82 -31
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +1322 -543
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +2 -2
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +82 -31
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +1322 -543
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +2 -2
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +131 -35
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +1363 -479
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/size/position.js +2 -2
- package/esm/core/helpers/utils/selector.d.ts +3 -1
- package/esm/core/helpers/utils/selector.js +3 -3
- package/esm/core/ui/button/tooltip/tooltip.js +2 -1
- package/esm/core/ui/popup/popup.js +1 -1
- package/esm/modules/dialog/dialog.js +1 -0
- package/esm/modules/file-browser/file-browser.js +8 -1
- package/esm/modules/image-editor/templates/form.js +6 -5
- package/esm/modules/toolbar/button/button.d.ts +1 -1
- package/esm/modules/widget/tabs/tabs.d.ts +4 -4
- package/esm/modules/widget/tabs/tabs.js +9 -7
- package/esm/plugins/ai-assistant/ai-assistant.d.ts +1 -1
- package/esm/plugins/ai-assistant/ai-assistant.js +3 -3
- package/esm/plugins/image-properties/config.d.ts +5 -83
- package/esm/plugins/image-properties/config.js +0 -3
- package/esm/plugins/image-properties/image-properties.d.ts +22 -32
- package/esm/plugins/image-properties/image-properties.js +129 -402
- package/{types/plugins/image-properties/templates/form.d.ts → esm/plugins/image-properties/readers/align.d.ts} +3 -5
- package/esm/plugins/image-properties/readers/align.js +24 -0
- package/esm/plugins/image-properties/readers/index.d.ts +12 -0
- package/esm/plugins/image-properties/readers/index.js +38 -0
- package/esm/plugins/image-properties/readers/link.d.ts +9 -0
- package/esm/plugins/image-properties/readers/link.js +19 -0
- package/esm/plugins/image-properties/readers/margin.d.ts +8 -0
- package/esm/plugins/image-properties/readers/margin.js +28 -0
- package/esm/plugins/image-properties/readers/size.d.ts +8 -0
- package/esm/plugins/image-properties/readers/size.js +36 -0
- package/esm/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
- package/esm/plugins/image-properties/ui/ui-image-form.js +171 -0
- package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
- package/esm/plugins/image-properties/ui/ui-image-main-tab.js +179 -0
- package/esm/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
- package/esm/plugins/image-properties/ui/ui-image-position-tab.js +261 -0
- package/esm/plugins/image-properties/{templates/main-tab.d.ts → utils/open-image-editor.d.ts} +5 -3
- package/esm/plugins/image-properties/utils/open-image-editor.js +52 -0
- package/esm/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
- package/esm/plugins/image-properties/utils/open-image-popup.js +34 -0
- package/esm/plugins/image-properties/utils/utils.d.ts +9 -0
- package/esm/plugins/image-properties/utils/utils.js +21 -0
- package/esm/plugins/image-properties/writers/index.d.ts +12 -0
- package/esm/plugins/image-properties/writers/index.js +53 -0
- package/esm/plugins/image-properties/{templates/form.d.ts → writers/link.d.ts} +2 -4
- package/esm/plugins/image-properties/writers/link.js +24 -0
- package/esm/plugins/image-properties/writers/margin.d.ts +8 -0
- package/esm/plugins/image-properties/writers/margin.js +33 -0
- package/esm/plugins/image-properties/writers/size.d.ts +7 -0
- package/esm/plugins/image-properties/writers/size.js +28 -0
- package/esm/plugins/select/config.d.ts +7 -0
- package/esm/plugins/select/config.js +2 -1
- package/esm/plugins/select/select.d.ts +7 -3
- package/esm/plugins/select/select.js +21 -4
- package/esm/types/ui.d.ts +1 -1
- package/package.json +1 -1
- package/types/core/helpers/utils/selector.d.ts +3 -1
- package/types/modules/toolbar/button/button.d.ts +1 -1
- package/types/modules/widget/tabs/tabs.d.ts +4 -4
- package/types/plugins/ai-assistant/ai-assistant.d.ts +1 -1
- package/types/plugins/image-properties/config.d.ts +5 -83
- package/types/plugins/image-properties/image-properties.d.ts +22 -32
- package/types/plugins/image-properties/{templates/main-tab.d.ts → readers/align.d.ts} +3 -5
- package/types/plugins/image-properties/readers/index.d.ts +12 -0
- package/types/plugins/image-properties/readers/link.d.ts +9 -0
- package/types/plugins/image-properties/readers/margin.d.ts +8 -0
- package/types/plugins/image-properties/readers/size.d.ts +8 -0
- package/types/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
- package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
- package/types/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
- package/types/plugins/image-properties/utils/open-image-editor.d.ts +12 -0
- package/types/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
- package/types/plugins/image-properties/utils/utils.d.ts +9 -0
- package/types/plugins/image-properties/writers/index.d.ts +12 -0
- package/{esm/plugins/image-properties/templates/position-tab.d.ts → types/plugins/image-properties/writers/link.d.ts} +2 -4
- package/types/plugins/image-properties/writers/margin.d.ts +8 -0
- package/types/plugins/image-properties/writers/size.d.ts +7 -0
- package/types/plugins/select/config.d.ts +7 -0
- package/types/plugins/select/select.d.ts +7 -3
- package/types/types/ui.d.ts +1 -1
- package/esm/plugins/image-properties/templates/form.js +0 -26
- package/esm/plugins/image-properties/templates/main-tab.js +0 -47
- package/esm/plugins/image-properties/templates/position-tab.js +0 -66
- 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 };
|
package/esm/plugins/image-properties/{templates/main-tab.d.ts → utils/open-image-editor.d.ts}
RENAMED
|
@@ -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
|
-
*
|
|
9
|
+
* Open image editor dialog
|
|
10
|
+
* @private
|
|
8
11
|
*/
|
|
9
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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
|
|
31
|
+
* @event outsideClick(e) - when user clicked on the outside of editor
|
|
32
32
|
*/
|
|
33
33
|
protected onOutsideClick(e: MouseEvent): void;
|
|
34
|
-
protected beforeCommandCut(
|
|
35
|
-
protected
|
|
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
|
}
|