jodit-pro-react 5.5.40 → 5.5.41
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.
|
@@ -193,7 +193,7 @@ var APP_VERSION, ES, IS_ES_MODERN, IS_ES_NEXT, IS_PROD, IS_TEST, FAT_MODE, HOMEP
|
|
|
193
193
|
var init_constants = __esm({
|
|
194
194
|
"node_modules/jodit/esm/core/constants.js"() {
|
|
195
195
|
"use strict";
|
|
196
|
-
APP_VERSION = "4.12.
|
|
196
|
+
APP_VERSION = "4.12.23";
|
|
197
197
|
ES = "es2020";
|
|
198
198
|
IS_ES_MODERN = true;
|
|
199
199
|
IS_ES_NEXT = true;
|
|
@@ -3063,7 +3063,13 @@ var init_is_equal = __esm({
|
|
|
3063
3063
|
|
|
3064
3064
|
// node_modules/jodit/esm/core/helpers/checker/is-html-from-word.js
|
|
3065
3065
|
function isHtmlFromWord(data) {
|
|
3066
|
-
return data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 || data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 ||
|
|
3066
|
+
return data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 || data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 || // `<meta name=ProgId content=Word.Document>` — attribute values are
|
|
3067
|
+
// unquoted in the raw Word clipboard fragment
|
|
3068
|
+
data.search(/<meta[^>]*?ProgId[^>]*?(Word|Excel)\./i) !== -1 || // LibreOffice/OpenOffice Writer & Calc
|
|
3069
|
+
data.search(/<meta[^>]*?(LibreOffice|OpenOffice)/i) !== -1 || // Office namespaces on the root element of the clipboard fragment
|
|
3070
|
+
data.search(/urn:schemas-microsoft-com:office:(word|excel)/) !== -1 || // `class=MsoNormal` and friends (unquoted/quoted)
|
|
3071
|
+
data.search(/<\w[^>]*\sclass=("|')?Mso/) !== -1 || // the raw Word clipboard uses SINGLE quotes: style='mso-…'
|
|
3072
|
+
data.search(/style='[^']*mso-/) !== -1 || data.search(/style="[^"]*mso-/) !== -1 && data.search(/<font/) !== -1;
|
|
3067
3073
|
}
|
|
3068
3074
|
var init_is_html_from_word = __esm({
|
|
3069
3075
|
"node_modules/jodit/esm/core/helpers/checker/is-html-from-word.js"() {
|
|
@@ -5843,6 +5849,9 @@ var init_view_component = __esm({
|
|
|
5843
5849
|
*/
|
|
5844
5850
|
setParentView(jodit) {
|
|
5845
5851
|
this.jodit = jodit;
|
|
5852
|
+
if (jodit.ow) {
|
|
5853
|
+
this.ownerWindow = jodit.ow;
|
|
5854
|
+
}
|
|
5846
5855
|
jodit.components.add(this);
|
|
5847
5856
|
return this;
|
|
5848
5857
|
}
|
|
@@ -8934,8 +8943,9 @@ var Popup = class _Popup extends UIGroup {
|
|
|
8934
8943
|
* Calculate static bound for point
|
|
8935
8944
|
*/
|
|
8936
8945
|
getKeepBound(getBound) {
|
|
8946
|
+
var _a2;
|
|
8937
8947
|
const oldBound = getBound();
|
|
8938
|
-
const elmUnderCursor = this.od.elementFromPoint(oldBound.left, oldBound.top);
|
|
8948
|
+
const elmUnderCursor = ((_a2 = this.j.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : this.od).elementFromPoint(oldBound.left, oldBound.top);
|
|
8939
8949
|
if (!elmUnderCursor) {
|
|
8940
8950
|
return getBound;
|
|
8941
8951
|
}
|
|
@@ -16134,13 +16144,29 @@ var ToolbarContent = class ToolbarContent2 extends UIButton {
|
|
|
16134
16144
|
}
|
|
16135
16145
|
/** @override */
|
|
16136
16146
|
update() {
|
|
16137
|
-
|
|
16147
|
+
var _a2, _b, _c;
|
|
16148
|
+
const { control } = this;
|
|
16149
|
+
const content = control.getContent(this.j, this);
|
|
16138
16150
|
if (isString(content) || content.parentNode !== this.container) {
|
|
16139
16151
|
Dom.detach(this.container);
|
|
16140
16152
|
this.container.appendChild(isString(content) ? this.j.create.fromHTML(content) : content);
|
|
16141
16153
|
}
|
|
16154
|
+
this.state.disabled = Boolean((_a2 = control.isDisabled) === null || _a2 === void 0 ? void 0 : _a2.call(control, this.j, this));
|
|
16155
|
+
this.state.activated = Boolean((_b = control.isActive) === null || _b === void 0 ? void 0 : _b.call(control, this.j, this));
|
|
16156
|
+
(_c = control.update) === null || _c === void 0 ? void 0 : _c.call(control, this.j, this);
|
|
16157
|
+
this.onChangeDisabled();
|
|
16158
|
+
this.onChangeActivated();
|
|
16142
16159
|
super.update();
|
|
16143
16160
|
}
|
|
16161
|
+
/**
|
|
16162
|
+
* The content is arbitrary HTML — propagate the disabled state to the
|
|
16163
|
+
* nested form controls (e.g. the file input of the Upload button),
|
|
16164
|
+
* otherwise they stay interactive.
|
|
16165
|
+
*/
|
|
16166
|
+
onChangeDisabled() {
|
|
16167
|
+
super.onChangeDisabled();
|
|
16168
|
+
this.container.querySelectorAll("input,button,select,textarea").forEach((elm) => attr(elm, "disabled", this.state.disabled || null));
|
|
16169
|
+
}
|
|
16144
16170
|
/** @override */
|
|
16145
16171
|
createContainer() {
|
|
16146
16172
|
return this.j.c.span(this.componentName);
|
|
@@ -17457,6 +17483,7 @@ function unwrapChildren(style, font2) {
|
|
|
17457
17483
|
// node_modules/jodit/esm/core/selection/style/api/wrap.js
|
|
17458
17484
|
init_dom2();
|
|
17459
17485
|
init_attr();
|
|
17486
|
+
init_css();
|
|
17460
17487
|
|
|
17461
17488
|
// node_modules/jodit/esm/core/selection/style/api/wrap-unwrapped-text.js
|
|
17462
17489
|
init_dom();
|
|
@@ -17499,7 +17526,18 @@ function wrapUnwrappedText(style, elm, jodit) {
|
|
|
17499
17526
|
// node_modules/jodit/esm/core/selection/style/api/wrap.js
|
|
17500
17527
|
function wrap(commitStyle, font2, jodit) {
|
|
17501
17528
|
const wrapper = findOrCreateWrapper(commitStyle, font2, jodit);
|
|
17502
|
-
|
|
17529
|
+
if (commitStyle.elementIsList) {
|
|
17530
|
+
return wrapList(commitStyle, wrapper, jodit);
|
|
17531
|
+
}
|
|
17532
|
+
const newWrapper = Dom.replace(wrapper, commitStyle.element, jodit.createInside, true);
|
|
17533
|
+
if (commitStyle.elementIsBlock) {
|
|
17534
|
+
css(newWrapper, "fontSize", null);
|
|
17535
|
+
css(newWrapper, "fontWeight", null);
|
|
17536
|
+
if (!attr(newWrapper, "style")) {
|
|
17537
|
+
attr(newWrapper, "style", null);
|
|
17538
|
+
}
|
|
17539
|
+
}
|
|
17540
|
+
return newWrapper;
|
|
17503
17541
|
}
|
|
17504
17542
|
var WRAP_NODES = /* @__PURE__ */ new Set([
|
|
17505
17543
|
"td",
|
|
@@ -19023,8 +19061,9 @@ var addNewLine = class extends Plugin {
|
|
|
19023
19061
|
}
|
|
19024
19062
|
}
|
|
19025
19063
|
__onMouseMove(e42) {
|
|
19064
|
+
var _a2;
|
|
19026
19065
|
const editor = this.j;
|
|
19027
|
-
let currentElement = editor.ed.elementFromPoint(e42.clientX, e42.clientY);
|
|
19066
|
+
let currentElement = ((_a2 = editor.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : editor.ed).elementFromPoint(e42.clientX, e42.clientY);
|
|
19028
19067
|
if (!Dom.isHTMLElement(currentElement) || !Dom.isOrContains(editor.editor, currentElement)) {
|
|
19029
19068
|
return;
|
|
19030
19069
|
}
|
|
@@ -19160,13 +19199,20 @@ function checkJoinNeighbors(jodit, fakeNode, backspace2) {
|
|
|
19160
19199
|
jodit.s.setCursorBefore(fakeNode);
|
|
19161
19200
|
return true;
|
|
19162
19201
|
}
|
|
19163
|
-
if (sibling && (checkMoveListContent(jodit, mainClosestBox, sibling, backspace2) || moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace2))) {
|
|
19202
|
+
if (sibling && (checkMoveListContent(jodit, mainClosestBox, sibling, backspace2) || moveContentAndRemoveEmpty(jodit, mainClosestBox, resolveTableSibling(sibling, backspace2), backspace2))) {
|
|
19164
19203
|
jodit.s.setCursorBefore(fakeNode);
|
|
19165
19204
|
return true;
|
|
19166
19205
|
}
|
|
19167
19206
|
}
|
|
19168
19207
|
return false;
|
|
19169
19208
|
}
|
|
19209
|
+
function resolveTableSibling(sibling, backspace2) {
|
|
19210
|
+
if (!Dom.isTag(sibling, "table")) {
|
|
19211
|
+
return sibling;
|
|
19212
|
+
}
|
|
19213
|
+
const cells = sibling.querySelectorAll("td,th");
|
|
19214
|
+
return cells.length ? cells[backspace2 ? cells.length - 1 : 0] : null;
|
|
19215
|
+
}
|
|
19170
19216
|
function checkMoveListContent(jodit, mainClosestBox, sibling, backspace2) {
|
|
19171
19217
|
const siblingIsList = Dom.isTag(sibling, LIST_TAGS);
|
|
19172
19218
|
const boxIsList = Dom.isTag(mainClosestBox, LIST_TAGS);
|
|
@@ -20993,26 +21039,19 @@ function color(editor) {
|
|
|
20993
21039
|
group: "color"
|
|
20994
21040
|
});
|
|
20995
21041
|
const callback = (command, second, third) => {
|
|
21042
|
+
var _a2;
|
|
20996
21043
|
const colorHEX = normalizeColor(third);
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
21008
|
-
editor.s.commitStyle({
|
|
21009
|
-
attributes: {
|
|
21010
|
-
style: {
|
|
21011
|
-
color: !colorHEX ? "" : colorHEX
|
|
21012
|
-
}
|
|
21013
|
-
}
|
|
21014
|
-
});
|
|
21015
|
-
break;
|
|
21044
|
+
const value = !colorHEX ? "" : colorHEX;
|
|
21045
|
+
const style = command === "background" ? { backgroundColor: value } : { color: value };
|
|
21046
|
+
const selectedCells = editor.getInstance("Table", editor.o).getAllSelectedCells();
|
|
21047
|
+
if (selectedCells.length && editor.s.isCollapsed()) {
|
|
21048
|
+
selectedCells.forEach((cell) => {
|
|
21049
|
+
editor.s.select(cell, true);
|
|
21050
|
+
editor.s.commitStyle({ attributes: { style } });
|
|
21051
|
+
});
|
|
21052
|
+
(_a2 = editor.s.sel) === null || _a2 === void 0 ? void 0 : _a2.removeAllRanges();
|
|
21053
|
+
} else {
|
|
21054
|
+
editor.s.commitStyle({ attributes: { style } });
|
|
21016
21055
|
}
|
|
21017
21056
|
editor.synchronizeValues();
|
|
21018
21057
|
return false;
|
|
@@ -24504,10 +24543,26 @@ var inlinePopup = class extends Plugin {
|
|
|
24504
24543
|
this.j.async.setTimeout(() => {
|
|
24505
24544
|
const sel = this.j.s.sel;
|
|
24506
24545
|
if (sel && !sel.isCollapsed) {
|
|
24507
|
-
this.showPopup(() => this.
|
|
24546
|
+
this.showPopup(() => this.__selectionBound(), "selection");
|
|
24508
24547
|
}
|
|
24509
24548
|
}, 1);
|
|
24510
24549
|
}
|
|
24550
|
+
/**
|
|
24551
|
+
* The selection rect comes from the editor document — in iframe mode its
|
|
24552
|
+
* coordinates are iframe-local, while the popup lives in the host
|
|
24553
|
+
* document, so the iframe offset must be added. See
|
|
24554
|
+
* https://github.com/xdan/jodit/issues/1058
|
|
24555
|
+
*/
|
|
24556
|
+
__selectionBound() {
|
|
24557
|
+
const rect = this.j.s.range.getBoundingClientRect();
|
|
24558
|
+
let { left, top } = rect;
|
|
24559
|
+
if (this.j.iframe) {
|
|
24560
|
+
const offset2 = position(this.j.iframe, this.j, true);
|
|
24561
|
+
left += offset2.left;
|
|
24562
|
+
top += offset2.top;
|
|
24563
|
+
}
|
|
24564
|
+
return { left, top, width: rect.width, height: rect.height };
|
|
24565
|
+
}
|
|
24511
24566
|
onSelectionStart() {
|
|
24512
24567
|
this.snapRange = this.j.s.range.cloneRange();
|
|
24513
24568
|
}
|
|
@@ -24540,7 +24595,7 @@ var inlinePopup = class extends Plugin {
|
|
|
24540
24595
|
if (!node) {
|
|
24541
24596
|
return;
|
|
24542
24597
|
}
|
|
24543
|
-
this.showPopup(() =>
|
|
24598
|
+
this.showPopup(() => this.__selectionBound(), type);
|
|
24544
24599
|
}
|
|
24545
24600
|
/**
|
|
24546
24601
|
* In not collapsed selection - only one image
|
|
@@ -26107,6 +26162,7 @@ Config.prototype.controls.paste = {
|
|
|
26107
26162
|
tooltip: "Paste from clipboard",
|
|
26108
26163
|
exec(_0, _1, _22) {
|
|
26109
26164
|
return __async(this, arguments, function* (editor, _12, { control }) {
|
|
26165
|
+
var _a2;
|
|
26110
26166
|
if (control.name === psKey) {
|
|
26111
26167
|
editor.execCommand("showPasteStorage");
|
|
26112
26168
|
return;
|
|
@@ -26117,7 +26173,9 @@ Config.prototype.controls.paste = {
|
|
|
26117
26173
|
try {
|
|
26118
26174
|
const items = yield navigator.clipboard.read();
|
|
26119
26175
|
if (items && items.length) {
|
|
26120
|
-
const
|
|
26176
|
+
const item = items[0];
|
|
26177
|
+
const type = ((_a2 = item.types) === null || _a2 === void 0 ? void 0 : _a2.includes(TEXT_HTML)) ? TEXT_HTML : TEXT_PLAIN;
|
|
26178
|
+
const textBlob = yield item.getType(type);
|
|
26121
26179
|
text = yield new Response(textBlob).text();
|
|
26122
26180
|
}
|
|
26123
26181
|
error2 = false;
|
|
@@ -28086,20 +28144,27 @@ var UISearch = class UISearch2 extends UIElement {
|
|
|
28086
28144
|
return false;
|
|
28087
28145
|
}).on(this.queryInput, "input", () => {
|
|
28088
28146
|
this.setMod("empty-query", !trim(this.queryInput.value).length);
|
|
28089
|
-
}).on(this.queryInput, "keydown",
|
|
28090
|
-
|
|
28091
|
-
|
|
28147
|
+
}).on(this.queryInput, "keydown", (() => {
|
|
28148
|
+
const debounced = this.j.async.debounce((e42) => __async(this, null, function* () {
|
|
28149
|
+
switch (e42.key) {
|
|
28150
|
+
case KEY_ENTER:
|
|
28151
|
+
if (yield jodit.e.fire("searchNext")) {
|
|
28152
|
+
this.close();
|
|
28153
|
+
}
|
|
28154
|
+
break;
|
|
28155
|
+
default:
|
|
28156
|
+
jodit.e.fire(this, "needUpdateCounters");
|
|
28157
|
+
break;
|
|
28158
|
+
}
|
|
28159
|
+
}), this.j.defaultTimeout);
|
|
28160
|
+
return (e42) => {
|
|
28161
|
+
if (e42.key === KEY_ENTER) {
|
|
28092
28162
|
e42.preventDefault();
|
|
28093
28163
|
e42.stopImmediatePropagation();
|
|
28094
|
-
|
|
28095
|
-
|
|
28096
|
-
|
|
28097
|
-
|
|
28098
|
-
default:
|
|
28099
|
-
jodit.e.fire(this, "needUpdateCounters");
|
|
28100
|
-
break;
|
|
28101
|
-
}
|
|
28102
|
-
}), this.j.defaultTimeout));
|
|
28164
|
+
}
|
|
28165
|
+
debounced(e42);
|
|
28166
|
+
};
|
|
28167
|
+
})());
|
|
28103
28168
|
}
|
|
28104
28169
|
onEditorKeyDown(e42) {
|
|
28105
28170
|
if (!this.isOpened) {
|
|
@@ -28793,14 +28858,14 @@ var selectCells = class extends Plugin {
|
|
|
28793
28858
|
* Mouse move inside the table
|
|
28794
28859
|
*/
|
|
28795
28860
|
__onMove(table2, e42) {
|
|
28796
|
-
var _a2;
|
|
28861
|
+
var _a2, _b;
|
|
28797
28862
|
if (this.j.o.readonly && !this.j.isLocked) {
|
|
28798
28863
|
return;
|
|
28799
28864
|
}
|
|
28800
28865
|
if (this.j.isLockedNotBy(key2)) {
|
|
28801
28866
|
return;
|
|
28802
28867
|
}
|
|
28803
|
-
const node = this.j.ed.elementFromPoint(e42.clientX, e42.clientY);
|
|
28868
|
+
const node = ((_a2 = this.j.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : this.j.ed).elementFromPoint(e42.clientX, e42.clientY);
|
|
28804
28869
|
if (!node) {
|
|
28805
28870
|
return;
|
|
28806
28871
|
}
|
|
@@ -28823,7 +28888,7 @@ var selectCells = class extends Plugin {
|
|
|
28823
28888
|
}
|
|
28824
28889
|
const cellsCount = this.__tableModule.getAllSelectedCells().length;
|
|
28825
28890
|
if (cellsCount > 1) {
|
|
28826
|
-
(
|
|
28891
|
+
(_b = this.j.s.sel) === null || _b === void 0 ? void 0 : _b.removeAllRanges();
|
|
28827
28892
|
}
|
|
28828
28893
|
this.j.e.fire("hidePopup");
|
|
28829
28894
|
e42.stopPropagation();
|
|
@@ -28854,13 +28919,13 @@ var selectCells = class extends Plugin {
|
|
|
28854
28919
|
* Stop a selection process
|
|
28855
28920
|
*/
|
|
28856
28921
|
__onStopSelection(table2, e42) {
|
|
28857
|
-
var _a2, _b;
|
|
28922
|
+
var _a2, _b, _c;
|
|
28858
28923
|
if (!this.__selectedCell) {
|
|
28859
28924
|
return;
|
|
28860
28925
|
}
|
|
28861
28926
|
this.__isSelectionMode = false;
|
|
28862
28927
|
this.j.unlock();
|
|
28863
|
-
const node = this.j.ed.elementFromPoint(e42.clientX, e42.clientY);
|
|
28928
|
+
const node = ((_a2 = this.j.o.shadowRoot) !== null && _a2 !== void 0 ? _a2 : this.j.ed).elementFromPoint(e42.clientX, e42.clientY);
|
|
28864
28929
|
if (!node) {
|
|
28865
28930
|
return;
|
|
28866
28931
|
}
|
|
@@ -28876,7 +28941,7 @@ var selectCells = class extends Plugin {
|
|
|
28876
28941
|
cell,
|
|
28877
28942
|
this.__selectedCell
|
|
28878
28943
|
]), box = this.__tableModule.formalMatrix(table2);
|
|
28879
|
-
const max = (
|
|
28944
|
+
const max = (_b = box[bound[1][0]]) === null || _b === void 0 ? void 0 : _b[bound[1][1]], min = (_c = box[bound[0][0]]) === null || _c === void 0 ? void 0 : _c[bound[0][1]];
|
|
28880
28945
|
if (!min || !max) {
|
|
28881
28946
|
return;
|
|
28882
28947
|
}
|
|
@@ -31281,7 +31346,9 @@ var aiAssistant = class extends Plugin {
|
|
|
31281
31346
|
return new UiAiAssistant(jodit, {
|
|
31282
31347
|
onInsertAfter(html) {
|
|
31283
31348
|
jodit.s.focus();
|
|
31284
|
-
jodit.s.
|
|
31349
|
+
const range = jodit.s.range;
|
|
31350
|
+
range.collapse(false);
|
|
31351
|
+
jodit.s.selectRange(range);
|
|
31285
31352
|
jodit.s.insertHTML(html);
|
|
31286
31353
|
__dialog.close();
|
|
31287
31354
|
},
|
|
@@ -33117,6 +33184,13 @@ var Jodit2 = Jodit_1 = class Jodit3 extends ViewWithToolbar {
|
|
|
33117
33184
|
const init2 = () => {
|
|
33118
33185
|
if (opt.enableDragAndDropFileToEditor && opt.uploader && (opt.uploader.url || opt.uploader.insertImageAsBase64URI)) {
|
|
33119
33186
|
this.uploader.bind(this.editor);
|
|
33187
|
+
} else if (!opt.enableDragAndDropFileToEditor) {
|
|
33188
|
+
this.e.on(editor, "drop", (e42) => {
|
|
33189
|
+
var _a2, _b;
|
|
33190
|
+
if ((_b = (_a2 = e42.dataTransfer) === null || _a2 === void 0 ? void 0 : _a2.files) === null || _b === void 0 ? void 0 : _b.length) {
|
|
33191
|
+
e42.preventDefault();
|
|
33192
|
+
}
|
|
33193
|
+
});
|
|
33120
33194
|
}
|
|
33121
33195
|
if (!this.__elementToPlace.get(this.editor)) {
|
|
33122
33196
|
this.__elementToPlace.set(this.editor, currentPlace);
|