jodit-pro-react 5.5.62 → 5.5.63

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
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JoditEditor_default
3
- } from "./chunk-OEDI6O5S.mjs";
3
+ } from "./chunk-G4TUESYO.mjs";
4
4
  export {
5
5
  JoditEditor_default as default
6
6
  };
@@ -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.44";
196
+ APP_VERSION = "4.13.3";
197
197
  ES = "es2020";
198
198
  IS_ES_MODERN = true;
199
199
  IS_ES_NEXT = true;
@@ -11594,9 +11594,24 @@ var ViewWithToolbar = class extends View {
11594
11594
  if (!this.o.fullsize && (isString(this.o.toolbar) || Dom.isHTMLElement(this.o.toolbar))) {
11595
11595
  return resolveElement(this.o.toolbar, this.o.shadowRoot || this.od);
11596
11596
  }
11597
- this.o.toolbar && Dom.appendChildFirst(this.container, this.__defaultToolbarContainer);
11597
+ this.o.toolbar && this.__appendToolbarBox();
11598
11598
  return this.__defaultToolbarContainer;
11599
11599
  }
11600
+ /**
11601
+ * Keep the toolbar box as the first child of the container, except that
11602
+ * children flagged with `data-jodit-above-toolbar` (e.g. the `above`
11603
+ * workplace slot used for presence bars and banners) stay above it.
11604
+ */
11605
+ __appendToolbarBox() {
11606
+ const box = this.__defaultToolbarContainer;
11607
+ let anchor = this.container.firstElementChild;
11608
+ while (anchor && anchor !== box && anchor.hasAttribute("data-jodit-above-toolbar")) {
11609
+ anchor = anchor.nextElementSibling;
11610
+ }
11611
+ if (anchor !== box) {
11612
+ this.container.insertBefore(box, anchor);
11613
+ }
11614
+ }
11600
11615
  /**
11601
11616
  * Change panel container
11602
11617
  */
@@ -18810,6 +18825,130 @@ var Selection = class {
18810
18825
  }
18811
18826
  return "";
18812
18827
  }
18828
+ /**
18829
+ * Splits the boundaries of the current selection and wraps every
18830
+ * contiguous run of selected inline content (grouped by block) into a
18831
+ * `<font>` element, returning those wrappers in document order.
18832
+ *
18833
+ * This is a pure-DOM replacement for the old
18834
+ * `nativeExecCommand('fontsize', false, '7')` trick which relied on the
18835
+ * browser to split the selection into `<font size="7">` fragments.
18836
+ */
18837
+ __wrapSelectionFragments() {
18838
+ const range = this.range;
18839
+ this.__splitSelectionBoundaries(range);
18840
+ let root = range.commonAncestorContainer;
18841
+ if (Dom.isText(root)) {
18842
+ root = root.parentNode;
18843
+ }
18844
+ if (!root) {
18845
+ return [];
18846
+ }
18847
+ return this.__wrapSelectionRuns(this.__collectContainedNodes(root, range));
18848
+ }
18849
+ /**
18850
+ * Splits the text nodes at both ends of the range so that its boundaries
18851
+ * always fall between nodes. Afterwards every node inside the range is
18852
+ * fully (not partially) selected.
18853
+ */
18854
+ __splitSelectionBoundaries(range) {
18855
+ var _a2, _b, _c, _d, _e2, _f, _g, _h;
18856
+ let { startContainer, endContainer } = range;
18857
+ let { startOffset, endOffset } = range;
18858
+ 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)) {
18859
+ endContainer.splitText(endOffset);
18860
+ endOffset = (_d = (_c = endContainer.nodeValue) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : endOffset;
18861
+ }
18862
+ 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)) {
18863
+ const middle = startContainer.splitText(startOffset);
18864
+ if (startContainer === endContainer) {
18865
+ endContainer = middle;
18866
+ endOffset = (_h = (_g = middle.nodeValue) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0;
18867
+ }
18868
+ startContainer = middle;
18869
+ startOffset = 0;
18870
+ }
18871
+ range.setStart(startContainer, startOffset);
18872
+ range.setEnd(endContainer, endOffset);
18873
+ this.__normalizeRangeBoundary(range, true);
18874
+ this.__normalizeRangeBoundary(range, false);
18875
+ }
18876
+ __normalizeRangeBoundary(range, atStart) {
18877
+ var _a2, _b;
18878
+ const container = atStart ? range.startContainer : range.endContainer;
18879
+ if (!Dom.isText(container)) {
18880
+ return;
18881
+ }
18882
+ const offset2 = atStart ? range.startOffset : range.endOffset;
18883
+ const length = (_b = (_a2 = container.nodeValue) === null || _a2 === void 0 ? void 0 : _a2.length) !== null && _b !== void 0 ? _b : 0;
18884
+ if (offset2 === 0) {
18885
+ atStart ? range.setStartBefore(container) : range.setEndBefore(container);
18886
+ } else if (offset2 >= length) {
18887
+ atStart ? range.setStartAfter(container) : range.setEndAfter(container);
18888
+ }
18889
+ }
18890
+ /**
18891
+ * Collects the highest-level nodes that are completely inside the range,
18892
+ * descending into nodes that are only partially selected.
18893
+ */
18894
+ __collectContainedNodes(root, range) {
18895
+ const result = [];
18896
+ toArray(root.childNodes).forEach((child) => {
18897
+ if (this.__isFullyContained(range, child)) {
18898
+ result.push(child);
18899
+ } else if (child.childNodes.length && range.intersectsNode(child)) {
18900
+ result.push(...this.__collectContainedNodes(child, range));
18901
+ }
18902
+ });
18903
+ return result;
18904
+ }
18905
+ __isFullyContained(range, node) {
18906
+ const nodeRange = this.createRange();
18907
+ nodeRange.selectNode(node);
18908
+ return range.compareBoundaryPoints(Range.START_TO_START, nodeRange) <= 0 && range.compareBoundaryPoints(Range.END_TO_END, nodeRange) >= 0;
18909
+ }
18910
+ /**
18911
+ * Wraps every contiguous run of selected inline siblings into a `<font>`
18912
+ * element. Block-level nodes are never wrapped themselves - their inline
18913
+ * content is wrapped instead, keeping every `<font>` inside a single block.
18914
+ */
18915
+ __wrapSelectionRuns(nodes) {
18916
+ const fonts = [];
18917
+ let run = [];
18918
+ const flush = () => {
18919
+ if (run.length) {
18920
+ fonts.push(this.__wrapRunInFont(run));
18921
+ run = [];
18922
+ }
18923
+ };
18924
+ nodes.forEach((node) => {
18925
+ if (Dom.isElement(node) && this.__isOrContainsBlock(node)) {
18926
+ flush();
18927
+ fonts.push(...this.__wrapSelectionRuns(toArray(node.childNodes)));
18928
+ } else {
18929
+ if (run.length && run[run.length - 1].parentNode !== node.parentNode) {
18930
+ flush();
18931
+ }
18932
+ run.push(node);
18933
+ }
18934
+ });
18935
+ flush();
18936
+ return fonts;
18937
+ }
18938
+ __isOrContainsBlock(node) {
18939
+ if (Dom.isBlock(node)) {
18940
+ return true;
18941
+ }
18942
+ return toArray(node.childNodes).some((child) => this.__isOrContainsBlock(child));
18943
+ }
18944
+ __wrapRunInFont(run) {
18945
+ var _a2;
18946
+ const font2 = this.j.createInside.element("font");
18947
+ const [first] = run;
18948
+ (_a2 = first.parentNode) === null || _a2 === void 0 ? void 0 : _a2.insertBefore(font2, first);
18949
+ run.forEach((node) => font2.appendChild(node));
18950
+ return font2;
18951
+ }
18813
18952
  /**
18814
18953
  * Wrap all selected fragments inside Tag or apply some callback
18815
18954
  */
@@ -18824,19 +18963,7 @@ var Selection = class {
18824
18963
  Dom.unwrap(font2);
18825
18964
  return;
18826
18965
  }
18827
- $$("*[style*=font-size]", this.area).forEach((elm) => {
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);
18966
+ const elms = this.__wrapSelectionFragments();
18840
18967
  for (const font2 of elms) {
18841
18968
  const { firstChild, lastChild } = font2;
18842
18969
  if (firstChild && firstChild === lastChild && isMarker(firstChild)) {
@@ -33373,6 +33500,9 @@ var Jodit2 = Jodit_1 = class Jodit3 extends ViewWithToolbar {
33373
33500
  element.style.display = "none";
33374
33501
  }
33375
33502
  const SLOT = "workplace-slot";
33503
+ const aboveSlot = this.c.div(this.getFullElName(SLOT, "above"), NOEDIT);
33504
+ aboveSlot.setAttribute("data-jodit-above-toolbar", "");
33505
+ Dom.appendChildFirst(container, aboveSlot);
33376
33506
  const topSlot = this.c.div(this.getFullElName(SLOT, "top"), NOEDIT);
33377
33507
  container.appendChild(topSlot);
33378
33508
  const centerSlot = this.c.div(this.getFullElName(SLOT, "center"), NOEDIT);
@@ -33405,6 +33535,7 @@ var Jodit2 = Jodit_1 = class Jodit3 extends ViewWithToolbar {
33405
33535
  container,
33406
33536
  workplace,
33407
33537
  slots: {
33538
+ above: aboveSlot,
33408
33539
  top: topSlot,
33409
33540
  bottom: bottomPanel,
33410
33541
  center: centerSlot,
@@ -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
  }
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  JoditEditor_default,
4
4
  n
5
- } from "./chunk-OEDI6O5S.mjs";
5
+ } from "./chunk-G4TUESYO.mjs";
6
6
 
7
7
  // src/index.ts
8
8
  var index_default = JoditEditor_default;