jodit-pro-react 5.5.62 → 5.5.64
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.
|
@@ -5168,15 +5168,20 @@ svg.jodit-icon {
|
|
|
5168
5168
|
--jd-slot-left-width:auto;
|
|
5169
5169
|
--jd-slot-right-width:auto;
|
|
5170
5170
|
}
|
|
5171
|
+
.jodit .jodit-jodit__workplace-slot_above_true,
|
|
5171
5172
|
.jodit .jodit-jodit__workplace-slot_bottom_true,
|
|
5172
5173
|
.jodit .jodit-jodit__workplace-slot_top_true {
|
|
5173
5174
|
flex: 0 0 auto;
|
|
5174
5175
|
min-width: 0;
|
|
5175
5176
|
}
|
|
5177
|
+
.jodit .jodit-jodit__workplace-slot_above_true:empty,
|
|
5176
5178
|
.jodit .jodit-jodit__workplace-slot_bottom_true:empty,
|
|
5177
5179
|
.jodit .jodit-jodit__workplace-slot_top_true:empty {
|
|
5178
5180
|
display: none;
|
|
5179
5181
|
}
|
|
5182
|
+
.jodit .jodit-jodit__workplace-slot_above_true:not(:empty) {
|
|
5183
|
+
border-bottom: 1px solid var(--jd-color-border,transparent);
|
|
5184
|
+
}
|
|
5180
5185
|
.jodit .jodit-jodit__workplace-slot_top_true {
|
|
5181
5186
|
height: var(--jd-slot-top-height);
|
|
5182
5187
|
}
|
|
@@ -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.
|
|
196
|
+
APP_VERSION = "4.13.5";
|
|
197
197
|
ES = "es2020";
|
|
198
198
|
IS_ES_MODERN = true;
|
|
199
199
|
IS_ES_NEXT = true;
|
|
@@ -4447,7 +4447,7 @@ function safeHTML(box, options2) {
|
|
|
4447
4447
|
}
|
|
4448
4448
|
const foreign = box.querySelectorAll("math *, svg *");
|
|
4449
4449
|
for (let i54 = 0; i54 < foreign.length; i54++) {
|
|
4450
|
-
if (foreign[i54]
|
|
4450
|
+
if (box.contains(foreign[i54]) && isSmuggledForeignHtml(foreign[i54])) {
|
|
4451
4451
|
Dom.safeRemove(foreign[i54]);
|
|
4452
4452
|
}
|
|
4453
4453
|
}
|
|
@@ -4517,7 +4517,8 @@ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
|
|
|
4517
4517
|
const tagName = elm.nodeName.toLowerCase();
|
|
4518
4518
|
const href = elm.getAttribute("href");
|
|
4519
4519
|
if (safeJavaScriptLink && href && isDangerousUrl(href, tagName)) {
|
|
4520
|
-
|
|
4520
|
+
const protocol = typeof location !== "undefined" ? location.protocol : "http:";
|
|
4521
|
+
attr(elm, "href", protocol + "//" + href);
|
|
4521
4522
|
effected = true;
|
|
4522
4523
|
}
|
|
4523
4524
|
if (safeJavaScriptLink) {
|
|
@@ -11594,9 +11595,24 @@ var ViewWithToolbar = class extends View {
|
|
|
11594
11595
|
if (!this.o.fullsize && (isString(this.o.toolbar) || Dom.isHTMLElement(this.o.toolbar))) {
|
|
11595
11596
|
return resolveElement(this.o.toolbar, this.o.shadowRoot || this.od);
|
|
11596
11597
|
}
|
|
11597
|
-
this.o.toolbar &&
|
|
11598
|
+
this.o.toolbar && this.__appendToolbarBox();
|
|
11598
11599
|
return this.__defaultToolbarContainer;
|
|
11599
11600
|
}
|
|
11601
|
+
/**
|
|
11602
|
+
* Keep the toolbar box as the first child of the container, except that
|
|
11603
|
+
* children flagged with `data-jodit-above-toolbar` (e.g. the `above`
|
|
11604
|
+
* workplace slot used for presence bars and banners) stay above it.
|
|
11605
|
+
*/
|
|
11606
|
+
__appendToolbarBox() {
|
|
11607
|
+
const box = this.__defaultToolbarContainer;
|
|
11608
|
+
let anchor = this.container.firstElementChild;
|
|
11609
|
+
while (anchor && anchor !== box && anchor.hasAttribute("data-jodit-above-toolbar")) {
|
|
11610
|
+
anchor = anchor.nextElementSibling;
|
|
11611
|
+
}
|
|
11612
|
+
if (anchor !== box) {
|
|
11613
|
+
this.container.insertBefore(box, anchor);
|
|
11614
|
+
}
|
|
11615
|
+
}
|
|
11600
11616
|
/**
|
|
11601
11617
|
* Change panel container
|
|
11602
11618
|
*/
|
|
@@ -18810,6 +18826,130 @@ var Selection = class {
|
|
|
18810
18826
|
}
|
|
18811
18827
|
return "";
|
|
18812
18828
|
}
|
|
18829
|
+
/**
|
|
18830
|
+
* Splits the boundaries of the current selection and wraps every
|
|
18831
|
+
* contiguous run of selected inline content (grouped by block) into a
|
|
18832
|
+
* `<font>` element, returning those wrappers in document order.
|
|
18833
|
+
*
|
|
18834
|
+
* This is a pure-DOM replacement for the old
|
|
18835
|
+
* `nativeExecCommand('fontsize', false, '7')` trick which relied on the
|
|
18836
|
+
* browser to split the selection into `<font size="7">` fragments.
|
|
18837
|
+
*/
|
|
18838
|
+
__wrapSelectionFragments() {
|
|
18839
|
+
const range = this.range;
|
|
18840
|
+
this.__splitSelectionBoundaries(range);
|
|
18841
|
+
let root = range.commonAncestorContainer;
|
|
18842
|
+
if (Dom.isText(root)) {
|
|
18843
|
+
root = root.parentNode;
|
|
18844
|
+
}
|
|
18845
|
+
if (!root) {
|
|
18846
|
+
return [];
|
|
18847
|
+
}
|
|
18848
|
+
return this.__wrapSelectionRuns(this.__collectContainedNodes(root, range));
|
|
18849
|
+
}
|
|
18850
|
+
/**
|
|
18851
|
+
* Splits the text nodes at both ends of the range so that its boundaries
|
|
18852
|
+
* always fall between nodes. Afterwards every node inside the range is
|
|
18853
|
+
* fully (not partially) selected.
|
|
18854
|
+
*/
|
|
18855
|
+
__splitSelectionBoundaries(range) {
|
|
18856
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h;
|
|
18857
|
+
let { startContainer, endContainer } = range;
|
|
18858
|
+
let { startOffset, endOffset } = range;
|
|
18859
|
+
if (Dom.isText(endContainer) && endOffset > 0 && endOffset < ((_b = (_a2 = endContainer.nodeValue) === null || _a2 === void 0 ? void 0 : _a2.length) !== null && _b !== void 0 ? _b : 0)) {
|
|
18860
|
+
endContainer.splitText(endOffset);
|
|
18861
|
+
endOffset = (_d = (_c = endContainer.nodeValue) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : endOffset;
|
|
18862
|
+
}
|
|
18863
|
+
if (Dom.isText(startContainer) && startOffset > 0 && startOffset < ((_f = (_e2 = startContainer.nodeValue) === null || _e2 === void 0 ? void 0 : _e2.length) !== null && _f !== void 0 ? _f : 0)) {
|
|
18864
|
+
const middle = startContainer.splitText(startOffset);
|
|
18865
|
+
if (startContainer === endContainer) {
|
|
18866
|
+
endContainer = middle;
|
|
18867
|
+
endOffset = (_h = (_g = middle.nodeValue) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0;
|
|
18868
|
+
}
|
|
18869
|
+
startContainer = middle;
|
|
18870
|
+
startOffset = 0;
|
|
18871
|
+
}
|
|
18872
|
+
range.setStart(startContainer, startOffset);
|
|
18873
|
+
range.setEnd(endContainer, endOffset);
|
|
18874
|
+
this.__normalizeRangeBoundary(range, true);
|
|
18875
|
+
this.__normalizeRangeBoundary(range, false);
|
|
18876
|
+
}
|
|
18877
|
+
__normalizeRangeBoundary(range, atStart) {
|
|
18878
|
+
var _a2, _b;
|
|
18879
|
+
const container = atStart ? range.startContainer : range.endContainer;
|
|
18880
|
+
if (!Dom.isText(container)) {
|
|
18881
|
+
return;
|
|
18882
|
+
}
|
|
18883
|
+
const offset2 = atStart ? range.startOffset : range.endOffset;
|
|
18884
|
+
const length = (_b = (_a2 = container.nodeValue) === null || _a2 === void 0 ? void 0 : _a2.length) !== null && _b !== void 0 ? _b : 0;
|
|
18885
|
+
if (offset2 === 0) {
|
|
18886
|
+
atStart ? range.setStartBefore(container) : range.setEndBefore(container);
|
|
18887
|
+
} else if (offset2 >= length) {
|
|
18888
|
+
atStart ? range.setStartAfter(container) : range.setEndAfter(container);
|
|
18889
|
+
}
|
|
18890
|
+
}
|
|
18891
|
+
/**
|
|
18892
|
+
* Collects the highest-level nodes that are completely inside the range,
|
|
18893
|
+
* descending into nodes that are only partially selected.
|
|
18894
|
+
*/
|
|
18895
|
+
__collectContainedNodes(root, range) {
|
|
18896
|
+
const result = [];
|
|
18897
|
+
toArray(root.childNodes).forEach((child) => {
|
|
18898
|
+
if (this.__isFullyContained(range, child)) {
|
|
18899
|
+
result.push(child);
|
|
18900
|
+
} else if (child.childNodes.length && range.intersectsNode(child)) {
|
|
18901
|
+
result.push(...this.__collectContainedNodes(child, range));
|
|
18902
|
+
}
|
|
18903
|
+
});
|
|
18904
|
+
return result;
|
|
18905
|
+
}
|
|
18906
|
+
__isFullyContained(range, node) {
|
|
18907
|
+
const nodeRange = this.createRange();
|
|
18908
|
+
nodeRange.selectNode(node);
|
|
18909
|
+
return range.compareBoundaryPoints(Range.START_TO_START, nodeRange) <= 0 && range.compareBoundaryPoints(Range.END_TO_END, nodeRange) >= 0;
|
|
18910
|
+
}
|
|
18911
|
+
/**
|
|
18912
|
+
* Wraps every contiguous run of selected inline siblings into a `<font>`
|
|
18913
|
+
* element. Block-level nodes are never wrapped themselves - their inline
|
|
18914
|
+
* content is wrapped instead, keeping every `<font>` inside a single block.
|
|
18915
|
+
*/
|
|
18916
|
+
__wrapSelectionRuns(nodes) {
|
|
18917
|
+
const fonts = [];
|
|
18918
|
+
let run = [];
|
|
18919
|
+
const flush = () => {
|
|
18920
|
+
if (run.length) {
|
|
18921
|
+
fonts.push(this.__wrapRunInFont(run));
|
|
18922
|
+
run = [];
|
|
18923
|
+
}
|
|
18924
|
+
};
|
|
18925
|
+
nodes.forEach((node) => {
|
|
18926
|
+
if (Dom.isElement(node) && this.__isOrContainsBlock(node)) {
|
|
18927
|
+
flush();
|
|
18928
|
+
fonts.push(...this.__wrapSelectionRuns(toArray(node.childNodes)));
|
|
18929
|
+
} else {
|
|
18930
|
+
if (run.length && run[run.length - 1].parentNode !== node.parentNode) {
|
|
18931
|
+
flush();
|
|
18932
|
+
}
|
|
18933
|
+
run.push(node);
|
|
18934
|
+
}
|
|
18935
|
+
});
|
|
18936
|
+
flush();
|
|
18937
|
+
return fonts;
|
|
18938
|
+
}
|
|
18939
|
+
__isOrContainsBlock(node) {
|
|
18940
|
+
if (Dom.isBlock(node)) {
|
|
18941
|
+
return true;
|
|
18942
|
+
}
|
|
18943
|
+
return toArray(node.childNodes).some((child) => this.__isOrContainsBlock(child));
|
|
18944
|
+
}
|
|
18945
|
+
__wrapRunInFont(run) {
|
|
18946
|
+
var _a2;
|
|
18947
|
+
const font2 = this.j.createInside.element("font");
|
|
18948
|
+
const [first] = run;
|
|
18949
|
+
(_a2 = first.parentNode) === null || _a2 === void 0 ? void 0 : _a2.insertBefore(font2, first);
|
|
18950
|
+
run.forEach((node) => font2.appendChild(node));
|
|
18951
|
+
return font2;
|
|
18952
|
+
}
|
|
18813
18953
|
/**
|
|
18814
18954
|
* Wrap all selected fragments inside Tag or apply some callback
|
|
18815
18955
|
*/
|
|
@@ -18824,19 +18964,7 @@ var Selection = class {
|
|
|
18824
18964
|
Dom.unwrap(font2);
|
|
18825
18965
|
return;
|
|
18826
18966
|
}
|
|
18827
|
-
|
|
18828
|
-
attr(elm, "data-font-size", elm.style.fontSize.toString());
|
|
18829
|
-
elm.style.removeProperty("font-size");
|
|
18830
|
-
});
|
|
18831
|
-
this.j.nativeExecCommand("fontsize", false, "7");
|
|
18832
|
-
$$("*[data-font-size]", this.area).forEach((elm) => {
|
|
18833
|
-
const fontSize = attr(elm, "data-font-size");
|
|
18834
|
-
if (fontSize) {
|
|
18835
|
-
elm.style.fontSize = fontSize;
|
|
18836
|
-
attr(elm, "data-font-size", null);
|
|
18837
|
-
}
|
|
18838
|
-
});
|
|
18839
|
-
const elms = $$('font[size="7"]', this.area);
|
|
18967
|
+
const elms = this.__wrapSelectionFragments();
|
|
18840
18968
|
for (const font2 of elms) {
|
|
18841
18969
|
const { firstChild, lastChild } = font2;
|
|
18842
18970
|
if (firstChild && firstChild === lastChild && isMarker(firstChild)) {
|
|
@@ -33373,6 +33501,9 @@ var Jodit2 = Jodit_1 = class Jodit3 extends ViewWithToolbar {
|
|
|
33373
33501
|
element.style.display = "none";
|
|
33374
33502
|
}
|
|
33375
33503
|
const SLOT = "workplace-slot";
|
|
33504
|
+
const aboveSlot = this.c.div(this.getFullElName(SLOT, "above"), NOEDIT);
|
|
33505
|
+
aboveSlot.setAttribute("data-jodit-above-toolbar", "");
|
|
33506
|
+
Dom.appendChildFirst(container, aboveSlot);
|
|
33376
33507
|
const topSlot = this.c.div(this.getFullElName(SLOT, "top"), NOEDIT);
|
|
33377
33508
|
container.appendChild(topSlot);
|
|
33378
33509
|
const centerSlot = this.c.div(this.getFullElName(SLOT, "center"), NOEDIT);
|
|
@@ -33405,6 +33536,7 @@ var Jodit2 = Jodit_1 = class Jodit3 extends ViewWithToolbar {
|
|
|
33405
33536
|
container,
|
|
33406
33537
|
workplace,
|
|
33407
33538
|
slots: {
|
|
33539
|
+
above: aboveSlot,
|
|
33408
33540
|
top: topSlot,
|
|
33409
33541
|
bottom: bottomPanel,
|
|
33410
33542
|
center: centerSlot,
|
package/build/esm/index.css
CHANGED
|
@@ -5168,15 +5168,20 @@ svg.jodit-icon {
|
|
|
5168
5168
|
--jd-slot-left-width:auto;
|
|
5169
5169
|
--jd-slot-right-width:auto;
|
|
5170
5170
|
}
|
|
5171
|
+
.jodit .jodit-jodit__workplace-slot_above_true,
|
|
5171
5172
|
.jodit .jodit-jodit__workplace-slot_bottom_true,
|
|
5172
5173
|
.jodit .jodit-jodit__workplace-slot_top_true {
|
|
5173
5174
|
flex: 0 0 auto;
|
|
5174
5175
|
min-width: 0;
|
|
5175
5176
|
}
|
|
5177
|
+
.jodit .jodit-jodit__workplace-slot_above_true:empty,
|
|
5176
5178
|
.jodit .jodit-jodit__workplace-slot_bottom_true:empty,
|
|
5177
5179
|
.jodit .jodit-jodit__workplace-slot_top_true:empty {
|
|
5178
5180
|
display: none;
|
|
5179
5181
|
}
|
|
5182
|
+
.jodit .jodit-jodit__workplace-slot_above_true:not(:empty) {
|
|
5183
|
+
border-bottom: 1px solid var(--jd-color-border,transparent);
|
|
5184
|
+
}
|
|
5180
5185
|
.jodit .jodit-jodit__workplace-slot_top_true {
|
|
5181
5186
|
height: var(--jd-slot-top-height);
|
|
5182
5187
|
}
|