jodit 4.18.8 → 4.18.10
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 +13 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +8 -8
- package/es2015/jodit.js +128 -33
- package/es2015/jodit.min.js +6 -6
- 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 +6 -6
- package/es2018/jodit.min.js +6 -6
- 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 +6 -6
- package/es2021/jodit.js +128 -33
- package/es2021/jodit.min.js +6 -6
- 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 +6 -6
- package/es2021.en/jodit.js +102 -7
- package/es2021.en/jodit.min.js +6 -6
- 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 +128 -33
- 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/ui/button/tooltip/tooltip.js +7 -0
- package/esm/langs/ar.d.ts +1 -0
- package/esm/langs/ar.js +2 -1
- package/esm/langs/az.d.ts +1 -0
- package/esm/langs/az.js +2 -1
- package/esm/langs/cs_cz.d.ts +1 -0
- package/esm/langs/cs_cz.js +2 -1
- package/esm/langs/de.d.ts +1 -0
- package/esm/langs/de.js +2 -1
- package/esm/langs/es.d.ts +1 -0
- package/esm/langs/es.js +2 -1
- package/esm/langs/fa.d.ts +1 -0
- package/esm/langs/fa.js +2 -1
- package/esm/langs/fi.d.ts +1 -0
- package/esm/langs/fi.js +2 -1
- package/esm/langs/fr.d.ts +1 -0
- package/esm/langs/fr.js +2 -1
- package/esm/langs/he.d.ts +1 -0
- package/esm/langs/he.js +2 -1
- package/esm/langs/hu.d.ts +1 -0
- package/esm/langs/hu.js +2 -1
- package/esm/langs/id.d.ts +1 -0
- package/esm/langs/id.js +2 -1
- package/esm/langs/it.d.ts +1 -0
- package/esm/langs/it.js +2 -1
- package/esm/langs/ja.d.ts +1 -0
- package/esm/langs/ja.js +2 -1
- package/esm/langs/ko.d.ts +1 -0
- package/esm/langs/ko.js +2 -1
- package/esm/langs/mn.d.ts +1 -0
- package/esm/langs/mn.js +2 -1
- package/esm/langs/nl.d.ts +1 -0
- package/esm/langs/nl.js +2 -1
- package/esm/langs/no.d.ts +1 -0
- package/esm/langs/no.js +2 -1
- package/esm/langs/pl.d.ts +1 -0
- package/esm/langs/pl.js +2 -1
- package/esm/langs/pt_br.d.ts +1 -0
- package/esm/langs/pt_br.js +2 -1
- package/esm/langs/ru.d.ts +1 -0
- package/esm/langs/ru.js +2 -1
- package/esm/langs/sk.d.ts +1 -0
- package/esm/langs/sk.js +2 -1
- package/esm/langs/sv.d.ts +1 -0
- package/esm/langs/sv.js +2 -1
- package/esm/langs/tr.d.ts +1 -0
- package/esm/langs/tr.js +2 -1
- package/esm/langs/ua.d.ts +1 -0
- package/esm/langs/ua.js +2 -1
- package/esm/langs/zh_cn.d.ts +1 -0
- package/esm/langs/zh_cn.js +2 -1
- package/esm/langs/zh_tw.d.ts +1 -0
- package/esm/langs/zh_tw.js +2 -1
- package/esm/modules/dialog/dialog.js +1 -0
- package/esm/plugins/ai-assistant/ui/ui-ai-assistant.js +11 -2
- package/esm/plugins/backspace/cases/check-join-neighbors.js +92 -0
- package/esm/plugins/bold/config.js +2 -2
- package/package.json +1 -1
- package/types/langs/ar.d.ts +1 -0
- package/types/langs/az.d.ts +1 -0
- package/types/langs/cs_cz.d.ts +1 -0
- package/types/langs/de.d.ts +1 -0
- package/types/langs/es.d.ts +1 -0
- package/types/langs/fa.d.ts +1 -0
- package/types/langs/fi.d.ts +1 -0
- package/types/langs/fr.d.ts +1 -0
- package/types/langs/he.d.ts +1 -0
- package/types/langs/hu.d.ts +1 -0
- package/types/langs/id.d.ts +1 -0
- package/types/langs/it.d.ts +1 -0
- package/types/langs/ja.d.ts +1 -0
- package/types/langs/ko.d.ts +1 -0
- package/types/langs/mn.d.ts +1 -0
- package/types/langs/nl.d.ts +1 -0
- package/types/langs/no.d.ts +1 -0
- package/types/langs/pl.d.ts +1 -0
- package/types/langs/pt_br.d.ts +1 -0
- package/types/langs/ru.d.ts +1 -0
- package/types/langs/sk.d.ts +1 -0
- package/types/langs/sv.d.ts +1 -0
- package/types/langs/tr.d.ts +1 -0
- package/types/langs/ua.d.ts +1 -0
- package/types/langs/zh_cn.d.ts +1 -0
- package/types/langs/zh_tw.d.ts +1 -0
|
@@ -11,6 +11,12 @@ import { getMoveFilter } from "../helpers.js";
|
|
|
11
11
|
* @private
|
|
12
12
|
*/
|
|
13
13
|
export function checkJoinNeighbors(jodit, fakeNode, backspace) {
|
|
14
|
+
return joinNeighbors(jodit, fakeNode, backspace, false);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* `moved` is set on the one re-entrant pass after `moveToNextLine`
|
|
18
|
+
*/
|
|
19
|
+
function joinNeighbors(jodit, fakeNode, backspace, moved) {
|
|
14
20
|
if (checkJoinBareText(jodit, fakeNode, backspace)) {
|
|
15
21
|
return true;
|
|
16
22
|
}
|
|
@@ -44,6 +50,16 @@ export function checkJoinNeighbors(jodit, fakeNode, backspace) {
|
|
|
44
50
|
return true;
|
|
45
51
|
}
|
|
46
52
|
const box = findCaretBox(fakeNode, mainClosestBox);
|
|
53
|
+
// One pass only: the line now sits beside the next one, so the
|
|
54
|
+
// cases below join them. The DOM has changed either way
|
|
55
|
+
if (!moved &&
|
|
56
|
+
sibling &&
|
|
57
|
+
moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
|
|
58
|
+
if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
|
|
59
|
+
jodit.s.setCursorBefore(fakeNode);
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
47
63
|
if (sibling &&
|
|
48
64
|
(checkPullNextLine(jodit, fakeNode, box, sibling, backspace) ||
|
|
49
65
|
checkMoveListContent(jodit, box, sibling, backspace) ||
|
|
@@ -109,6 +125,82 @@ function resolveTableSibling(sibling, backspace) {
|
|
|
109
125
|
});
|
|
110
126
|
return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
|
|
111
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* On Delete, Word joins two lines where the next one is, inside or outside
|
|
130
|
+
* its box or quote, and the joined line keeps the caret line's kind, list item
|
|
131
|
+
* or paragraph. Two paragraphs already join that way. When either line is a
|
|
132
|
+
* list item, this moves the caret's line beside the next one, and the usual
|
|
133
|
+
* cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
|
|
134
|
+
* `<div><p>one|</p><ul><li>two</li></ul></div>`
|
|
135
|
+
* @private
|
|
136
|
+
*/
|
|
137
|
+
function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
|
|
138
|
+
if (backspace ||
|
|
139
|
+
Dom.isTag(sibling, 'table') ||
|
|
140
|
+
Dom.isTag(sibling, INSEPARABLE_TAGS) ||
|
|
141
|
+
!Dom.isContentEditable(sibling, jodit.editor)) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
const line = Dom.up(fakeNode, Dom.isBlock, box, true);
|
|
145
|
+
const next = findEdgeBlock(sibling, false, jodit.editor);
|
|
146
|
+
if (!line ||
|
|
147
|
+
!next ||
|
|
148
|
+
!Dom.isContentEditable(next, jodit.editor) ||
|
|
149
|
+
!(Dom.isLeaf(line) || Dom.isLeaf(next)) ||
|
|
150
|
+
// A paragraph inside a list item is left as it is
|
|
151
|
+
Dom.isLeaf(line.parentElement) ||
|
|
152
|
+
Dom.isLeaf(next.parentElement) ||
|
|
153
|
+
boxOf(line) === boxOf(next)) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
const from = line.parentElement;
|
|
157
|
+
if (Dom.isLeaf(line) && Dom.isLeaf(next)) {
|
|
158
|
+
Dom.before(next, line);
|
|
159
|
+
}
|
|
160
|
+
else if (Dom.isLeaf(line)) {
|
|
161
|
+
// A list item keeps its bullet, in a list of its own
|
|
162
|
+
Dom.before(next, ownList(line));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// A paragraph can't go inside a list, so it goes in front of it
|
|
166
|
+
Dom.before(next.parentElement, line);
|
|
167
|
+
}
|
|
168
|
+
let remove = from;
|
|
169
|
+
while (remove && remove !== jodit.editor && Dom.isEmpty(remove)) {
|
|
170
|
+
const parent = remove.parentElement;
|
|
171
|
+
Dom.safeRemove(remove);
|
|
172
|
+
remove = parent;
|
|
173
|
+
}
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The box or quote a line is in, past its lists
|
|
178
|
+
*/
|
|
179
|
+
function boxOf(line) {
|
|
180
|
+
let box = line.parentElement;
|
|
181
|
+
while (Dom.isList(box) || Dom.isLeaf(box)) {
|
|
182
|
+
box = box.parentElement;
|
|
183
|
+
}
|
|
184
|
+
return box;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Moves a list item into a list of its own, which carries on its numbering
|
|
188
|
+
*/
|
|
189
|
+
function ownList(item) {
|
|
190
|
+
const list = item.parentElement;
|
|
191
|
+
const own = list.cloneNode(false);
|
|
192
|
+
const index = Array.from(list.children).indexOf(item);
|
|
193
|
+
if (index) {
|
|
194
|
+
// Two lists cannot share one id
|
|
195
|
+
own.removeAttribute('id');
|
|
196
|
+
if (Dom.isTag(list, 'ol')) {
|
|
197
|
+
const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
|
|
198
|
+
own.setAttribute('start', String(start + index));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
Dom.append(own, item);
|
|
202
|
+
return own;
|
|
203
|
+
}
|
|
112
204
|
/**
|
|
113
205
|
* Delete at the edge of a list pulls the next line up to the caret, as the
|
|
114
206
|
* browsers do, instead of moving the caret's line into the next block:
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import { Config } from "../../config.js";
|
|
7
7
|
Config.prototype.controls.subscript = {
|
|
8
8
|
tags: ['sub'],
|
|
9
|
-
tooltip: '
|
|
9
|
+
tooltip: 'Subscript'
|
|
10
10
|
};
|
|
11
11
|
Config.prototype.controls.superscript = {
|
|
12
12
|
tags: ['sup'],
|
|
13
|
-
tooltip: '
|
|
13
|
+
tooltip: 'Superscript'
|
|
14
14
|
};
|
|
15
15
|
Config.prototype.controls.bold = {
|
|
16
16
|
tagRegExp: /^(strong|b)$/i,
|
package/package.json
CHANGED
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
package/types/langs/sv.d.ts
CHANGED
package/types/langs/tr.d.ts
CHANGED
package/types/langs/ua.d.ts
CHANGED
package/types/langs/zh_cn.d.ts
CHANGED