jodit 4.18.4 → 4.18.7
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 +45 -0
- package/es2015/jodit.css +13 -34
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +12 -12
- package/es2015/jodit.js +1130 -225
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +12 -12
- 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 +12 -12
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +12 -12
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +13 -34
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +16 -16
- package/es2021/jodit.js +1121 -223
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +16 -16
- 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 +13 -34
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +16 -16
- package/es2021.en/jodit.js +1095 -197
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +16 -16
- 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 +14 -41
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +1260 -273
- 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 +5 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/decorators/component/component.js +12 -0
- 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/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/core/ui/popup/popup.js +14 -9
- package/esm/jodit.js +5 -1
- package/esm/langs/ar.d.ts +3 -0
- package/esm/langs/ar.js +4 -1
- package/esm/langs/az.d.ts +3 -0
- package/esm/langs/az.js +4 -1
- package/esm/langs/cs_cz.d.ts +3 -0
- package/esm/langs/cs_cz.js +4 -1
- package/esm/langs/de.d.ts +3 -0
- package/esm/langs/de.js +4 -1
- package/esm/langs/es.d.ts +3 -0
- package/esm/langs/es.js +4 -1
- package/esm/langs/fa.d.ts +3 -0
- package/esm/langs/fa.js +4 -1
- package/esm/langs/fi.d.ts +3 -0
- package/esm/langs/fi.js +4 -1
- package/esm/langs/fr.d.ts +3 -0
- package/esm/langs/fr.js +4 -1
- package/esm/langs/he.d.ts +3 -0
- package/esm/langs/he.js +4 -1
- package/esm/langs/hu.d.ts +3 -0
- package/esm/langs/hu.js +4 -1
- package/esm/langs/id.d.ts +3 -0
- package/esm/langs/id.js +4 -1
- package/esm/langs/it.d.ts +3 -0
- package/esm/langs/it.js +4 -1
- package/esm/langs/ja.d.ts +3 -0
- package/esm/langs/ja.js +4 -1
- package/esm/langs/ko.d.ts +3 -0
- package/esm/langs/ko.js +4 -1
- package/esm/langs/mn.d.ts +3 -0
- package/esm/langs/mn.js +4 -1
- package/esm/langs/nl.d.ts +3 -0
- package/esm/langs/nl.js +4 -1
- package/esm/langs/no.d.ts +3 -0
- package/esm/langs/no.js +4 -1
- package/esm/langs/pl.d.ts +3 -0
- package/esm/langs/pl.js +4 -1
- package/esm/langs/pt_br.d.ts +3 -0
- package/esm/langs/pt_br.js +4 -1
- package/esm/langs/ru.d.ts +3 -0
- package/esm/langs/ru.js +4 -1
- package/esm/langs/sk.d.ts +3 -0
- package/esm/langs/sk.js +4 -1
- package/esm/langs/sv.d.ts +3 -0
- package/esm/langs/sv.js +4 -1
- package/esm/langs/tr.d.ts +3 -0
- package/esm/langs/tr.js +4 -1
- package/esm/langs/ua.d.ts +3 -0
- package/esm/langs/ua.js +4 -1
- package/esm/langs/zh_cn.d.ts +3 -0
- package/esm/langs/zh_cn.js +4 -1
- package/esm/langs/zh_tw.d.ts +3 -0
- package/esm/langs/zh_tw.js +4 -1
- package/esm/modules/dialog/dialog.d.ts +7 -0
- package/esm/modules/dialog/dialog.js +24 -6
- package/esm/modules/file-browser/ui/files/files.js +17 -2
- package/esm/modules/file-browser/ui/tree/tree.js +17 -2
- package/esm/modules/table/table.d.ts +6 -0
- package/esm/modules/table/table.js +18 -26
- package/esm/plugins/backspace/cases/check-join-neighbors.js +90 -3
- package/esm/plugins/backspace/cases/check-remove-char.d.ts +2 -1
- package/esm/plugins/backspace/cases/check-remove-char.js +25 -4
- package/esm/plugins/backspace/config.d.ts +2 -0
- package/esm/plugins/backspace/config.js +6 -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.js +6 -1
- package/esm/plugins/image-properties/image-properties.d.ts +5 -0
- package/esm/plugins/image-properties/image-properties.js +30 -5
- package/esm/plugins/inline-popup/inline-popup.d.ts +19 -0
- package/esm/plugins/inline-popup/inline-popup.js +70 -1
- package/esm/plugins/mobile/mobile.js +7 -4
- 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/resizer.d.ts +10 -0
- package/esm/plugins/resizer/resizer.js +76 -2
- 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/package.json +1 -1
- package/types/config.d.ts +5 -0
- package/types/core/helpers/html/word-lists.d.ts +29 -0
- 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 +3 -0
- package/types/langs/az.d.ts +3 -0
- package/types/langs/cs_cz.d.ts +3 -0
- package/types/langs/de.d.ts +3 -0
- package/types/langs/es.d.ts +3 -0
- package/types/langs/fa.d.ts +3 -0
- package/types/langs/fi.d.ts +3 -0
- package/types/langs/fr.d.ts +3 -0
- package/types/langs/he.d.ts +3 -0
- package/types/langs/hu.d.ts +3 -0
- package/types/langs/id.d.ts +3 -0
- package/types/langs/it.d.ts +3 -0
- package/types/langs/ja.d.ts +3 -0
- package/types/langs/ko.d.ts +3 -0
- package/types/langs/mn.d.ts +3 -0
- package/types/langs/nl.d.ts +3 -0
- package/types/langs/no.d.ts +3 -0
- package/types/langs/pl.d.ts +3 -0
- package/types/langs/pt_br.d.ts +3 -0
- package/types/langs/ru.d.ts +3 -0
- package/types/langs/sk.d.ts +3 -0
- package/types/langs/sv.d.ts +3 -0
- package/types/langs/tr.d.ts +3 -0
- package/types/langs/ua.d.ts +3 -0
- package/types/langs/zh_cn.d.ts +3 -0
- package/types/langs/zh_tw.d.ts +3 -0
- package/types/modules/dialog/dialog.d.ts +7 -0
- package/types/modules/table/table.d.ts +6 -0
- package/types/plugins/backspace/cases/check-remove-char.d.ts +2 -1
- package/types/plugins/backspace/config.d.ts +2 -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-properties/image-properties.d.ts +5 -0
- 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/resizer.d.ts +10 -0
- package/types/plugins/select-cells/select-cells.d.ts +23 -0
|
@@ -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
|
});
|
|
@@ -46,6 +46,16 @@ export declare class resizer extends Plugin {
|
|
|
46
46
|
private pointerX;
|
|
47
47
|
private pointerY;
|
|
48
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;
|
|
49
59
|
private isAltMode;
|
|
50
60
|
private onKeyDown;
|
|
51
61
|
private onKeyUp;
|
|
@@ -17,10 +17,13 @@ import * as consts from "../../core/constants.js";
|
|
|
17
17
|
import { IS_ES_NEXT, IS_IE, KEY_ALT } from "../../core/constants.js";
|
|
18
18
|
import { autobind, watch } from "../../core/decorators/index.js";
|
|
19
19
|
import { Dom } from "../../core/dom/dom.js";
|
|
20
|
-
import { eventEmitter, pluginSystem } from "../../core/global.js";
|
|
20
|
+
import { eventEmitter, getContainer, pluginSystem } from "../../core/global.js";
|
|
21
21
|
import { $$, attr, css, dataBind, getWrappedMedia, innerWidth, markOwner, offset } from "../../core/helpers/index.js";
|
|
22
22
|
import { cssInline } from "../../core/helpers/utils/css.js";
|
|
23
23
|
import { Plugin } from "../../core/plugin/plugin.js";
|
|
24
|
+
import { isMoved } from "../../core/selection/helpers/index.js";
|
|
25
|
+
import { UIElement } from "../../core/ui/index.js";
|
|
26
|
+
import { Popup } from "../../core/ui/popup/index.js";
|
|
24
27
|
import "./config.js";
|
|
25
28
|
const keyBInd = '__jodit-resizer_binded';
|
|
26
29
|
/**
|
|
@@ -45,6 +48,17 @@ function heightFollowsWidth(element) {
|
|
|
45
48
|
!attr(element, 'height') &&
|
|
46
49
|
!cssInline(element, 'height'));
|
|
47
50
|
}
|
|
51
|
+
const IFRAME_WRAPPER = '[data-jodit_iframe_wrapper]';
|
|
52
|
+
/**
|
|
53
|
+
* A click on an embed lands on its wrapper, so it selects the embed, until the
|
|
54
|
+
* wrapper is active. While the editor is locked, as during resizing, the
|
|
55
|
+
* wrapper takes the mouse again.
|
|
56
|
+
*/
|
|
57
|
+
const EMBED_WRAPPER_STYLE = `${IFRAME_WRAPPER}{position:relative;display:block;user-select:none}` +
|
|
58
|
+
`${IFRAME_WRAPPER} iframe{position:relative}` +
|
|
59
|
+
`${IFRAME_WRAPPER}::after{position:absolute;z-index:1;display:block;background:transparent;content:'';cursor:pointer;inset:0}` +
|
|
60
|
+
`${IFRAME_WRAPPER}[data-jodit-wrapper_active=true] iframe{z-index:2}` +
|
|
61
|
+
`.jodit_lock ${IFRAME_WRAPPER}[data-jodit-wrapper_active=true] iframe{z-index:1}`;
|
|
48
62
|
/**
|
|
49
63
|
* The module creates a supporting frame for resizing of the elements img and table
|
|
50
64
|
*/
|
|
@@ -72,6 +86,8 @@ export class resizer extends Plugin {
|
|
|
72
86
|
this.sizeViewer = this.rect.getElementsByTagName('span')[0];
|
|
73
87
|
this.pointerX = 0;
|
|
74
88
|
this.pointerY = 0;
|
|
89
|
+
this.__keyDownRange = null;
|
|
90
|
+
this.__keyDownTable = null;
|
|
75
91
|
this.isAltMode = false;
|
|
76
92
|
this.onClickElement = (element) => {
|
|
77
93
|
if (this.isResizeMode) {
|
|
@@ -123,6 +139,9 @@ export class resizer extends Plugin {
|
|
|
123
139
|
}
|
|
124
140
|
/** @override */
|
|
125
141
|
afterInit(editor) {
|
|
142
|
+
// It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
|
|
143
|
+
getContainer(editor, 'resizer', 'style', true).textContent =
|
|
144
|
+
EMBED_WRAPPER_STYLE;
|
|
126
145
|
$$('div', this.rect).forEach((resizeHandle) => {
|
|
127
146
|
editor.e.on(resizeHandle, 'mousedown.resizer touchstart.resizer', this.onStartResizing.bind(this, resizeHandle));
|
|
128
147
|
});
|
|
@@ -134,6 +153,9 @@ export class resizer extends Plugin {
|
|
|
134
153
|
}
|
|
135
154
|
})
|
|
136
155
|
.on('afterInit changePlace', this.addEventListeners.bind(this))
|
|
156
|
+
// Handlers without a namespace run first, ahead of those that
|
|
157
|
+
// move the caret, as table-keyboard-navigation's do
|
|
158
|
+
.on('keydown', this.onEditorKeyDown, { top: true })
|
|
137
159
|
.on('afterGetValueFromEditor.resizer', (data) => {
|
|
138
160
|
const rgx = /<jodit[^>]+data-jodit_iframe_wrapper[^>]+>(.*?<iframe[^>]*>.*?<\/iframe>.*?)<\/jodit>/gi;
|
|
139
161
|
if (rgx.test(data.value)) {
|
|
@@ -308,6 +330,43 @@ export class resizer extends Plugin {
|
|
|
308
330
|
e.stopImmediatePropagation();
|
|
309
331
|
}
|
|
310
332
|
}
|
|
333
|
+
onEditorKeyDown(event) {
|
|
334
|
+
// A key held down moves the caret on every repeat, with one keyup
|
|
335
|
+
if (event === null || event === void 0 ? void 0 : event.repeat) {
|
|
336
|
+
this.__followCaret();
|
|
337
|
+
}
|
|
338
|
+
this.__keyDownRange = this.j.s.range.cloneRange();
|
|
339
|
+
this.__keyDownTable = this.__caretTable();
|
|
340
|
+
}
|
|
341
|
+
__caretTable() {
|
|
342
|
+
return Dom.closest(this.j.s.range.startContainer, 'table', this.j.editor);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Hide the frame once a key has moved the caret off its element, and
|
|
346
|
+
* frame a table the caret has moved into, as clicks do
|
|
347
|
+
*/
|
|
348
|
+
onEditorKeyUp() {
|
|
349
|
+
this.__followCaret();
|
|
350
|
+
}
|
|
351
|
+
__followCaret() {
|
|
352
|
+
const before = this.__keyDownRange;
|
|
353
|
+
this.__keyDownRange = null;
|
|
354
|
+
if (!isMoved(this.j, before)) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (this.isShown &&
|
|
358
|
+
this.element &&
|
|
359
|
+
!this.j.s.range.intersectsNode(this.element)) {
|
|
360
|
+
this.hide();
|
|
361
|
+
}
|
|
362
|
+
const table = this.__caretTable();
|
|
363
|
+
if (table &&
|
|
364
|
+
table !== this.__keyDownTable &&
|
|
365
|
+
this.j.o.allowResizeTags.has('table')) {
|
|
366
|
+
this.__bind(table);
|
|
367
|
+
this.onClickElement(table);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
311
370
|
onKeyDown(e) {
|
|
312
371
|
this.isAltMode = e.key === KEY_ALT;
|
|
313
372
|
if (!this.isAltMode && this.isResizeMode) {
|
|
@@ -329,6 +388,12 @@ export class resizer extends Plugin {
|
|
|
329
388
|
return;
|
|
330
389
|
}
|
|
331
390
|
if (!this.isResizeMode) {
|
|
391
|
+
// A click in the element's popup, or in a list it opens, works on
|
|
392
|
+
// the element, so it keeps its frame
|
|
393
|
+
if ((e === null || e === void 0 ? void 0 : e.target) &&
|
|
394
|
+
UIElement.closestElement(e.target, Popup)) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
332
397
|
return this.hide();
|
|
333
398
|
}
|
|
334
399
|
e.stopImmediatePropagation();
|
|
@@ -512,7 +577,10 @@ export class resizer extends Plugin {
|
|
|
512
577
|
this.hide();
|
|
513
578
|
Dom.safeRemove(this.layer);
|
|
514
579
|
eventEmitter.off('hideHelpers', this.hide);
|
|
515
|
-
jodit.e
|
|
580
|
+
jodit.e
|
|
581
|
+
.off(this.j.ow, '.resizer')
|
|
582
|
+
.off('.resizer')
|
|
583
|
+
.off('keydown', this.onEditorKeyDown);
|
|
516
584
|
}
|
|
517
585
|
}
|
|
518
586
|
__decorate([
|
|
@@ -530,6 +598,12 @@ __decorate([
|
|
|
530
598
|
__decorate([
|
|
531
599
|
autobind
|
|
532
600
|
], resizer.prototype, "onResize", null);
|
|
601
|
+
__decorate([
|
|
602
|
+
autobind
|
|
603
|
+
], resizer.prototype, "onEditorKeyDown", null);
|
|
604
|
+
__decorate([
|
|
605
|
+
watch(':keyup')
|
|
606
|
+
], resizer.prototype, "onEditorKeyUp", null);
|
|
533
607
|
__decorate([
|
|
534
608
|
autobind
|
|
535
609
|
], resizer.prototype, "onKeyDown", null);
|
|
@@ -18,6 +18,29 @@ export declare class selectCells extends Plugin {
|
|
|
18
18
|
*/
|
|
19
19
|
private get __tableModule();
|
|
20
20
|
protected afterInit(jodit: IJodit): void;
|
|
21
|
+
/**
|
|
22
|
+
* The cell with the caret, and the selection, when a key went down
|
|
23
|
+
*/
|
|
24
|
+
private __keyDownCell;
|
|
25
|
+
private __keyDownRange;
|
|
26
|
+
private __onKeyDown;
|
|
27
|
+
/**
|
|
28
|
+
* A link's popup replaces the cell's while the caret is in the link
|
|
29
|
+
*/
|
|
30
|
+
private __keyDownInLink;
|
|
31
|
+
private __isInLink;
|
|
32
|
+
/**
|
|
33
|
+
* Where the selection starts rather than `s.current()`, which finds the
|
|
34
|
+
* first cell when the caret is just before the table
|
|
35
|
+
*/
|
|
36
|
+
private __caretCell;
|
|
37
|
+
/**
|
|
38
|
+
* A key that moves the caret into a cell, from another cell or from
|
|
39
|
+
* outside the table, marks that cell and opens its popup, as a click on
|
|
40
|
+
* it does. One that moves the caret out of the table unmarks the cells
|
|
41
|
+
*/
|
|
42
|
+
protected onKeyUp(): void;
|
|
43
|
+
private __followCaret;
|
|
21
44
|
/**
|
|
22
45
|
* First selected cell
|
|
23
46
|
*/
|
|
@@ -19,6 +19,7 @@ import { Dom } from "../../core/dom/dom.js";
|
|
|
19
19
|
import { pluginSystem } from "../../core/global.js";
|
|
20
20
|
import { $$, alignElement, position, toArray } from "../../core/helpers/index.js";
|
|
21
21
|
import { Plugin } from "../../core/plugin/index.js";
|
|
22
|
+
import { isMoved } from "../../core/selection/helpers/index.js";
|
|
22
23
|
import { Table } from "../../modules/table/table.js";
|
|
23
24
|
import "./config.js";
|
|
24
25
|
const key = 'table_processor_observer';
|
|
@@ -26,6 +27,15 @@ const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
|
|
|
26
27
|
export class selectCells extends Plugin {
|
|
27
28
|
constructor() {
|
|
28
29
|
super(...arguments);
|
|
30
|
+
/**
|
|
31
|
+
* The cell with the caret, and the selection, when a key went down
|
|
32
|
+
*/
|
|
33
|
+
this.__keyDownCell = null;
|
|
34
|
+
this.__keyDownRange = null;
|
|
35
|
+
/**
|
|
36
|
+
* A link's popup replaces the cell's while the caret is in the link
|
|
37
|
+
*/
|
|
38
|
+
this.__keyDownInLink = false;
|
|
29
39
|
/**
|
|
30
40
|
* First selected cell
|
|
31
41
|
*/
|
|
@@ -46,6 +56,9 @@ export class selectCells extends Plugin {
|
|
|
46
56
|
return;
|
|
47
57
|
}
|
|
48
58
|
jodit.e
|
|
59
|
+
// Handlers without a namespace run first, ahead of those that
|
|
60
|
+
// move the caret, as table-keyboard-navigation's do
|
|
61
|
+
.on('keydown', this.__onKeyDown, { top: true })
|
|
49
62
|
.on('keydown.select-cells', (event) => {
|
|
50
63
|
if (event.key === KEY_TAB) {
|
|
51
64
|
this.unselectCells();
|
|
@@ -76,6 +89,61 @@ export class selectCells extends Plugin {
|
|
|
76
89
|
}
|
|
77
90
|
});
|
|
78
91
|
}
|
|
92
|
+
__onKeyDown(event) {
|
|
93
|
+
// A key held down moves the caret on every repeat, with one keyup
|
|
94
|
+
if (event === null || event === void 0 ? void 0 : event.repeat) {
|
|
95
|
+
this.__followCaret();
|
|
96
|
+
}
|
|
97
|
+
this.__keyDownCell = this.__caretCell();
|
|
98
|
+
this.__keyDownRange = this.j.s.range.cloneRange();
|
|
99
|
+
this.__keyDownInLink = this.__isInLink();
|
|
100
|
+
}
|
|
101
|
+
__isInLink() {
|
|
102
|
+
return Boolean(Dom.closest(this.j.s.range.startContainer, 'a', this.j.editor));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Where the selection starts rather than `s.current()`, which finds the
|
|
106
|
+
* first cell when the caret is just before the table
|
|
107
|
+
*/
|
|
108
|
+
__caretCell() {
|
|
109
|
+
return Dom.closest(this.j.s.range.startContainer, Dom.isCell, this.j.editor);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A key that moves the caret into a cell, from another cell or from
|
|
113
|
+
* outside the table, marks that cell and opens its popup, as a click on
|
|
114
|
+
* it does. One that moves the caret out of the table unmarks the cells
|
|
115
|
+
*/
|
|
116
|
+
onKeyUp() {
|
|
117
|
+
this.__followCaret();
|
|
118
|
+
}
|
|
119
|
+
__followCaret() {
|
|
120
|
+
const before = this.__keyDownRange;
|
|
121
|
+
this.__keyDownRange = null;
|
|
122
|
+
if (this.j.o.readonly || !isMoved(this.j, before)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const cell = this.__caretCell();
|
|
126
|
+
const hasLeftLink = this.__keyDownInLink && !this.__isInLink();
|
|
127
|
+
if (cell === this.__keyDownCell && !(cell && hasLeftLink)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const hadMarked = this.__tableModule.getAllSelectedCells().length > 0;
|
|
131
|
+
this.unselectCells();
|
|
132
|
+
if (!cell) {
|
|
133
|
+
if (hadMarked) {
|
|
134
|
+
this.j.e.fire('hidePopup', 'cells');
|
|
135
|
+
}
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const table = Dom.closest(cell, 'table', this.j.editor);
|
|
139
|
+
if (!table) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// As after a click, the first change to the cell keeps the mark
|
|
143
|
+
this.__selectedCell = cell;
|
|
144
|
+
this.__tableModule.addSelection(cell);
|
|
145
|
+
this.j.e.fire('showPopup', table, () => position(cell, this.j), 'cells');
|
|
146
|
+
}
|
|
79
147
|
/**
|
|
80
148
|
* Mouse click inside the table
|
|
81
149
|
*/
|
|
@@ -418,10 +486,16 @@ export class selectCells extends Plugin {
|
|
|
418
486
|
/** @override */
|
|
419
487
|
beforeDestruct(jodit) {
|
|
420
488
|
this.__onRemoveSelection();
|
|
421
|
-
jodit.e.off('.select-cells');
|
|
489
|
+
jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
|
|
422
490
|
}
|
|
423
491
|
}
|
|
424
492
|
selectCells.requires = ['select'];
|
|
493
|
+
__decorate([
|
|
494
|
+
autobind
|
|
495
|
+
], selectCells.prototype, "__onKeyDown", null);
|
|
496
|
+
__decorate([
|
|
497
|
+
watch(':keyup')
|
|
498
|
+
], selectCells.prototype, "onKeyUp", null);
|
|
425
499
|
__decorate([
|
|
426
500
|
autobind
|
|
427
501
|
], selectCells.prototype, "onStartSelection", null);
|
|
@@ -36,7 +36,9 @@ export function tableKeyboardNavigation(editor) {
|
|
|
36
36
|
case consts.KEY_TAB:
|
|
37
37
|
case consts.KEY_LEFT: {
|
|
38
38
|
next = getNextCell();
|
|
39
|
-
|
|
39
|
+
// Left in the first cell leaves the table, as Up in the
|
|
40
|
+
// top row does
|
|
41
|
+
if (!next && key === consts.KEY_TAB) {
|
|
40
42
|
tableModule.appendRow(table, !isPrev
|
|
41
43
|
? false
|
|
42
44
|
: Dom.first(table, node => Dom.isTag(node, 'tr')), !isPrev);
|
|
@@ -65,7 +67,6 @@ export function tableKeyboardNavigation(editor) {
|
|
|
65
67
|
if (!next) {
|
|
66
68
|
return;
|
|
67
69
|
}
|
|
68
|
-
editor.e.fire('hidePopup hideResizer');
|
|
69
70
|
if (!next.firstChild) {
|
|
70
71
|
const first = editor.createInside.element('br');
|
|
71
72
|
Dom.append(next, first);
|
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -1034,6 +1034,8 @@ interface Config {
|
|
|
1034
1034
|
interface Config {
|
|
1035
1035
|
/**
|
|
1036
1036
|
* Keyboard hotkey mappings for delete and backspace operations (character, word, sentence).
|
|
1037
|
+
* On macOS the defaults leave out Cmd+Backspace, Ctrl+Backspace, Ctrl+Option+Backspace
|
|
1038
|
+
* and Cmd+Option+Backspace, so the browser applies the system's own bindings to them.
|
|
1037
1039
|
*/
|
|
1038
1040
|
delete: {
|
|
1039
1041
|
hotkeys: {
|
|
@@ -1404,6 +1406,9 @@ interface Config {
|
|
|
1404
1406
|
iframeDoctype: string;
|
|
1405
1407
|
/**
|
|
1406
1408
|
* Custom style to be used inside the iframe to display content.
|
|
1409
|
+
* It goes in after `iframeCSSLinks`. The rules Jodit's own plugins need
|
|
1410
|
+
* in the editing document are added apart from it, so a value of your
|
|
1411
|
+
* own doesn't have to repeat them.
|
|
1407
1412
|
*
|
|
1408
1413
|
* ```javascript
|
|
1409
1414
|
* Jodit.make('#editor', {
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
* A Word list paragraph, read before its `mso-list` style is lost
|
|
8
|
+
*/
|
|
9
|
+
export interface WordListItem {
|
|
10
|
+
paragraph: HTMLElement;
|
|
11
|
+
list: string;
|
|
12
|
+
level: number;
|
|
13
|
+
tag: 'ul' | 'ol';
|
|
14
|
+
listStyleType: string | null;
|
|
15
|
+
start: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Finds Word's list paragraphs (`<p style="mso-list:l0 level1 lfo1">`), reads
|
|
19
|
+
* their list, level and type from the `mso-list:Ignore` marker, and removes the
|
|
20
|
+
* marker. Call it before anything strips the `mso-list` styles, then pass the
|
|
21
|
+
* result to {@link wrapWordListItems}
|
|
22
|
+
*/
|
|
23
|
+
export declare function readWordListItems(root: HTMLElement): WordListItem[];
|
|
24
|
+
/**
|
|
25
|
+
* Turns the paragraphs found by {@link readWordListItems} into `<ul>`/`<ol>`
|
|
26
|
+
* lists, nesting them by level. Each paragraph becomes an `<li>` without Word's
|
|
27
|
+
* hanging indent
|
|
28
|
+
*/
|
|
29
|
+
export declare function wrapWordListItems(items: WordListItem[]): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 selection
|
|
8
|
+
*/
|
|
9
|
+
import type { IJodit, Nullable } from "../../../types/index";
|
|
10
|
+
/**
|
|
11
|
+
* Whether the selection, `before` as it was when a key went down, has since
|
|
12
|
+
* moved to somewhere else in the editor
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare function isMoved(jodit: IJodit, before: Nullable<Range>): boolean;
|
package/types/langs/ar.d.ts
CHANGED
package/types/langs/az.d.ts
CHANGED
package/types/langs/cs_cz.d.ts
CHANGED
package/types/langs/de.d.ts
CHANGED
package/types/langs/es.d.ts
CHANGED
package/types/langs/fa.d.ts
CHANGED
package/types/langs/fi.d.ts
CHANGED
package/types/langs/fr.d.ts
CHANGED
package/types/langs/he.d.ts
CHANGED
package/types/langs/hu.d.ts
CHANGED
package/types/langs/id.d.ts
CHANGED
package/types/langs/it.d.ts
CHANGED
package/types/langs/ja.d.ts
CHANGED
package/types/langs/ko.d.ts
CHANGED
package/types/langs/mn.d.ts
CHANGED
package/types/langs/nl.d.ts
CHANGED
package/types/langs/no.d.ts
CHANGED
package/types/langs/pl.d.ts
CHANGED
package/types/langs/pt_br.d.ts
CHANGED
package/types/langs/ru.d.ts
CHANGED
package/types/langs/sk.d.ts
CHANGED