jodit 4.18.3 → 4.18.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.
- package/CHANGELOG.md +52 -0
- package/es2015/jodit.css +72 -34
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +35 -10
- package/es2015/jodit.js +1967 -327
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +41 -16
- package/es2015/plugins/debug/debug.css +1 -1
- 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.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +35 -10
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +35 -10
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +72 -34
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +42 -17
- package/es2021/jodit.js +1949 -323
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +42 -17
- package/es2021/plugins/debug/debug.css +1 -1
- 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 +72 -34
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +42 -17
- package/es2021.en/jodit.js +1923 -297
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +51 -26
- package/es2021.en/plugins/debug/debug.css +1 -1
- 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 +85 -38
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +2225 -379
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- 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/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/config.d.ts +28 -26
- package/esm/config.js +19 -21
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/html/apply-styles.js +3 -0
- package/esm/core/helpers/html/clean-from-word.js +3 -0
- package/esm/core/helpers/html/strip-tags.js +24 -6
- package/esm/core/helpers/html/word-lists.d.ts +29 -0
- package/esm/core/helpers/html/word-lists.js +158 -0
- package/esm/core/helpers/utils/align.d.ts +1 -1
- package/esm/core/helpers/utils/align.js +2 -3
- package/esm/core/selection/helpers/index.d.ts +1 -0
- package/esm/core/selection/helpers/index.js +1 -0
- package/esm/core/selection/helpers/is-moved.d.ts +15 -0
- package/esm/core/selection/helpers/is-moved.js +22 -0
- package/esm/core/selection/style/api/list/toggle-ordered-list.js +40 -3
- package/esm/core/selection/style/transactions.js +5 -2
- package/esm/jodit.js +14 -4
- package/esm/langs/ar.d.ts +10 -0
- package/esm/langs/ar.js +11 -1
- package/esm/langs/az.d.ts +10 -0
- package/esm/langs/az.js +11 -1
- package/esm/langs/cs_cz.d.ts +10 -0
- package/esm/langs/cs_cz.js +12 -1
- package/esm/langs/de.d.ts +10 -0
- package/esm/langs/de.js +11 -1
- package/esm/langs/es.d.ts +10 -0
- package/esm/langs/es.js +11 -1
- package/esm/langs/fa.d.ts +10 -0
- package/esm/langs/fa.js +11 -1
- package/esm/langs/fi.d.ts +10 -0
- package/esm/langs/fi.js +11 -1
- package/esm/langs/fr.d.ts +10 -0
- package/esm/langs/fr.js +11 -1
- package/esm/langs/he.d.ts +10 -0
- package/esm/langs/he.js +11 -1
- package/esm/langs/hu.d.ts +10 -0
- package/esm/langs/hu.js +11 -1
- package/esm/langs/id.d.ts +10 -0
- package/esm/langs/id.js +11 -1
- package/esm/langs/it.d.ts +10 -0
- package/esm/langs/it.js +11 -1
- package/esm/langs/ja.d.ts +10 -0
- package/esm/langs/ja.js +11 -1
- package/esm/langs/ko.d.ts +10 -0
- package/esm/langs/ko.js +11 -1
- package/esm/langs/mn.d.ts +10 -0
- package/esm/langs/mn.js +11 -1
- package/esm/langs/nl.d.ts +10 -0
- package/esm/langs/nl.js +11 -1
- package/esm/langs/no.d.ts +10 -0
- package/esm/langs/no.js +11 -1
- package/esm/langs/pl.d.ts +10 -0
- package/esm/langs/pl.js +11 -1
- package/esm/langs/pt_br.d.ts +10 -0
- package/esm/langs/pt_br.js +11 -1
- package/esm/langs/ru.d.ts +10 -0
- package/esm/langs/ru.js +11 -1
- package/esm/langs/sk.d.ts +10 -0
- package/esm/langs/sk.js +11 -1
- package/esm/langs/sv.d.ts +10 -0
- package/esm/langs/sv.js +11 -1
- package/esm/langs/tr.d.ts +10 -0
- package/esm/langs/tr.js +11 -1
- package/esm/langs/ua.d.ts +10 -0
- package/esm/langs/ua.js +11 -1
- package/esm/langs/zh_cn.d.ts +10 -0
- package/esm/langs/zh_cn.js +11 -1
- package/esm/langs/zh_tw.d.ts +10 -0
- package/esm/langs/zh_tw.js +11 -1
- package/esm/modules/dialog/dialog.d.ts +7 -0
- package/esm/modules/dialog/dialog.js +24 -6
- package/esm/modules/table/table.d.ts +6 -0
- package/esm/modules/table/table.js +18 -26
- package/esm/plugins/all.d.ts +1 -0
- package/esm/plugins/all.js +1 -0
- package/esm/plugins/backspace/cases/check-join-neighbors.js +90 -3
- package/esm/plugins/clean-html/clean-html.d.ts +8 -0
- package/esm/plugins/clean-html/clean-html.js +21 -1
- package/esm/plugins/clean-html/helpers/index.d.ts +1 -0
- package/esm/plugins/clean-html/helpers/index.js +1 -0
- package/esm/plugins/clean-html/helpers/remove-placeholder-br.d.ts +16 -0
- package/esm/plugins/clean-html/helpers/remove-placeholder-br.js +51 -0
- package/esm/plugins/delete/delete.d.ts +11 -1
- package/esm/plugins/delete/delete.js +92 -16
- package/esm/plugins/focus/focus.js +12 -1
- package/esm/plugins/iframe/config.d.ts +3 -0
- package/esm/plugins/iframe/config.js +0 -27
- package/esm/plugins/iframe/iframe.js +8 -1
- package/esm/plugins/image-processor/image-processor.d.ts +4 -1
- package/esm/plugins/image-processor/image-processor.js +15 -4
- package/esm/plugins/image-properties/readers/align.d.ts +2 -2
- package/esm/plugins/index.d.ts +1 -0
- package/esm/plugins/inline-popup/config/items/iframe.d.ts +9 -1
- package/esm/plugins/inline-popup/config/items/iframe.js +15 -0
- package/esm/plugins/inline-popup/inline-popup.d.ts +19 -0
- package/esm/plugins/inline-popup/inline-popup.js +70 -1
- package/esm/plugins/media/media.js +16 -7
- package/esm/plugins/ordered-list/config.js +13 -2
- package/esm/plugins/ordered-list/start-dialog.d.ts +19 -0
- package/esm/plugins/ordered-list/start-dialog.js +58 -0
- package/esm/plugins/placeholder/placeholder.js +7 -1
- package/esm/plugins/resizer/config.d.ts +5 -3
- package/esm/plugins/resizer/config.js +8 -2
- package/esm/plugins/resizer/resizer.d.ts +20 -0
- package/esm/plugins/resizer/resizer.js +140 -17
- package/esm/plugins/select-cells/select-cells.d.ts +23 -0
- package/esm/plugins/select-cells/select-cells.js +75 -1
- package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +3 -2
- package/esm/plugins/video/config.d.ts +6 -0
- package/esm/plugins/video/config.js +77 -65
- package/esm/plugins/video-properties/interface.d.ts +31 -0
- package/esm/plugins/video-properties/interface.js +6 -0
- package/esm/plugins/video-properties/readers.d.ts +26 -0
- package/esm/plugins/video-properties/readers.js +65 -0
- package/esm/plugins/video-properties/replace.d.ts +15 -0
- package/esm/plugins/video-properties/replace.js +97 -0
- package/esm/plugins/video-properties/ui/ui-video-form.d.ts +41 -0
- package/esm/plugins/video-properties/ui/ui-video-form.js +228 -0
- package/esm/plugins/video-properties/video-properties.d.ts +37 -0
- package/esm/plugins/video-properties/video-properties.js +175 -0
- package/esm/plugins/video-properties/writers.d.ts +15 -0
- package/esm/plugins/video-properties/writers.js +73 -0
- package/esm/types/types.d.ts +1 -1
- package/package.json +1 -1
- package/types/config.d.ts +28 -26
- package/types/core/helpers/html/word-lists.d.ts +29 -0
- package/types/core/helpers/utils/align.d.ts +1 -1
- package/types/core/selection/helpers/index.d.ts +1 -0
- package/types/core/selection/helpers/is-moved.d.ts +15 -0
- package/types/langs/ar.d.ts +10 -0
- package/types/langs/az.d.ts +10 -0
- package/types/langs/cs_cz.d.ts +10 -0
- package/types/langs/de.d.ts +10 -0
- package/types/langs/es.d.ts +10 -0
- package/types/langs/fa.d.ts +10 -0
- package/types/langs/fi.d.ts +10 -0
- package/types/langs/fr.d.ts +10 -0
- package/types/langs/he.d.ts +10 -0
- package/types/langs/hu.d.ts +10 -0
- package/types/langs/id.d.ts +10 -0
- package/types/langs/it.d.ts +10 -0
- package/types/langs/ja.d.ts +10 -0
- package/types/langs/ko.d.ts +10 -0
- package/types/langs/mn.d.ts +10 -0
- package/types/langs/nl.d.ts +10 -0
- package/types/langs/no.d.ts +10 -0
- package/types/langs/pl.d.ts +10 -0
- package/types/langs/pt_br.d.ts +10 -0
- package/types/langs/ru.d.ts +10 -0
- package/types/langs/sk.d.ts +10 -0
- package/types/langs/sv.d.ts +10 -0
- package/types/langs/tr.d.ts +10 -0
- package/types/langs/ua.d.ts +10 -0
- package/types/langs/zh_cn.d.ts +10 -0
- package/types/langs/zh_tw.d.ts +10 -0
- package/types/modules/dialog/dialog.d.ts +7 -0
- package/types/modules/table/table.d.ts +6 -0
- package/types/plugins/clean-html/clean-html.d.ts +8 -0
- package/types/plugins/clean-html/helpers/index.d.ts +1 -0
- package/types/plugins/clean-html/helpers/remove-placeholder-br.d.ts +16 -0
- package/types/plugins/delete/delete.d.ts +11 -1
- package/types/plugins/iframe/config.d.ts +3 -0
- package/types/plugins/image-processor/image-processor.d.ts +4 -1
- package/types/plugins/image-properties/readers/align.d.ts +2 -2
- package/types/plugins/index.d.ts +1 -0
- package/types/plugins/inline-popup/config/items/iframe.d.ts +9 -1
- package/types/plugins/inline-popup/inline-popup.d.ts +19 -0
- package/types/plugins/ordered-list/start-dialog.d.ts +19 -0
- package/types/plugins/resizer/config.d.ts +5 -3
- package/types/plugins/resizer/resizer.d.ts +20 -0
- package/types/plugins/select-cells/select-cells.d.ts +23 -0
- package/types/plugins/video/config.d.ts +6 -0
- package/types/plugins/video-properties/interface.d.ts +31 -0
- package/types/plugins/video-properties/readers.d.ts +26 -0
- package/types/plugins/video-properties/replace.d.ts +15 -0
- package/types/plugins/video-properties/ui/ui-video-form.d.ts +41 -0
- package/types/plugins/video-properties/video-properties.d.ts +37 -0
- package/types/plugins/video-properties/writers.d.ts +15 -0
- package/types/types/types.d.ts +1 -1
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { align } from "./img.js";
|
|
7
7
|
export default [
|
|
8
|
+
{
|
|
9
|
+
name: 'replace',
|
|
10
|
+
icon: 'video',
|
|
11
|
+
tooltip: 'Replace',
|
|
12
|
+
popup: (editor, target, close) => target
|
|
13
|
+
? editor.e.fire('generateReplaceVideoTabs', target, close)
|
|
14
|
+
: undefined
|
|
15
|
+
},
|
|
8
16
|
{
|
|
9
17
|
name: 'bin',
|
|
10
18
|
tooltip: 'Delete',
|
|
@@ -12,5 +20,12 @@ export default [
|
|
|
12
20
|
image && editor.s.removeNode(image);
|
|
13
21
|
}
|
|
14
22
|
},
|
|
23
|
+
{
|
|
24
|
+
name: 'pencil',
|
|
25
|
+
tooltip: 'Edit',
|
|
26
|
+
exec: (editor, target) => {
|
|
27
|
+
target && editor.e.fire('openVideoProperties', target);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
15
30
|
align
|
|
16
31
|
];
|
|
@@ -37,6 +37,17 @@ export declare class inlinePopup extends Plugin {
|
|
|
37
37
|
*/
|
|
38
38
|
private hidePopup;
|
|
39
39
|
protected onOutsideClick(): void;
|
|
40
|
+
/**
|
|
41
|
+
* A key that moves the caret off an element closes its popup, and one
|
|
42
|
+
* that moves the caret into an element with a popup (a link) opens it,
|
|
43
|
+
* as clicks do
|
|
44
|
+
*/
|
|
45
|
+
protected onKeyUp(): void;
|
|
46
|
+
private __followCaret;
|
|
47
|
+
/**
|
|
48
|
+
* The element with a popup that holds `node`
|
|
49
|
+
*/
|
|
50
|
+
private __elementAt;
|
|
40
51
|
/**
|
|
41
52
|
* Can show popup for this type
|
|
42
53
|
*/
|
|
@@ -53,6 +64,13 @@ export declare class inlinePopup extends Plugin {
|
|
|
53
64
|
* while the selection is still there. See #1238
|
|
54
65
|
*/
|
|
55
66
|
private __reopenSelectionPopup;
|
|
67
|
+
/**
|
|
68
|
+
* The alignment controls fire `recalcPositionPopup` once they have moved
|
|
69
|
+
* the element, and their button then fires `closeAllPopups`. The popup
|
|
70
|
+
* opens again beside the element, as the selection toolbar does
|
|
71
|
+
*/
|
|
72
|
+
private __reopenFor;
|
|
73
|
+
protected onRecalcPositionPopup(): void;
|
|
56
74
|
private __onDocumentMouseDown;
|
|
57
75
|
private __onCloseAllPopups;
|
|
58
76
|
/**
|
|
@@ -64,6 +82,7 @@ export declare class inlinePopup extends Plugin {
|
|
|
64
82
|
private __selectionBound;
|
|
65
83
|
private snapRange;
|
|
66
84
|
private onSelectionStart;
|
|
85
|
+
private __keyDownElement;
|
|
67
86
|
private onSelectionEnd;
|
|
68
87
|
/**
|
|
69
88
|
* Selection change handler
|
|
@@ -18,6 +18,7 @@ import { Dom } from "../../core/dom/index.js";
|
|
|
18
18
|
import { pluginSystem } from "../../core/global.js";
|
|
19
19
|
import { camelCase, getMediaWrapper, getWrappedMedia, isArray, isFunction, isString, keys, position, splitArray, toArray } from "../../core/helpers/index.js";
|
|
20
20
|
import { Plugin } from "../../core/plugin/index.js";
|
|
21
|
+
import { isMoved } from "../../core/selection/helpers/index.js";
|
|
21
22
|
import { UIElement } from "../../core/ui/index.js";
|
|
22
23
|
import { Popup } from "../../core/ui/popup/index.js";
|
|
23
24
|
import { makeCollection } from "../../modules/toolbar/factory.js";
|
|
@@ -35,7 +36,14 @@ export class inlinePopup extends Plugin {
|
|
|
35
36
|
* while the selection is still there. See #1238
|
|
36
37
|
*/
|
|
37
38
|
this.__reopenSelectionPopup = false;
|
|
39
|
+
/**
|
|
40
|
+
* The alignment controls fire `recalcPositionPopup` once they have moved
|
|
41
|
+
* the element, and their button then fires `closeAllPopups`. The popup
|
|
42
|
+
* opens again beside the element, as the selection toolbar does
|
|
43
|
+
*/
|
|
44
|
+
this.__reopenFor = null;
|
|
38
45
|
this.snapRange = null;
|
|
46
|
+
this.__keyDownElement = null;
|
|
39
47
|
this.elmsList = keys(this.j.o.popup, false).filter(s => !this.isExcludedTarget(s));
|
|
40
48
|
}
|
|
41
49
|
get popup() {
|
|
@@ -129,6 +137,38 @@ export class inlinePopup extends Plugin {
|
|
|
129
137
|
onOutsideClick() {
|
|
130
138
|
this.popup.close();
|
|
131
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* A key that moves the caret off an element closes its popup, and one
|
|
142
|
+
* that moves the caret into an element with a popup (a link) opens it,
|
|
143
|
+
* as clicks do
|
|
144
|
+
*/
|
|
145
|
+
onKeyUp() {
|
|
146
|
+
this.__followCaret();
|
|
147
|
+
}
|
|
148
|
+
__followCaret() {
|
|
149
|
+
if (!isMoved(this.j, this.snapRange)) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const { range } = this.j.s;
|
|
153
|
+
const target = this.previousTarget;
|
|
154
|
+
if (this.popup.isOpened &&
|
|
155
|
+
this.type !== 'selection' &&
|
|
156
|
+
target &&
|
|
157
|
+
!range.intersectsNode(target)) {
|
|
158
|
+
this.popup.close();
|
|
159
|
+
}
|
|
160
|
+
const node = range.startContainer;
|
|
161
|
+
const element = this.__elementAt(node);
|
|
162
|
+
if (range.collapsed && element && element !== this.__keyDownElement) {
|
|
163
|
+
this.onClick(node);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The element with a popup that holds `node`
|
|
168
|
+
*/
|
|
169
|
+
__elementAt(node) {
|
|
170
|
+
return Dom.closest(node, this.elmsList, this.j.editor);
|
|
171
|
+
}
|
|
132
172
|
/**
|
|
133
173
|
* Can show popup for this type
|
|
134
174
|
*/
|
|
@@ -183,7 +223,15 @@ export class inlinePopup extends Plugin {
|
|
|
183
223
|
.on('closeAllPopups', this.__onCloseAllPopups);
|
|
184
224
|
this.addListenersForElements();
|
|
185
225
|
}
|
|
226
|
+
onRecalcPositionPopup() {
|
|
227
|
+
if (this.popup.isOpened &&
|
|
228
|
+
this.type !== 'selection' &&
|
|
229
|
+
this.previousTarget) {
|
|
230
|
+
this.__reopenFor = this.previousTarget;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
186
233
|
__onDocumentMouseDown(e) {
|
|
234
|
+
this.__reopenFor = null;
|
|
187
235
|
if (this.popup.isOpened &&
|
|
188
236
|
this.type === 'selection' &&
|
|
189
237
|
e.target &&
|
|
@@ -192,6 +240,16 @@ export class inlinePopup extends Plugin {
|
|
|
192
240
|
}
|
|
193
241
|
}
|
|
194
242
|
__onCloseAllPopups() {
|
|
243
|
+
const target = this.__reopenFor;
|
|
244
|
+
if (target) {
|
|
245
|
+
this.__reopenFor = null;
|
|
246
|
+
// After the popup's own `closeAllPopups` handler, as below
|
|
247
|
+
this.j.async.setTimeout(() => {
|
|
248
|
+
if (this.j.editor.contains(target)) {
|
|
249
|
+
this.onClick(target);
|
|
250
|
+
}
|
|
251
|
+
}, 1);
|
|
252
|
+
}
|
|
195
253
|
if (!this.__reopenSelectionPopup) {
|
|
196
254
|
return;
|
|
197
255
|
}
|
|
@@ -224,8 +282,13 @@ export class inlinePopup extends Plugin {
|
|
|
224
282
|
}
|
|
225
283
|
return { left, top, width: rect.width, height: rect.height };
|
|
226
284
|
}
|
|
227
|
-
onSelectionStart() {
|
|
285
|
+
onSelectionStart(event) {
|
|
286
|
+
// A key held down moves the caret on every repeat, with one keyup
|
|
287
|
+
if (event === null || event === void 0 ? void 0 : event.repeat) {
|
|
288
|
+
this.__followCaret();
|
|
289
|
+
}
|
|
228
290
|
this.snapRange = this.j.s.range.cloneRange();
|
|
291
|
+
this.__keyDownElement = this.__elementAt(this.snapRange.startContainer);
|
|
229
292
|
}
|
|
230
293
|
onSelectionEnd(e) {
|
|
231
294
|
if (e &&
|
|
@@ -339,6 +402,12 @@ __decorate([
|
|
|
339
402
|
__decorate([
|
|
340
403
|
watch(':outsideClick')
|
|
341
404
|
], inlinePopup.prototype, "onOutsideClick", null);
|
|
405
|
+
__decorate([
|
|
406
|
+
watch(':keyup')
|
|
407
|
+
], inlinePopup.prototype, "onKeyUp", null);
|
|
408
|
+
__decorate([
|
|
409
|
+
watch(':recalcPositionPopup')
|
|
410
|
+
], inlinePopup.prototype, "onRecalcPositionPopup", null);
|
|
342
411
|
__decorate([
|
|
343
412
|
autobind
|
|
344
413
|
], inlinePopup.prototype, "__onDocumentMouseDown", null);
|
|
@@ -26,6 +26,7 @@ export function media(editor) {
|
|
|
26
26
|
(_a = getMediaWrapper(editor, element)) !== null && _a !== void 0 ? _a : wrapMedia(editor, element);
|
|
27
27
|
}
|
|
28
28
|
else if (mediaInFakeBlock) {
|
|
29
|
+
const media = element;
|
|
29
30
|
const wrapper = editor.createInside.element(mediaFakeTag, {
|
|
30
31
|
'data-jodit-temp': 1,
|
|
31
32
|
contenteditable: false,
|
|
@@ -33,13 +34,21 @@ export function media(editor) {
|
|
|
33
34
|
[`data-${keyFake}`]: 1
|
|
34
35
|
});
|
|
35
36
|
attr(wrapper, 'style', attr(element, 'style'));
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
// The wrapper fits the media, whose size changes as its metadata loads
|
|
38
|
+
// and as it's resized. A percentage width is of the line, so it takes that
|
|
39
|
+
const fit = () => {
|
|
40
|
+
css(wrapper, {
|
|
41
|
+
display: cssInline(media, 'display') === 'inline-block'
|
|
42
|
+
? 'inline-block'
|
|
43
|
+
: 'block',
|
|
44
|
+
width: cssInline(media, 'width').endsWith('%')
|
|
45
|
+
? ''
|
|
46
|
+
: 'fit-content',
|
|
47
|
+
height: ''
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
fit();
|
|
51
|
+
editor.e.on(media, 'changesize', fit);
|
|
43
52
|
if (element.parentNode) {
|
|
44
53
|
Dom.before(element, wrapper);
|
|
45
54
|
}
|
|
@@ -8,10 +8,19 @@ import { Icon } from "../../core/ui/icon.js";
|
|
|
8
8
|
import { Config } from "../../config.js";
|
|
9
9
|
import olIcon from "./icons/ol.svg.js";
|
|
10
10
|
import ulIcon from "./icons/ul.svg.js";
|
|
11
|
+
import { closestOrderedList, openStartDialog } from "./start-dialog.js";
|
|
12
|
+
/**
|
|
13
|
+
* The `ol` dropdown item that asks for the list's start number
|
|
14
|
+
*/
|
|
15
|
+
const START = 'start';
|
|
11
16
|
const memoExec = (jodit, _, { control }) => {
|
|
12
17
|
var _a;
|
|
13
18
|
const key = `button${control.command}`;
|
|
14
19
|
const value = (_a = (control.args && control.args[0])) !== null && _a !== void 0 ? _a : dataBind(jodit, key);
|
|
20
|
+
if (value === START) {
|
|
21
|
+
openStartDialog(jodit);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
15
24
|
dataBind(jodit, key, value);
|
|
16
25
|
jodit.execCommand(control.command, false, value === 'default' ? null : value);
|
|
17
26
|
};
|
|
@@ -38,7 +47,9 @@ Config.prototype.controls.ol = {
|
|
|
38
47
|
'lower-greek': 'Lower Greek',
|
|
39
48
|
'lower-roman': 'Lower Roman',
|
|
40
49
|
'upper-alpha': 'Upper Alpha',
|
|
41
|
-
'upper-roman': 'Upper Roman'
|
|
50
|
+
'upper-roman': 'Upper Roman',
|
|
51
|
+
[START]: 'Start at...'
|
|
42
52
|
},
|
|
43
|
-
exec: memoExec
|
|
53
|
+
exec: memoExec,
|
|
54
|
+
isChildDisabled: (jodit, button) => { var _a; return ((_a = button.control.args) === null || _a === void 0 ? void 0 : _a[0]) === START && !closestOrderedList(jodit); }
|
|
44
55
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module plugins/ordered-list
|
|
8
|
+
*/
|
|
9
|
+
import type { IJodit, Nullable } from "../../types/index";
|
|
10
|
+
/**
|
|
11
|
+
* The numbered list the selection is in
|
|
12
|
+
*/
|
|
13
|
+
export declare function closestOrderedList(jodit: IJodit): Nullable<HTMLOListElement>;
|
|
14
|
+
/**
|
|
15
|
+
* Asks for the number of the first item of the list the selection is in,
|
|
16
|
+
* and sets the list's `start`. The selection is put back when the dialog
|
|
17
|
+
* closes, however it closes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function openStartDialog(jodit: IJodit): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
import { Dom } from "../../core/dom/dom.js";
|
|
7
|
+
import { attr } from "../../core/helpers/utils/attr.js";
|
|
8
|
+
import { Button } from "../../core/ui/button/index.js";
|
|
9
|
+
import { UIBlock, UIForm, UIInput } from "../../core/ui/form/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* The numbered list the selection is in
|
|
12
|
+
*/
|
|
13
|
+
export function closestOrderedList(jodit) {
|
|
14
|
+
const current = jodit.s.current();
|
|
15
|
+
return current ? Dom.closest(current, 'ol', jodit.editor) : null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Asks for the number of the first item of the list the selection is in,
|
|
19
|
+
* and sets the list's `start`. The selection is put back when the dialog
|
|
20
|
+
* closes, however it closes.
|
|
21
|
+
*/
|
|
22
|
+
export function openStartDialog(jodit) {
|
|
23
|
+
const list = closestOrderedList(jodit);
|
|
24
|
+
if (!list) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const dialog = jodit.dlg({ resizable: false, closeOnClickOverlay: true });
|
|
28
|
+
const input = new UIInput(jodit, {
|
|
29
|
+
name: 'start',
|
|
30
|
+
type: 'number',
|
|
31
|
+
label: 'Number for the first item',
|
|
32
|
+
value: list.start
|
|
33
|
+
});
|
|
34
|
+
const form = new UIForm(jodit, [new UIBlock(jodit, [input])]);
|
|
35
|
+
form.container.classList.add('jodit-dialog_alert');
|
|
36
|
+
form.onSubmit(({ start }) => {
|
|
37
|
+
const value = start === '' ? 1 : parseInt(start, 10);
|
|
38
|
+
if (isNaN(value)) {
|
|
39
|
+
input.focus();
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
dialog.close();
|
|
43
|
+
attr(list, 'start', value === 1 ? null : value);
|
|
44
|
+
jodit.synchronizeValues();
|
|
45
|
+
});
|
|
46
|
+
jodit.s.save();
|
|
47
|
+
dialog.e.on(dialog, 'afterClose', () => {
|
|
48
|
+
jodit.s.focus();
|
|
49
|
+
jodit.s.restore();
|
|
50
|
+
});
|
|
51
|
+
dialog.setFooter([
|
|
52
|
+
Button(jodit, 'cancel', 'Cancel').onAction(() => dialog.close()),
|
|
53
|
+
Button(jodit, 'ok', 'Apply', 'primary').onAction(() => form.submit())
|
|
54
|
+
]);
|
|
55
|
+
dialog.open(form, jodit.i18n('Start numbering at'), true, true);
|
|
56
|
+
input.focus();
|
|
57
|
+
input.nativeInput.select();
|
|
58
|
+
}
|
|
@@ -33,6 +33,10 @@ export function isEditorEmpty(root) {
|
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
const first = root.firstChild;
|
|
36
|
+
// Firefox pads an empty editable body with a bare <br>
|
|
37
|
+
if (Dom.isTag(first, 'br') && !Dom.next(first, Boolean, root)) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
36
40
|
if (INSEPARABLE_TAGS.has((_a = first.nodeName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) ||
|
|
37
41
|
/^(TABLE)$/i.test(first.nodeName)) {
|
|
38
42
|
return false;
|
|
@@ -69,7 +73,7 @@ export class placeholder extends Plugin {
|
|
|
69
73
|
.on('changePlace.placeholder', this.addNativeListeners)
|
|
70
74
|
.on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' +
|
|
71
75
|
'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' +
|
|
72
|
-
'internalChange.placeholder afterCommand.placeholder', this.toggle)
|
|
76
|
+
'internalChange.placeholder afterCommand.placeholder resize.placeholder', this.toggle)
|
|
73
77
|
.on(window, 'load', this.toggle);
|
|
74
78
|
this.addNativeListeners();
|
|
75
79
|
this.toggle();
|
|
@@ -115,12 +119,14 @@ export class placeholder extends Plugin {
|
|
|
115
119
|
marginTop = parseInt(style2.getPropertyValue('margin-top'), 10);
|
|
116
120
|
marginLeft = parseInt(style2.getPropertyValue('margin-left'), 10);
|
|
117
121
|
css(this.placeholderElm, {
|
|
122
|
+
fontFamily: style2.getPropertyValue('font-family'),
|
|
118
123
|
fontSize: parseInt(style2.getPropertyValue('font-size'), 10),
|
|
119
124
|
lineHeight: style2.getPropertyValue('line-height')
|
|
120
125
|
});
|
|
121
126
|
}
|
|
122
127
|
else {
|
|
123
128
|
css(this.placeholderElm, {
|
|
129
|
+
fontFamily: style.getPropertyValue('font-family'),
|
|
124
130
|
fontSize: parseInt(style.getPropertyValue('font-size'), 10),
|
|
125
131
|
lineHeight: style.getPropertyValue('line-height')
|
|
126
132
|
});
|
|
@@ -10,7 +10,7 @@ import type { HTMLTagNames } from "../../types/index";
|
|
|
10
10
|
declare module 'jodit/config' {
|
|
11
11
|
interface Config {
|
|
12
12
|
/**
|
|
13
|
-
* Set of HTML tag names whose elements can be resized by the user via drag handles (e.g. images, iframes, tables)
|
|
13
|
+
* Set of HTML tag names whose elements can be resized by the user via drag handles (e.g. images, iframes, tables, videos)
|
|
14
14
|
*/
|
|
15
15
|
allowResizeTags: Set<HTMLTagNames>;
|
|
16
16
|
resizer: {
|
|
@@ -23,14 +23,16 @@ declare module 'jodit/config' {
|
|
|
23
23
|
* Save width and height proportions when resizing
|
|
24
24
|
* ```js
|
|
25
25
|
* Jodit.make('#editor', {
|
|
26
|
-
* allowResizeTags: ['img', 'iframe', 'table', 'jodit'],
|
|
26
|
+
* allowResizeTags: new Set(['img', 'iframe', 'table', 'jodit', 'video']),
|
|
27
27
|
* resizer: {
|
|
28
28
|
* useAspectRatio: false, // don't save,
|
|
29
|
-
* useAspectRatio: ['img'], // save only for images
|
|
29
|
+
* useAspectRatio: new Set(['img']), // save only for images
|
|
30
30
|
* useAspectRatio: true // save for all
|
|
31
31
|
* }
|
|
32
32
|
* });
|
|
33
33
|
* ```
|
|
34
|
+
* Images and videos keep it by default. A video with no height of its
|
|
35
|
+
* own keeps it by being given only a width.
|
|
34
36
|
*/
|
|
35
37
|
useAspectRatio: boolean | Set<HTMLTagNames>;
|
|
36
38
|
/**
|
|
@@ -4,12 +4,18 @@
|
|
|
4
4
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
import { Config } from "../../config.js";
|
|
7
|
-
Config.prototype.allowResizeTags = new Set([
|
|
7
|
+
Config.prototype.allowResizeTags = new Set([
|
|
8
|
+
'img',
|
|
9
|
+
'iframe',
|
|
10
|
+
'table',
|
|
11
|
+
'jodit',
|
|
12
|
+
'video'
|
|
13
|
+
]);
|
|
8
14
|
Config.prototype.resizer = {
|
|
9
15
|
showSize: true,
|
|
10
16
|
hideSizeTimeout: 1000,
|
|
11
17
|
forImageChangeAttributes: true,
|
|
12
18
|
min_width: 10,
|
|
13
19
|
min_height: 10,
|
|
14
|
-
useAspectRatio: new Set(['img'])
|
|
20
|
+
useAspectRatio: new Set(['img', 'video'])
|
|
15
21
|
};
|
|
@@ -26,6 +26,7 @@ export declare class resizer extends Plugin {
|
|
|
26
26
|
private height;
|
|
27
27
|
private ratio;
|
|
28
28
|
private rect;
|
|
29
|
+
private layer;
|
|
29
30
|
private sizeViewer;
|
|
30
31
|
/** @override */
|
|
31
32
|
protected afterInit(editor: IJodit): void;
|
|
@@ -33,6 +34,11 @@ export declare class resizer extends Plugin {
|
|
|
33
34
|
* Click in the editor area
|
|
34
35
|
*/
|
|
35
36
|
protected onEditorClick(e: MouseEvent): void;
|
|
37
|
+
/**
|
|
38
|
+
* What a click on `node` resizes: the media in it when it's a media
|
|
39
|
+
* wrapper (`jodit-media`, or one from `mediaWrappers`), or `node` itself
|
|
40
|
+
*/
|
|
41
|
+
private __resizable;
|
|
36
42
|
protected __afterInsertImage(image: HTMLImageElement): void;
|
|
37
43
|
private addEventListeners;
|
|
38
44
|
private onStartResizing;
|
|
@@ -40,12 +46,26 @@ export declare class resizer extends Plugin {
|
|
|
40
46
|
private pointerX;
|
|
41
47
|
private pointerY;
|
|
42
48
|
private onResize;
|
|
49
|
+
private __keyDownRange;
|
|
50
|
+
private __keyDownTable;
|
|
51
|
+
private onEditorKeyDown;
|
|
52
|
+
private __caretTable;
|
|
53
|
+
/**
|
|
54
|
+
* Hide the frame once a key has moved the caret off its element, and
|
|
55
|
+
* frame a table the caret has moved into, as clicks do
|
|
56
|
+
*/
|
|
57
|
+
protected onEditorKeyUp(): void;
|
|
58
|
+
private __followCaret;
|
|
43
59
|
private isAltMode;
|
|
44
60
|
private onKeyDown;
|
|
45
61
|
private onKeyUp;
|
|
46
62
|
private onClickOutside;
|
|
47
63
|
private getWorkplacePosition;
|
|
48
64
|
private applySize;
|
|
65
|
+
/**
|
|
66
|
+
* The framed element can go with a wrapper round it, keeping its parent
|
|
67
|
+
*/
|
|
68
|
+
private get isElementInEditor();
|
|
49
69
|
private onDelete;
|
|
50
70
|
private __onChangeEditor;
|
|
51
71
|
/**
|