jodit 4.19.8 → 4.19.9
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 +10 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +3 -3
- package/es2015/jodit.js +43 -19
- package/es2015/jodit.min.js +3 -3
- 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.js +3 -3
- package/es2018/jodit.min.js +3 -3
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +5 -5
- package/es2021/jodit.js +40 -17
- package/es2021/jodit.min.js +5 -5
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +5 -5
- package/es2021.en/jodit.js +40 -17
- package/es2021.en/jodit.min.js +5 -5
- 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 +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +47 -18
- package/es5/jodit.min.css +2 -2
- 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/core/constants.js +1 -1
- package/esm/core/helpers/utils/scroll-into-view.js +9 -2
- package/esm/core/selection/selection.js +7 -4
- package/esm/plugins/enter/helpers/check-br.js +7 -1
- package/esm/plugins/font/config.js +8 -8
- package/esm/plugins/hotkeys/hotkeys.js +11 -0
- package/package.json +1 -1
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.19.
|
|
6
|
+
export const APP_VERSION = "4.19.9";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -20,6 +20,7 @@ const SUBPIXEL_TOLERANCE = 1;
|
|
|
20
20
|
* Check if element is in view
|
|
21
21
|
*/
|
|
22
22
|
export function inView(elm, root, doc) {
|
|
23
|
+
var _a;
|
|
23
24
|
let rect = elm.getBoundingClientRect(), el = elm;
|
|
24
25
|
const top = rect.top, height = rect.height;
|
|
25
26
|
while (el && el !== root && el.parentNode) {
|
|
@@ -44,8 +45,14 @@ export function inView(elm, root, doc) {
|
|
|
44
45
|
// element scrolled above the top was wrongly reported as visible and never
|
|
45
46
|
// scrolled to. See #1279
|
|
46
47
|
const clientHeight = (doc.documentElement && doc.documentElement.clientHeight) || 0;
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
// `scrollIntoView` keeps clear of the document's `scroll-padding`, which
|
|
49
|
+
// is how a page allows for a fixed header or footer, so its edges are the
|
|
50
|
+
// viewport's edges here too
|
|
51
|
+
const style = (_a = doc.defaultView) === null || _a === void 0 ? void 0 : _a.getComputedStyle(doc.documentElement), padding = (value = '') => value.endsWith('%')
|
|
52
|
+
? (parseFloat(value) * clientHeight) / 100
|
|
53
|
+
: parseFloat(value) || 0, viewTop = padding(style === null || style === void 0 ? void 0 : style.scrollPaddingTop), viewBottom = clientHeight - padding(style === null || style === void 0 ? void 0 : style.scrollPaddingBottom);
|
|
54
|
+
return ((top + height <= viewBottom + SUBPIXEL_TOLERANCE || top <= viewTop) &&
|
|
55
|
+
top + height >= viewTop);
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
51
58
|
* Scroll element into view if it is not in view
|
|
@@ -669,7 +669,9 @@ export class Selection {
|
|
|
669
669
|
}
|
|
670
670
|
if (sel && sel.rangeCount) {
|
|
671
671
|
const range = sel.getRangeAt(0);
|
|
672
|
-
|
|
672
|
+
// A block has no first child outside itself to go by, and what's
|
|
673
|
+
// left beside it would show as a line of its own
|
|
674
|
+
const isBlock = Dom.isBlock(node), first = isBlock ? node : node.firstChild;
|
|
673
675
|
if (Dom.isOrContains(this.area, range.commonAncestorContainer)) {
|
|
674
676
|
Dom.safeInsertNode(range, node);
|
|
675
677
|
}
|
|
@@ -677,9 +679,10 @@ export class Selection {
|
|
|
677
679
|
Dom.append(this.area, node);
|
|
678
680
|
}
|
|
679
681
|
[
|
|
680
|
-
() =>
|
|
681
|
-
() =>
|
|
682
|
-
() => { var _a; return (_a =
|
|
682
|
+
() => first === null || first === void 0 ? void 0 : first.previousSibling,
|
|
683
|
+
() => first === null || first === void 0 ? void 0 : first.previousSibling,
|
|
684
|
+
() => { var _a; return (_a = first === null || first === void 0 ? void 0 : first.previousSibling) === null || _a === void 0 ? void 0 : _a.lastChild; },
|
|
685
|
+
() => isBlock ? node.nextSibling : null
|
|
683
686
|
].forEach(getChildNode => {
|
|
684
687
|
const childNode = getChildNode();
|
|
685
688
|
// Only a text node left with nothing in it by the split
|
|
@@ -42,7 +42,13 @@ export function checkBR(fake, jodit, shiftKeyPressed, block) {
|
|
|
42
42
|
Dom.after(br, clone);
|
|
43
43
|
Dom.before(clone, fake);
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
// The new `br` ends the line above, so it takes something on the
|
|
46
|
+
// caret's own line to bring that line into view. Chrome won't scroll to
|
|
47
|
+
// an inline element without width, but it will to a `br`
|
|
48
|
+
const mark = br.cloneNode();
|
|
49
|
+
Dom.before(fake, mark);
|
|
50
|
+
scrollIntoViewIfNeeded(mark, jodit.editor, jodit.ed);
|
|
51
|
+
Dom.safeRemove(mark);
|
|
46
52
|
return true;
|
|
47
53
|
}
|
|
48
54
|
return false;
|
|
@@ -22,6 +22,7 @@ Config.prototype.font = {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
Icon.set('font', fontIcon).set('fontsize', fontsizeIcon);
|
|
25
|
+
const hadSelection = new WeakSet();
|
|
25
26
|
Config.prototype.controls.fontsize = {
|
|
26
27
|
command: 'fontsize',
|
|
27
28
|
data: {
|
|
@@ -40,17 +41,17 @@ Config.prototype.controls.fontsize = {
|
|
|
40
41
|
tooltip: 'Font size',
|
|
41
42
|
value: (editor, button) => {
|
|
42
43
|
var _a;
|
|
43
|
-
const current = editor.s.current();
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const current = editor.s.current(), box = current && Dom.closest(current, Dom.isElement, editor.editor), control = button.control;
|
|
45
|
+
// A select names its value, so until there is a selection it shows the
|
|
46
|
+
// editor's own size, and afterwards the size of the last one
|
|
47
|
+
if (box) {
|
|
48
|
+
hadSelection.add(button);
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
if (!box) {
|
|
50
|
+
else if (control.component !== 'select' || hadSelection.has(button)) {
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
|
-
const control = button.control;
|
|
52
53
|
const cssKey = ((_a = control.data) === null || _a === void 0 ? void 0 : _a.cssRule) || 'font-size';
|
|
53
|
-
const value = css(box, cssKey);
|
|
54
|
+
const value = css(box || editor.editor, cssKey);
|
|
54
55
|
if (cssKey === 'font-size') {
|
|
55
56
|
const numValue = parseFloat(value.toString());
|
|
56
57
|
if (editor.o.defaultFontSizePoints === 'pt') {
|
|
@@ -85,7 +86,6 @@ Config.prototype.controls.fontsize = {
|
|
|
85
86
|
return keySet.has(normalize(value.toString()));
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
|
-
const hadSelection = new WeakSet();
|
|
89
89
|
Config.prototype.controls.font = {
|
|
90
90
|
...Config.prototype.controls.fontsize,
|
|
91
91
|
command: 'fontname',
|
|
@@ -47,6 +47,17 @@ export class hotkeys extends Plugin {
|
|
|
47
47
|
40: 'down',
|
|
48
48
|
45: 'insert',
|
|
49
49
|
46: 'del',
|
|
50
|
+
// With Shift the digit keys send other characters: `&` for 7
|
|
51
|
+
48: '0',
|
|
52
|
+
49: '1',
|
|
53
|
+
50: '2',
|
|
54
|
+
51: '3',
|
|
55
|
+
52: '4',
|
|
56
|
+
53: '5',
|
|
57
|
+
54: '6',
|
|
58
|
+
55: '7',
|
|
59
|
+
56: '8',
|
|
60
|
+
57: '9',
|
|
50
61
|
59: ';',
|
|
51
62
|
61: '=',
|
|
52
63
|
91: 'meta',
|