@ones-editor/editor 2.5.0 → 2.5.1-beta.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/@ones-editor/core/src/core/blocks/common/block-dom.d.ts +2 -3
- package/@ones-editor/core/src/core/blocks/text-blocks/base/block-text.d.ts +1 -1
- package/@ones-editor/core/src/core/input-handler/actions.d.ts +0 -4
- package/@ones-editor/core/src/core/input-handler/handle-delete.d.ts +0 -4
- package/@ones-editor/core/src/core/selection/actions/index.d.ts +1 -3
- package/@ones-editor/core/src/utils/character.d.ts +0 -1
- package/@ones-editor/server-tools/package.json +22 -0
- package/@ones-editor/server-tools/src/fake-browser.d.ts +1 -0
- package/@ones-editor/server-tools/src/from-markdown/index.d.ts +1 -0
- package/@ones-editor/server-tools/src/index.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/code.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/index.d.ts +12 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/list.d.ts +14 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/table.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/blocks/text.d.ts +4 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/br.d.ts +1 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/date.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/file.d.ts +11 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/image.d.ts +5 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/index.d.ts +18 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/known-link.d.ts +11 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/mathjax.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/mention.d.ts +7 -0
- package/@ones-editor/server-tools/src/to-markdown/boxes/task-link.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/convert-block.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/convert-box.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/drawio.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/file-list.d.ts +5 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/file.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/flowchart.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/hr.d.ts +1 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/image.d.ts +18 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/index.d.ts +3 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/mathjax.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/media.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/mermaid.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/plantuml.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/plugin.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/sub-pages.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/task-list.d.ts +7 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/toc.d.ts +2 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/webpage.d.ts +5 -0
- package/@ones-editor/server-tools/src/to-markdown/embeds/xmind.d.ts +8 -0
- package/@ones-editor/server-tools/src/to-markdown/index.d.ts +1 -0
- package/@ones-editor/server-tools/src/to-markdown/types.d.ts +7 -0
- package/@ones-editor/server-tools/src/tools.d.ts +1 -0
- package/@ones-editor/server-tools/src/utils/editor-doc.d.ts +22 -0
- package/@ones-editor/server-tools/src/utils/is-binary.d.ts +14 -0
- package/@ones-editor/server-tools/src/utils/object.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/index.d.ts +2 -2
- package/@ones-editor/ui/src/shortcuts/index.d.ts +2 -3
- package/@ones-editor/ui/src/shortcuts/text-style-shortcuts.d.ts +2 -1
- package/@ones-editor/ui-base/src/color-button/index.d.ts +2 -1
- package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +0 -2
- package/dist/index.js +545 -824
- package/package.json +9 -1
- package/@ones-editor/core/src/core/selection/actions/move-block-end.d.ts +0 -2
- package/@ones-editor/core/src/core/selection/actions/move-block-start.d.ts +0 -2
- package/@ones-editor/ui/src/shortcuts/align-shortcuts.d.ts +0 -2
- package/@ones-editor/ui/src/shortcuts/text-color-shortcuts.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -44,6 +44,7 @@ div.editor-root {
|
|
|
44
44
|
box-sizing: border-box;
|
|
45
45
|
min-height: 100%;
|
|
46
46
|
width: 100%;
|
|
47
|
+
z-index: 1;
|
|
47
48
|
}
|
|
48
49
|
div.editor-root.readonly div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span.text.link {
|
|
49
50
|
cursor: pointer;
|
|
@@ -8900,7 +8901,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8900
8901
|
imageExportFailed: "\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F"
|
|
8901
8902
|
}
|
|
8902
8903
|
};
|
|
8903
|
-
const logger$
|
|
8904
|
+
const logger$4R = getLogger("i18n");
|
|
8904
8905
|
const langs$3 = {
|
|
8905
8906
|
"en-US": enUS$x,
|
|
8906
8907
|
"zh-CN": zhCN$x,
|
|
@@ -8920,7 +8921,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8920
8921
|
function t$8(key, args) {
|
|
8921
8922
|
const ret = i18n.get(key, args);
|
|
8922
8923
|
if (ret === key) {
|
|
8923
|
-
logger$
|
|
8924
|
+
logger$4R.warn(`no locale value for key ${key}`);
|
|
8924
8925
|
}
|
|
8925
8926
|
return ret;
|
|
8926
8927
|
}
|
|
@@ -9533,7 +9534,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9533
9534
|
this._callbacks.clear();
|
|
9534
9535
|
}
|
|
9535
9536
|
}
|
|
9536
|
-
const logger$
|
|
9537
|
+
const logger$4Q = getLogger("await-locker");
|
|
9537
9538
|
class AwaitLock {
|
|
9538
9539
|
constructor() {
|
|
9539
9540
|
__publicField(this, "_acquired", false);
|
|
@@ -9575,7 +9576,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9575
9576
|
}
|
|
9576
9577
|
if (this._waitingResolvers.length > 0) {
|
|
9577
9578
|
const resolve = this._waitingResolvers.shift();
|
|
9578
|
-
assert(logger$
|
|
9579
|
+
assert(logger$4Q, resolve, "Resolver missing");
|
|
9579
9580
|
resolve(void 0);
|
|
9580
9581
|
} else {
|
|
9581
9582
|
this._acquired = false;
|
|
@@ -9658,7 +9659,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9658
9659
|
isMobileSafari: false
|
|
9659
9660
|
};
|
|
9660
9661
|
clientType.isMobileSafari = clientType.isMobile && clientType.isSafari;
|
|
9661
|
-
const logger$
|
|
9662
|
+
const logger$4P = getLogger("dom-utils");
|
|
9662
9663
|
function addClass(dom, ...className) {
|
|
9663
9664
|
if (dom && dom.nodeType === Node.ELEMENT_NODE) {
|
|
9664
9665
|
dom.classList.add(...className);
|
|
@@ -9712,7 +9713,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9712
9713
|
range.setStart(node, offset);
|
|
9713
9714
|
return range;
|
|
9714
9715
|
} catch (err) {
|
|
9715
|
-
assert(logger$
|
|
9716
|
+
assert(logger$4P, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
|
|
9716
9717
|
}
|
|
9717
9718
|
}
|
|
9718
9719
|
function createExpandedRange(startNode, startOffset, endNode, endOffset) {
|
|
@@ -9722,17 +9723,17 @@ var __publicField = (obj, key, value) => {
|
|
|
9722
9723
|
range.setEnd(endNode, endOffset);
|
|
9723
9724
|
return range;
|
|
9724
9725
|
} catch (err) {
|
|
9725
|
-
assert(logger$
|
|
9726
|
+
assert(logger$4P, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
|
|
9726
9727
|
}
|
|
9727
9728
|
}
|
|
9728
9729
|
function getFirstClientRect(elem) {
|
|
9729
9730
|
const rects = elem.getClientRects();
|
|
9730
|
-
assert(logger$
|
|
9731
|
+
assert(logger$4P, rects.length >= 1, "getFirstClientRect: no rects");
|
|
9731
9732
|
return rects[0];
|
|
9732
9733
|
}
|
|
9733
9734
|
function getLastClientRect(elem) {
|
|
9734
9735
|
const rects = elem.getClientRects();
|
|
9735
|
-
assert(logger$
|
|
9736
|
+
assert(logger$4P, rects.length >= 1, "getLastClientRect: no rects");
|
|
9736
9737
|
return rects[rects.length - 1];
|
|
9737
9738
|
}
|
|
9738
9739
|
function getDistanceSquare(rect, x, y) {
|
|
@@ -9779,7 +9780,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9779
9780
|
return 0;
|
|
9780
9781
|
}
|
|
9781
9782
|
if (!elem1.parentElement || !elem2.parentElement) {
|
|
9782
|
-
assert(logger$
|
|
9783
|
+
assert(logger$4P, false, "invalid dom node to compare");
|
|
9783
9784
|
}
|
|
9784
9785
|
if (elem1.parentElement === elem2.parentElement) {
|
|
9785
9786
|
const children = Array.from(elem1.parentElement.children);
|
|
@@ -9796,7 +9797,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9796
9797
|
const parents1 = getParents(elem1);
|
|
9797
9798
|
const parents2 = getParents(elem2);
|
|
9798
9799
|
if (parents1[0] !== parents2[0]) {
|
|
9799
|
-
assert(logger$
|
|
9800
|
+
assert(logger$4P, false, "invalid dom node to compare, different tree");
|
|
9800
9801
|
}
|
|
9801
9802
|
for (let i = 1; ; i++) {
|
|
9802
9803
|
const parent1 = parents1[i];
|
|
@@ -10396,7 +10397,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10396
10397
|
}
|
|
10397
10398
|
}
|
|
10398
10399
|
const MIN_DISTANCE_THRESHOLD$3 = 3;
|
|
10399
|
-
const logger$
|
|
10400
|
+
const logger$4O = getLogger("drag-drop");
|
|
10400
10401
|
class DragDrop {
|
|
10401
10402
|
constructor(options) {
|
|
10402
10403
|
__publicField(this, "dragStarted", false);
|
|
@@ -10417,7 +10418,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10417
10418
|
var _a;
|
|
10418
10419
|
event.preventDefault();
|
|
10419
10420
|
event.stopPropagation();
|
|
10420
|
-
assert(logger$
|
|
10421
|
+
assert(logger$4O, this.mouseDownEvent, "no mouse down event");
|
|
10421
10422
|
const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
|
|
10422
10423
|
const newPos = DragDrop.getEventPosition(event);
|
|
10423
10424
|
const deltaX = newPos.x - oldPos.x;
|
|
@@ -10433,7 +10434,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10433
10434
|
});
|
|
10434
10435
|
__publicField(this, "handleMouseUp", (event) => {
|
|
10435
10436
|
if (event instanceof MouseEvent && event.button === 0 || event instanceof TouchEvent) {
|
|
10436
|
-
assert(logger$
|
|
10437
|
+
assert(logger$4O, this.mouseDownEvent, "no mouse down event");
|
|
10437
10438
|
const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
|
|
10438
10439
|
const newPos = DragDrop.getEventPosition(event);
|
|
10439
10440
|
const deltaX = newPos.x - oldPos.x;
|
|
@@ -10542,7 +10543,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10542
10543
|
const dragDrop = new DragDrop(options);
|
|
10543
10544
|
return dragDrop;
|
|
10544
10545
|
}
|
|
10545
|
-
const logger$
|
|
10546
|
+
const logger$4N = getLogger("character");
|
|
10546
10547
|
function checkChar(charCode, rangeList) {
|
|
10547
10548
|
for (let i = 0; i < rangeList.length; i++) {
|
|
10548
10549
|
const start = rangeList[i][0];
|
|
@@ -10587,13 +10588,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10587
10588
|
];
|
|
10588
10589
|
return checkChar(str.charCodeAt(0), CJKRange);
|
|
10589
10590
|
}
|
|
10590
|
-
function isCJKPunctuation(char) {
|
|
10591
|
-
const reg = /[\u3000-\u303F\uFF00-\uFFEF\u2000-\u206F\u2E00-\u2E7F]/;
|
|
10592
|
-
return reg.test(char);
|
|
10593
|
-
}
|
|
10594
10591
|
function trimChar(s, char) {
|
|
10595
10592
|
let c = char;
|
|
10596
|
-
assert(logger$
|
|
10593
|
+
assert(logger$4N, c.length === 1, "invalid char length");
|
|
10597
10594
|
if (c === "]")
|
|
10598
10595
|
c = "\\]";
|
|
10599
10596
|
if (c === "\\")
|
|
@@ -10910,24 +10907,31 @@ var __publicField = (obj, key, value) => {
|
|
|
10910
10907
|
return elementFont;
|
|
10911
10908
|
}
|
|
10912
10909
|
function getTextWidth(text2, font) {
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
if (!
|
|
10920
|
-
|
|
10921
|
-
} else {
|
|
10922
|
-
context.font = font;
|
|
10910
|
+
try {
|
|
10911
|
+
if (window.fakebrowser) {
|
|
10912
|
+
return 200;
|
|
10913
|
+
}
|
|
10914
|
+
const canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
|
|
10915
|
+
const context = canvas.getContext("2d");
|
|
10916
|
+
if (!context) {
|
|
10917
|
+
return 200;
|
|
10923
10918
|
}
|
|
10924
|
-
|
|
10925
|
-
|
|
10919
|
+
if (typeof font === "string") {
|
|
10920
|
+
if (!font) {
|
|
10921
|
+
context.font = getStyleFont(window.getComputedStyle(document.body));
|
|
10922
|
+
} else {
|
|
10923
|
+
context.font = font;
|
|
10924
|
+
}
|
|
10925
|
+
} else if (font instanceof Element) {
|
|
10926
|
+
context.font = getStyleFont(window.getComputedStyle(font));
|
|
10927
|
+
}
|
|
10928
|
+
const metrics = context.measureText(text2);
|
|
10929
|
+
return metrics.width + 4;
|
|
10930
|
+
} catch (err) {
|
|
10931
|
+
return 200;
|
|
10926
10932
|
}
|
|
10927
|
-
const metrics = context.measureText(text2);
|
|
10928
|
-
return metrics.width + 4;
|
|
10929
10933
|
}
|
|
10930
|
-
const logger$
|
|
10934
|
+
const logger$4M = getLogger("editor-clipboard");
|
|
10931
10935
|
async function setClipboardDataByEvent(items, event) {
|
|
10932
10936
|
if (event.clipboardData) {
|
|
10933
10937
|
const data2 = event.clipboardData;
|
|
@@ -10985,7 +10989,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10985
10989
|
document.body.removeChild(textarea2);
|
|
10986
10990
|
return true;
|
|
10987
10991
|
} catch (ex) {
|
|
10988
|
-
logger$
|
|
10992
|
+
logger$4M.error(ex);
|
|
10989
10993
|
document.body.removeChild(textarea2);
|
|
10990
10994
|
return false;
|
|
10991
10995
|
}
|
|
@@ -11006,7 +11010,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11006
11010
|
document.body.removeChild(div);
|
|
11007
11011
|
return true;
|
|
11008
11012
|
} catch (ex) {
|
|
11009
|
-
logger$
|
|
11013
|
+
logger$4M.error(ex);
|
|
11010
11014
|
document.body.removeChild(div);
|
|
11011
11015
|
return false;
|
|
11012
11016
|
}
|
|
@@ -11033,7 +11037,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11033
11037
|
await navigator.clipboard.write([clipboardItems]);
|
|
11034
11038
|
return true;
|
|
11035
11039
|
} catch (err) {
|
|
11036
|
-
logger$
|
|
11040
|
+
logger$4M.error(err);
|
|
11037
11041
|
return await execCommandCopy(items);
|
|
11038
11042
|
}
|
|
11039
11043
|
}
|
|
@@ -11089,7 +11093,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11089
11093
|
a.click();
|
|
11090
11094
|
a.remove();
|
|
11091
11095
|
}
|
|
11092
|
-
const logger$
|
|
11096
|
+
const logger$4L = getLogger("auto-scroll");
|
|
11093
11097
|
function scrollable(scrollElement, direction) {
|
|
11094
11098
|
if (scrollElement.scrollHeight === scrollElement.clientHeight) {
|
|
11095
11099
|
return false;
|
|
@@ -11113,7 +11117,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11113
11117
|
const isHorizontal = direction === "left" || direction === "right";
|
|
11114
11118
|
const scroll = () => {
|
|
11115
11119
|
if (!scrollable(scrollElement, direction)) {
|
|
11116
|
-
logger$
|
|
11120
|
+
logger$4L.debug("No need for scroll");
|
|
11117
11121
|
return null;
|
|
11118
11122
|
}
|
|
11119
11123
|
if (isHorizontal) {
|
|
@@ -11170,7 +11174,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11170
11174
|
if (this.scrolling) {
|
|
11171
11175
|
return;
|
|
11172
11176
|
}
|
|
11173
|
-
logger$
|
|
11177
|
+
logger$4L.debug(`scroll direction: ${direction}`);
|
|
11174
11178
|
this.cancelScroll = continuousScroll(scrollElement, {
|
|
11175
11179
|
direction,
|
|
11176
11180
|
step
|
|
@@ -11420,7 +11424,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11420
11424
|
const colorIndex = Math.abs(typeof content === "string" && content.trim() ? hashCode(content.trim()) : 0) % ColorNames.length;
|
|
11421
11425
|
return ColorNames[colorIndex];
|
|
11422
11426
|
}
|
|
11423
|
-
const logger$
|
|
11427
|
+
const logger$4K = getLogger("container");
|
|
11424
11428
|
function isContainer(elem) {
|
|
11425
11429
|
return elem.getAttribute("data-type") === "editor-container";
|
|
11426
11430
|
}
|
|
@@ -11432,9 +11436,9 @@ var __publicField = (obj, key, value) => {
|
|
|
11432
11436
|
}
|
|
11433
11437
|
function getContainerId(container) {
|
|
11434
11438
|
const id = container.getAttribute("data-container-id");
|
|
11435
|
-
assert(logger$
|
|
11439
|
+
assert(logger$4K, id, "no id for container");
|
|
11436
11440
|
if (isRootContainer(container)) {
|
|
11437
|
-
assert(logger$
|
|
11441
|
+
assert(logger$4K, id === "root", `invalid root container id, : ${id}`);
|
|
11438
11442
|
}
|
|
11439
11443
|
return id;
|
|
11440
11444
|
}
|
|
@@ -11445,7 +11449,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11445
11449
|
function generateEditorContainerId(containerId) {
|
|
11446
11450
|
return `ones-editor-container-${containerId}`;
|
|
11447
11451
|
}
|
|
11448
|
-
const logger$
|
|
11452
|
+
const logger$4J = getLogger("element");
|
|
11449
11453
|
function createContainerElement(parent, type, containerId) {
|
|
11450
11454
|
const container = createElement("div", [type], parent);
|
|
11451
11455
|
container.setAttribute("data-type", "editor-container");
|
|
@@ -11456,7 +11460,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11456
11460
|
}
|
|
11457
11461
|
function getContainerById(editor, containerId) {
|
|
11458
11462
|
const container = editor.rootElement.querySelector(`[data-container-id=${containerId}]`);
|
|
11459
|
-
assert(logger$
|
|
11463
|
+
assert(logger$4J, container, `no container: ${containerId}`);
|
|
11460
11464
|
return container;
|
|
11461
11465
|
}
|
|
11462
11466
|
function getExistsContainerById(editor, containerId) {
|
|
@@ -11465,7 +11469,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11465
11469
|
}
|
|
11466
11470
|
function getContainerBlocksElement(container) {
|
|
11467
11471
|
const blocks = container.querySelector(":scope > .container-blocks");
|
|
11468
|
-
assert(logger$
|
|
11472
|
+
assert(logger$4J, blocks, "no container blocks element");
|
|
11469
11473
|
return blocks;
|
|
11470
11474
|
}
|
|
11471
11475
|
function getContainerToolsElement(container) {
|
|
@@ -11478,11 +11482,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11478
11482
|
function isContainerBlocksElement(element) {
|
|
11479
11483
|
return element.classList.contains("container-blocks");
|
|
11480
11484
|
}
|
|
11481
|
-
const logger$
|
|
11485
|
+
const logger$4I = getLogger("container-children");
|
|
11482
11486
|
function getChildBlocks(container, traverseChild) {
|
|
11483
11487
|
const content = getContainerBlocksElement(container);
|
|
11484
11488
|
const blocks = Array.from(content.children);
|
|
11485
|
-
assert(logger$
|
|
11489
|
+
assert(logger$4I, blocks.length > 0, "container have not any child block");
|
|
11486
11490
|
if (traverseChild) {
|
|
11487
11491
|
const { condition, editor } = traverseChild;
|
|
11488
11492
|
return blocks.reduce((result, block) => {
|
|
@@ -11505,7 +11509,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11505
11509
|
}
|
|
11506
11510
|
function getFirstChildBlock(container) {
|
|
11507
11511
|
const block = container.querySelector(":scope > .container-blocks > div[data-type=editor-block]");
|
|
11508
|
-
assert(logger$
|
|
11512
|
+
assert(logger$4I, block, "container have not any child block");
|
|
11509
11513
|
return block;
|
|
11510
11514
|
}
|
|
11511
11515
|
function getLastChildBlock(container) {
|
|
@@ -11517,14 +11521,14 @@ var __publicField = (obj, key, value) => {
|
|
|
11517
11521
|
}
|
|
11518
11522
|
function getBlockByIndex(container, blockIndex) {
|
|
11519
11523
|
const block = getChildBlocks(container)[blockIndex];
|
|
11520
|
-
assert(logger$
|
|
11524
|
+
assert(logger$4I, block, `container have not block at index ${blockIndex}`);
|
|
11521
11525
|
return block;
|
|
11522
11526
|
}
|
|
11523
11527
|
function findBlockByIndex(container, blockIndex) {
|
|
11524
11528
|
var _a;
|
|
11525
11529
|
return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
|
|
11526
11530
|
}
|
|
11527
|
-
const logger$
|
|
11531
|
+
const logger$4H = getLogger("block-dom");
|
|
11528
11532
|
function isBlock$1(node) {
|
|
11529
11533
|
if (!(node instanceof HTMLDivElement)) {
|
|
11530
11534
|
return false;
|
|
@@ -11545,12 +11549,12 @@ var __publicField = (obj, key, value) => {
|
|
|
11545
11549
|
}
|
|
11546
11550
|
function getBlockId(block) {
|
|
11547
11551
|
const { id } = block;
|
|
11548
|
-
assert(logger$
|
|
11552
|
+
assert(logger$4H, id, "no block id");
|
|
11549
11553
|
return id;
|
|
11550
11554
|
}
|
|
11551
11555
|
function getBlockType(block) {
|
|
11552
11556
|
const type = block.getAttribute("data-block-type");
|
|
11553
|
-
assert(logger$
|
|
11557
|
+
assert(logger$4H, type, "invalid block dom, no data-type");
|
|
11554
11558
|
return type;
|
|
11555
11559
|
}
|
|
11556
11560
|
function getParentBlock(node) {
|
|
@@ -11573,12 +11577,12 @@ var __publicField = (obj, key, value) => {
|
|
|
11573
11577
|
}
|
|
11574
11578
|
function getParentContainer(block) {
|
|
11575
11579
|
const container = block.closest("div[data-type=editor-container]");
|
|
11576
|
-
assert(logger$
|
|
11580
|
+
assert(logger$4H, container, "failed to get block container");
|
|
11577
11581
|
return container;
|
|
11578
11582
|
}
|
|
11579
11583
|
function getBlockContent(block) {
|
|
11580
11584
|
const content = block.querySelector(":scope >div[data-type=block-content]");
|
|
11581
|
-
assert(logger$
|
|
11585
|
+
assert(logger$4H, content, "no block content");
|
|
11582
11586
|
return content;
|
|
11583
11587
|
}
|
|
11584
11588
|
function getBlockTools(block) {
|
|
@@ -11587,7 +11591,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11587
11591
|
tools = createElement("div", [], block);
|
|
11588
11592
|
tools.setAttribute("data-type", "block-tools");
|
|
11589
11593
|
}
|
|
11590
|
-
assert(logger$
|
|
11594
|
+
assert(logger$4H, tools, "no block tools");
|
|
11591
11595
|
return tools;
|
|
11592
11596
|
}
|
|
11593
11597
|
function getExistsBlockTools(block) {
|
|
@@ -11608,7 +11612,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11608
11612
|
function createBlockElement(editor, path, data2) {
|
|
11609
11613
|
const blockData = editor.editorDecorators.decorateBlock(path, data2);
|
|
11610
11614
|
const { id, type } = blockData;
|
|
11611
|
-
assert(logger$
|
|
11615
|
+
assert(logger$4H, id, "no block id");
|
|
11612
11616
|
const elem = createElement("div", [`${type}-block`], null);
|
|
11613
11617
|
elem.id = id;
|
|
11614
11618
|
elem.setAttribute("data-type", "editor-block");
|
|
@@ -11646,7 +11650,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11646
11650
|
}
|
|
11647
11651
|
function getBoxTypeFromElement(box) {
|
|
11648
11652
|
const type = box.getAttribute("data-box-type");
|
|
11649
|
-
assert(logger$
|
|
11653
|
+
assert(logger$4H, type, "not a valid box element, no type");
|
|
11650
11654
|
return type;
|
|
11651
11655
|
}
|
|
11652
11656
|
function isBox(node) {
|
|
@@ -11657,7 +11661,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11657
11661
|
}
|
|
11658
11662
|
function getBoxId(box) {
|
|
11659
11663
|
const { id } = box;
|
|
11660
|
-
assert(logger$
|
|
11664
|
+
assert(logger$4H, id, "no box id");
|
|
11661
11665
|
return id;
|
|
11662
11666
|
}
|
|
11663
11667
|
function getParentBox(node) {
|
|
@@ -11679,7 +11683,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11679
11683
|
}
|
|
11680
11684
|
function getBoxContent(box) {
|
|
11681
11685
|
const content = box.querySelector("span[data-type=box-content]");
|
|
11682
|
-
assert(logger$
|
|
11686
|
+
assert(logger$4H, content, "invalid box dom, no content");
|
|
11683
11687
|
return content;
|
|
11684
11688
|
}
|
|
11685
11689
|
function createInsertionElement(type, id, attributes) {
|
|
@@ -11701,7 +11705,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11701
11705
|
}
|
|
11702
11706
|
function getInsertionContent(insertion) {
|
|
11703
11707
|
const content = insertion.querySelector("span[data-type=insertion-content]");
|
|
11704
|
-
assert(logger$
|
|
11708
|
+
assert(logger$4H, content, "invalid insertion-child dom, no content");
|
|
11705
11709
|
return content;
|
|
11706
11710
|
}
|
|
11707
11711
|
function getPrevBlock(block) {
|
|
@@ -11724,44 +11728,31 @@ var __publicField = (obj, key, value) => {
|
|
|
11724
11728
|
}
|
|
11725
11729
|
return null;
|
|
11726
11730
|
}
|
|
11727
|
-
function getPrevVisibleBlock(block
|
|
11728
|
-
const mergedMatcher = matcher || (() => true);
|
|
11731
|
+
function getPrevVisibleBlock(block) {
|
|
11729
11732
|
let prev = block.previousElementSibling;
|
|
11730
11733
|
while (prev) {
|
|
11731
|
-
if (isBlock$1(prev) && isVisibleBlock(prev)
|
|
11734
|
+
if (isBlock$1(prev) && isVisibleBlock(prev)) {
|
|
11732
11735
|
return prev;
|
|
11733
11736
|
}
|
|
11734
11737
|
prev = prev.previousElementSibling;
|
|
11735
11738
|
}
|
|
11736
11739
|
return null;
|
|
11737
11740
|
}
|
|
11738
|
-
function getNextVisibleBlock(block
|
|
11739
|
-
const mergedMatcher = matcher || (() => true);
|
|
11741
|
+
function getNextVisibleBlock(block) {
|
|
11740
11742
|
let next2 = block.nextElementSibling;
|
|
11741
11743
|
while (next2) {
|
|
11742
|
-
if (isBlock$1(next2) && isVisibleBlock(next2)
|
|
11744
|
+
if (isBlock$1(next2) && isVisibleBlock(next2)) {
|
|
11743
11745
|
return next2;
|
|
11744
11746
|
}
|
|
11745
11747
|
next2 = next2.nextElementSibling;
|
|
11746
11748
|
}
|
|
11747
11749
|
return null;
|
|
11748
11750
|
}
|
|
11749
|
-
function getBlocksBetween(start, end, matcher) {
|
|
11750
|
-
const blocks = [];
|
|
11751
|
-
let cur = start;
|
|
11752
|
-
while (cur !== end) {
|
|
11753
|
-
if (isBlock$1(cur) && matcher(cur)) {
|
|
11754
|
-
blocks.push(cur);
|
|
11755
|
-
}
|
|
11756
|
-
cur = cur.nextElementSibling;
|
|
11757
|
-
}
|
|
11758
|
-
return blocks;
|
|
11759
|
-
}
|
|
11760
11751
|
function getBlockIndex(block) {
|
|
11761
11752
|
const container = getParentContainer(block);
|
|
11762
11753
|
const children = getChildBlocks(container);
|
|
11763
11754
|
const index2 = children.indexOf(block);
|
|
11764
|
-
assert(logger$
|
|
11755
|
+
assert(logger$4H, index2 !== -1, "invalid block & container dom, failed to get block index");
|
|
11765
11756
|
return index2;
|
|
11766
11757
|
}
|
|
11767
11758
|
function isInBlock(target) {
|
|
@@ -11786,18 +11777,18 @@ var __publicField = (obj, key, value) => {
|
|
|
11786
11777
|
function isTitleBlock$2(block) {
|
|
11787
11778
|
return block.hasAttribute("data-document-title");
|
|
11788
11779
|
}
|
|
11789
|
-
const logger$
|
|
11780
|
+
const logger$4G = getLogger("block-class");
|
|
11790
11781
|
function getBlockClass(editor, block) {
|
|
11791
11782
|
return editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
11792
11783
|
}
|
|
11793
11784
|
function getTextBlockClass(editor, block) {
|
|
11794
11785
|
const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
11795
|
-
assert(logger$
|
|
11786
|
+
assert(logger$4G, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
|
|
11796
11787
|
return text2;
|
|
11797
11788
|
}
|
|
11798
11789
|
function getComplexBlockClass(editor, block) {
|
|
11799
11790
|
const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
11800
|
-
assert(logger$
|
|
11791
|
+
assert(logger$4G, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
|
|
11801
11792
|
return complex;
|
|
11802
11793
|
}
|
|
11803
11794
|
function getBlockClassByType(editor, type) {
|
|
@@ -11818,7 +11809,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11818
11809
|
function getBlockKind(editor, block) {
|
|
11819
11810
|
return getBlockClass(editor, block).blockKind;
|
|
11820
11811
|
}
|
|
11821
|
-
const logger$
|
|
11812
|
+
const logger$4F = getLogger("text-block-child");
|
|
11822
11813
|
function isTextBlockContentChild(elem) {
|
|
11823
11814
|
if (elem.tagName !== "SPAN") {
|
|
11824
11815
|
return false;
|
|
@@ -11826,14 +11817,14 @@ var __publicField = (obj, key, value) => {
|
|
|
11826
11817
|
return true;
|
|
11827
11818
|
}
|
|
11828
11819
|
function isTextBlockContentBoxChild(elem) {
|
|
11829
|
-
assert(logger$
|
|
11820
|
+
assert(logger$4F, isTextBlockContentChild(elem), "not a valid text child");
|
|
11830
11821
|
if (elem.getAttribute("data-type") === "editor-box") {
|
|
11831
11822
|
return true;
|
|
11832
11823
|
}
|
|
11833
11824
|
return false;
|
|
11834
11825
|
}
|
|
11835
11826
|
function isTextBlockContentInsertionChild(elem) {
|
|
11836
|
-
assert(logger$
|
|
11827
|
+
assert(logger$4F, isTextBlockContentChild(elem), "not a valid text child");
|
|
11837
11828
|
if (elem.getAttribute("data-type") === "editor-insertion") {
|
|
11838
11829
|
return true;
|
|
11839
11830
|
}
|
|
@@ -11843,7 +11834,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11843
11834
|
return !isTextBlockContentBoxChild(elem) && !isTextBlockContentInsertionChild(elem);
|
|
11844
11835
|
}
|
|
11845
11836
|
function getTextBlockContentChildType(child) {
|
|
11846
|
-
assert(logger$
|
|
11837
|
+
assert(logger$4F, isTextBlockContentChild(child), "not a valid text child");
|
|
11847
11838
|
if (isTextBlockContentBoxChild(child)) {
|
|
11848
11839
|
return "box";
|
|
11849
11840
|
}
|
|
@@ -11858,15 +11849,15 @@ var __publicField = (obj, key, value) => {
|
|
|
11858
11849
|
return 0;
|
|
11859
11850
|
if (type === "box")
|
|
11860
11851
|
return 1;
|
|
11861
|
-
assert(logger$
|
|
11862
|
-
assert(logger$
|
|
11852
|
+
assert(logger$4F, child.textContent !== null, "text block content is undefined");
|
|
11853
|
+
assert(logger$4F, child.textContent.length >= 0, "text block content length is negative");
|
|
11863
11854
|
return child.textContent.length;
|
|
11864
11855
|
}
|
|
11865
11856
|
function getTextBlockContentChildren(block) {
|
|
11866
11857
|
const content = getBlockContent(block);
|
|
11867
11858
|
const children = Array.from(content.children);
|
|
11868
11859
|
children.forEach((child) => {
|
|
11869
|
-
assert(logger$
|
|
11860
|
+
assert(logger$4F, isTextBlockContentChild(child), "not a valid text child");
|
|
11870
11861
|
});
|
|
11871
11862
|
return children;
|
|
11872
11863
|
}
|
|
@@ -11895,17 +11886,17 @@ var __publicField = (obj, key, value) => {
|
|
|
11895
11886
|
};
|
|
11896
11887
|
}
|
|
11897
11888
|
const offset = blockOffset - start;
|
|
11898
|
-
assert(logger$
|
|
11899
|
-
assert(logger$
|
|
11889
|
+
assert(logger$4F, offset > 0, "invalid offset value");
|
|
11890
|
+
assert(logger$4F, !isTextBlockContentBoxChild(child), "invalid box child");
|
|
11900
11891
|
return {
|
|
11901
11892
|
prev: child,
|
|
11902
11893
|
next: child,
|
|
11903
11894
|
offset
|
|
11904
11895
|
};
|
|
11905
11896
|
}
|
|
11906
|
-
assert(logger$
|
|
11897
|
+
assert(logger$4F, false, `invalid block child at position: ${blockOffset}`);
|
|
11907
11898
|
}
|
|
11908
|
-
const logger$
|
|
11899
|
+
const logger$4E = getLogger("block-path");
|
|
11909
11900
|
function getBlockPath(block) {
|
|
11910
11901
|
const ret = [];
|
|
11911
11902
|
let current = block;
|
|
@@ -11919,26 +11910,26 @@ var __publicField = (obj, key, value) => {
|
|
|
11919
11910
|
return ret;
|
|
11920
11911
|
}
|
|
11921
11912
|
const parentBlock = getParentBlock(container);
|
|
11922
|
-
assert(logger$
|
|
11913
|
+
assert(logger$4E, parentBlock, "no parent block");
|
|
11923
11914
|
current = parentBlock;
|
|
11924
11915
|
}
|
|
11925
|
-
assert(logger$
|
|
11916
|
+
assert(logger$4E, false, "no parent block");
|
|
11926
11917
|
return [];
|
|
11927
11918
|
}
|
|
11928
|
-
const logger$
|
|
11919
|
+
const logger$4D = getLogger("child-container-path");
|
|
11929
11920
|
function getContainerBlockPath(container) {
|
|
11930
11921
|
if (isRootContainer(container)) {
|
|
11931
11922
|
return [];
|
|
11932
11923
|
}
|
|
11933
11924
|
const parentBlock = getParentBlock(container);
|
|
11934
|
-
assert(logger$
|
|
11925
|
+
assert(logger$4D, parentBlock, "no parent block");
|
|
11935
11926
|
return getBlockPath(parentBlock);
|
|
11936
11927
|
}
|
|
11937
|
-
const logger$
|
|
11928
|
+
const logger$4C = getLogger("load-blocks");
|
|
11938
11929
|
function loadBlocks(editor, container, path) {
|
|
11939
11930
|
const containerId = getContainerId(container);
|
|
11940
11931
|
const blocks = getContainerBlocks$1(container, editor.doc);
|
|
11941
|
-
assert(logger$
|
|
11932
|
+
assert(logger$4C, blocks.length > 0, "no blocks in container");
|
|
11942
11933
|
const fragment = document.createDocumentFragment();
|
|
11943
11934
|
blocks.forEach((b, index2) => {
|
|
11944
11935
|
const block = editor.editorBlocks.createBlock([...path, { containerId, blockIndex: index2 }], container, b);
|
|
@@ -11954,7 +11945,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11954
11945
|
return block;
|
|
11955
11946
|
}
|
|
11956
11947
|
const blocks = getChildBlocks(container);
|
|
11957
|
-
assert(logger$
|
|
11948
|
+
assert(logger$4C, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
|
|
11958
11949
|
if (blockIndex === blocks.length) {
|
|
11959
11950
|
containerBlocksElement.appendChild(block);
|
|
11960
11951
|
} else {
|
|
@@ -11972,7 +11963,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11972
11963
|
insertBlockAt(container, blockIndex, block);
|
|
11973
11964
|
return block;
|
|
11974
11965
|
}
|
|
11975
|
-
const logger$
|
|
11966
|
+
const logger$4B = getLogger("root-container");
|
|
11976
11967
|
const MIN_DISTANCE_THRESHOLD$2 = 3;
|
|
11977
11968
|
class RootContainer {
|
|
11978
11969
|
constructor(editor, rootContainer) {
|
|
@@ -12000,7 +11991,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12000
11991
|
this.editor.selection.updateSelection(null);
|
|
12001
11992
|
this.editor.emit("resize", this.editor);
|
|
12002
11993
|
} catch (err) {
|
|
12003
|
-
logger$
|
|
11994
|
+
logger$4B.warn(`failed to update selection while container resizing: ${err.message}`);
|
|
12004
11995
|
}
|
|
12005
11996
|
});
|
|
12006
11997
|
__publicField(this, "handleClick", (event) => {
|
|
@@ -12033,7 +12024,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12033
12024
|
const box = getParentBox(elem);
|
|
12034
12025
|
if (box) {
|
|
12035
12026
|
const block2 = getParentBlock(box);
|
|
12036
|
-
assert(logger$
|
|
12027
|
+
assert(logger$4B, block2, "no parent block");
|
|
12037
12028
|
(_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
|
|
12038
12029
|
return;
|
|
12039
12030
|
}
|
|
@@ -12088,7 +12079,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12088
12079
|
this.editor.input.focus({ preventScroll: true });
|
|
12089
12080
|
});
|
|
12090
12081
|
__publicField(this, "handleMouseMove", (event) => {
|
|
12091
|
-
assert(logger$
|
|
12082
|
+
assert(logger$4B, this.mouseDownEvent, "no mouse down event");
|
|
12092
12083
|
if (ensureIsMobileEvent(this.mouseDownEvent))
|
|
12093
12084
|
return;
|
|
12094
12085
|
const deltaX = event.x - this.mouseDownEvent.x;
|
|
@@ -12204,7 +12195,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12204
12195
|
loadBlocks(editor, container, path);
|
|
12205
12196
|
return container;
|
|
12206
12197
|
}
|
|
12207
|
-
const logger$
|
|
12198
|
+
const logger$4A = getLogger("block");
|
|
12208
12199
|
function getBlockTextLength$6(editor, block) {
|
|
12209
12200
|
return getBlockClass(editor, block).getBlockTextLength(block);
|
|
12210
12201
|
}
|
|
@@ -12223,7 +12214,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12223
12214
|
return block;
|
|
12224
12215
|
}
|
|
12225
12216
|
const parent = getParentBlock(container);
|
|
12226
|
-
assert(logger$
|
|
12217
|
+
assert(logger$4A, parent, "no parent block exists for child container");
|
|
12227
12218
|
block = parent;
|
|
12228
12219
|
}
|
|
12229
12220
|
}
|
|
@@ -12259,7 +12250,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12259
12250
|
}
|
|
12260
12251
|
return fun(editor, block, options);
|
|
12261
12252
|
} catch (err) {
|
|
12262
|
-
logger$
|
|
12253
|
+
logger$4A.debug(`unsupported block type: ${type}`);
|
|
12263
12254
|
return null;
|
|
12264
12255
|
}
|
|
12265
12256
|
}
|
|
@@ -12279,7 +12270,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12279
12270
|
const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
|
|
12280
12271
|
Object.entries(styles).forEach(([, value]) => {
|
|
12281
12272
|
const type = typeof value;
|
|
12282
|
-
assert(logger$
|
|
12273
|
+
assert(logger$4A, type === "string" || type === "number" || type === "boolean", "invalid style value");
|
|
12283
12274
|
});
|
|
12284
12275
|
return styles;
|
|
12285
12276
|
}
|
|
@@ -12404,7 +12395,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12404
12395
|
}
|
|
12405
12396
|
return { element: null, blockCommands: [], boxCommands: [] };
|
|
12406
12397
|
}
|
|
12407
|
-
const logger$
|
|
12398
|
+
const logger$4z = getLogger("embed-block-common");
|
|
12408
12399
|
function isColumnsBlock(block) {
|
|
12409
12400
|
return getBlockType(block) === "layout";
|
|
12410
12401
|
}
|
|
@@ -12412,9 +12403,9 @@ var __publicField = (obj, key, value) => {
|
|
|
12412
12403
|
return getBlockType(block) === "embed";
|
|
12413
12404
|
}
|
|
12414
12405
|
function getEmbedType(block) {
|
|
12415
|
-
assert(logger$
|
|
12406
|
+
assert(logger$4z, isEmbedBlock(block), "not an embed block");
|
|
12416
12407
|
const type = block.getAttribute("data-embed-type");
|
|
12417
|
-
assert(logger$
|
|
12408
|
+
assert(logger$4z, type, "no embed data type");
|
|
12418
12409
|
return type;
|
|
12419
12410
|
}
|
|
12420
12411
|
function getEmbedClassFromBlock(editor, block) {
|
|
@@ -12480,10 +12471,10 @@ var __publicField = (obj, key, value) => {
|
|
|
12480
12471
|
data: (_c = overrideOptions == null ? void 0 : overrideOptions.data) != null ? _c : data2
|
|
12481
12472
|
});
|
|
12482
12473
|
}
|
|
12483
|
-
const logger$
|
|
12474
|
+
const logger$4y = getLogger("execute-block-command");
|
|
12484
12475
|
function executeEmbedBlockCommand(editor, block, commandGroup, item) {
|
|
12485
12476
|
var _a;
|
|
12486
|
-
assert(logger$
|
|
12477
|
+
assert(logger$4y, isEmbedBlock(block), "not a embed block");
|
|
12487
12478
|
const embedType = getEmbedType(block);
|
|
12488
12479
|
const embed = getEmbedClassByType(editor, embedType);
|
|
12489
12480
|
if (!embed.getOptions) {
|
|
@@ -12516,14 +12507,14 @@ var __publicField = (obj, key, value) => {
|
|
|
12516
12507
|
}
|
|
12517
12508
|
return void 0;
|
|
12518
12509
|
}
|
|
12519
|
-
const logger$
|
|
12510
|
+
const logger$4x = getLogger("block-class");
|
|
12520
12511
|
function isHeadingBlock$1(block) {
|
|
12521
12512
|
return !!block.getAttribute("data-style-heading");
|
|
12522
12513
|
}
|
|
12523
12514
|
function getBlockHeading(block) {
|
|
12524
12515
|
var _a;
|
|
12525
12516
|
const heading = Number.parseInt((_a = block.getAttribute("data-style-heading")) != null ? _a : "", 10);
|
|
12526
|
-
assert(logger$
|
|
12517
|
+
assert(logger$4x, heading, "not a heading block");
|
|
12527
12518
|
return heading;
|
|
12528
12519
|
}
|
|
12529
12520
|
function isExpandedHeadingBlock(block) {
|
|
@@ -12534,7 +12525,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12534
12525
|
}
|
|
12535
12526
|
function getHeadingBlockChildren(block, oldHeading) {
|
|
12536
12527
|
if (!oldHeading) {
|
|
12537
|
-
assert(logger$
|
|
12528
|
+
assert(logger$4x, isHeadingBlock$1(block), "not a heading block");
|
|
12538
12529
|
}
|
|
12539
12530
|
const children = [];
|
|
12540
12531
|
const heading = oldHeading != null ? oldHeading : getBlockHeading(block);
|
|
@@ -12564,7 +12555,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12564
12555
|
}
|
|
12565
12556
|
return children;
|
|
12566
12557
|
}
|
|
12567
|
-
const logger$
|
|
12558
|
+
const logger$4w = getLogger("complex-block-position");
|
|
12568
12559
|
class EditorComplexBlockPosition {
|
|
12569
12560
|
constructor(block, childContainerId, custom) {
|
|
12570
12561
|
__publicField(this, "blockId");
|
|
@@ -12573,7 +12564,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12573
12564
|
if (block instanceof HTMLElement) {
|
|
12574
12565
|
this.blockId = getBlockId(block);
|
|
12575
12566
|
} else {
|
|
12576
|
-
assert(logger$
|
|
12567
|
+
assert(logger$4w, typeof block === "string", `not a valid block id: ${block}`);
|
|
12577
12568
|
this.blockId = block;
|
|
12578
12569
|
}
|
|
12579
12570
|
this.childContainerId = childContainerId;
|
|
@@ -12585,7 +12576,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12585
12576
|
return false;
|
|
12586
12577
|
}
|
|
12587
12578
|
}
|
|
12588
|
-
const logger$
|
|
12579
|
+
const logger$4v = getLogger("simple-block-position");
|
|
12589
12580
|
class EditorSimpleBlockPosition {
|
|
12590
12581
|
constructor(block, offset, type) {
|
|
12591
12582
|
__publicField(this, "blockId");
|
|
@@ -12594,7 +12585,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12594
12585
|
if (block instanceof HTMLElement) {
|
|
12595
12586
|
this.blockId = getBlockId(block);
|
|
12596
12587
|
} else {
|
|
12597
|
-
assert(logger$
|
|
12588
|
+
assert(logger$4v, typeof block === "string", `not a valid block id: ${block}`);
|
|
12598
12589
|
this.blockId = block;
|
|
12599
12590
|
}
|
|
12600
12591
|
this.offset = offset;
|
|
@@ -12604,7 +12595,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12604
12595
|
return true;
|
|
12605
12596
|
}
|
|
12606
12597
|
}
|
|
12607
|
-
const logger$
|
|
12598
|
+
const logger$4u = getLogger("editor-position");
|
|
12608
12599
|
function createSimpleBlockPosition(block, offset, type) {
|
|
12609
12600
|
return new EditorSimpleBlockPosition(block, offset, type);
|
|
12610
12601
|
}
|
|
@@ -12626,7 +12617,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12626
12617
|
}
|
|
12627
12618
|
const block1 = editor.getBlockById(pos1.blockId);
|
|
12628
12619
|
const block2 = editor.getBlockById(pos2.blockId);
|
|
12629
|
-
assert(logger$
|
|
12620
|
+
assert(logger$4u, block1 !== block2, "comparePosition: blocks are the same");
|
|
12630
12621
|
return compareElement(block1, block2);
|
|
12631
12622
|
}
|
|
12632
12623
|
if (isComplexBlockPosition(pos1) && isComplexBlockPosition(pos2)) {
|
|
@@ -12637,13 +12628,13 @@ var __publicField = (obj, key, value) => {
|
|
|
12637
12628
|
}
|
|
12638
12629
|
const container1 = editor.getContainerById(p1.childContainerId);
|
|
12639
12630
|
const container2 = editor.getContainerById(p2.childContainerId);
|
|
12640
|
-
assert(logger$
|
|
12631
|
+
assert(logger$4u, container1 !== container2, "comparePosition: containers are the same");
|
|
12641
12632
|
return compareElement(container1, container2);
|
|
12642
12633
|
}
|
|
12643
|
-
assert(logger$
|
|
12634
|
+
assert(logger$4u, false, "invalid ");
|
|
12644
12635
|
return 0;
|
|
12645
12636
|
}
|
|
12646
|
-
const logger$
|
|
12637
|
+
const logger$4t = getLogger("simple-range");
|
|
12647
12638
|
class EditorSimpleSelectionRange {
|
|
12648
12639
|
constructor(editor, options) {
|
|
12649
12640
|
__publicField(this, "editor");
|
|
@@ -12692,11 +12683,11 @@ var __publicField = (obj, key, value) => {
|
|
|
12692
12683
|
const { editor } = this;
|
|
12693
12684
|
const startBlock = editor.getBlockById(this.start.blockId);
|
|
12694
12685
|
const endBlock = editor.getBlockById(this.end.blockId);
|
|
12695
|
-
assert(logger$
|
|
12696
|
-
assert(logger$
|
|
12686
|
+
assert(logger$4t, startBlock, "no start block");
|
|
12687
|
+
assert(logger$4t, endBlock, "no end block");
|
|
12697
12688
|
const startContainer = getParentContainer(startBlock);
|
|
12698
12689
|
const endContainer = getParentContainer(endBlock);
|
|
12699
|
-
assert(logger$
|
|
12690
|
+
assert(logger$4t, startContainer === endContainer, "invalid range");
|
|
12700
12691
|
const ret = [];
|
|
12701
12692
|
if (startBlock === endBlock) {
|
|
12702
12693
|
ret.push({
|
|
@@ -12707,7 +12698,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12707
12698
|
} else {
|
|
12708
12699
|
const startIndex = getBlockIndex(startBlock);
|
|
12709
12700
|
const endIndex = getBlockIndex(endBlock);
|
|
12710
|
-
assert(logger$
|
|
12701
|
+
assert(logger$4t, startIndex < endIndex, "invalid range, start > index");
|
|
12711
12702
|
ret.push({
|
|
12712
12703
|
block: startBlock,
|
|
12713
12704
|
start: this.start,
|
|
@@ -12807,7 +12798,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12807
12798
|
clearSelection: clearSelection$6,
|
|
12808
12799
|
convertTo: convertTo$m
|
|
12809
12800
|
};
|
|
12810
|
-
const logger$
|
|
12801
|
+
const logger$4s = getLogger("editor-blocks");
|
|
12811
12802
|
class EditorBlocks {
|
|
12812
12803
|
constructor(editor) {
|
|
12813
12804
|
__publicField(this, "blocks", /* @__PURE__ */ new Map());
|
|
@@ -12816,12 +12807,12 @@ var __publicField = (obj, key, value) => {
|
|
|
12816
12807
|
registerBlockClass(blockClass) {
|
|
12817
12808
|
const type = blockClass.blockType;
|
|
12818
12809
|
const exists = this.blocks.get(type);
|
|
12819
|
-
assert(logger$
|
|
12810
|
+
assert(logger$4s, !exists, `duplicated block type: ${type}`);
|
|
12820
12811
|
this.blocks.set(type, blockClass);
|
|
12821
12812
|
}
|
|
12822
12813
|
getBlockClass(type) {
|
|
12823
12814
|
const exists = this.blocks.get(type);
|
|
12824
|
-
assert(logger$
|
|
12815
|
+
assert(logger$4s, exists, `unknown block type: ${type}`);
|
|
12825
12816
|
return exists;
|
|
12826
12817
|
}
|
|
12827
12818
|
hasBlock(type) {
|
|
@@ -12837,7 +12828,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12837
12828
|
}
|
|
12838
12829
|
const content = blockClass.createBlockContent(this.editor, path, container, blockElement, block);
|
|
12839
12830
|
if (content.parentElement !== blockElement) {
|
|
12840
|
-
logger$
|
|
12831
|
+
logger$4s.warn("content parent is not block");
|
|
12841
12832
|
blockElement.appendChild(content);
|
|
12842
12833
|
}
|
|
12843
12834
|
this.editor.blockHooks.forEach((hook) => {
|
|
@@ -12858,7 +12849,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12858
12849
|
return newBlock;
|
|
12859
12850
|
}
|
|
12860
12851
|
}
|
|
12861
|
-
const logger$
|
|
12852
|
+
const logger$4r = getLogger("editor-embeds");
|
|
12862
12853
|
class EditorEmbeds {
|
|
12863
12854
|
constructor(editor) {
|
|
12864
12855
|
__publicField(this, "objects", /* @__PURE__ */ new Map());
|
|
@@ -12867,12 +12858,12 @@ var __publicField = (obj, key, value) => {
|
|
|
12867
12858
|
registerEmbedClass(embedClass) {
|
|
12868
12859
|
const type = embedClass.embedType;
|
|
12869
12860
|
const exists = this.objects.get(type);
|
|
12870
|
-
assert(logger$
|
|
12861
|
+
assert(logger$4r, !exists, `duplicated embed object type: ${type}`);
|
|
12871
12862
|
this.objects.set(type, embedClass);
|
|
12872
12863
|
}
|
|
12873
12864
|
getEmbedClass(type) {
|
|
12874
12865
|
const exists = this.objects.get(type);
|
|
12875
|
-
assert(logger$
|
|
12866
|
+
assert(logger$4r, exists, `unknown embed type: ${type}`);
|
|
12876
12867
|
return exists;
|
|
12877
12868
|
}
|
|
12878
12869
|
getEmbedClassFromBlock(block) {
|
|
@@ -12882,12 +12873,12 @@ var __publicField = (obj, key, value) => {
|
|
|
12882
12873
|
this.objects.forEach(callback);
|
|
12883
12874
|
}
|
|
12884
12875
|
}
|
|
12885
|
-
const logger$
|
|
12876
|
+
const logger$4q = getLogger("embed-block");
|
|
12886
12877
|
function createBlockContent$6(editor, path, container, blockElement, blockData) {
|
|
12887
12878
|
const content = createBlockContentElement(blockElement, "div");
|
|
12888
|
-
assert(logger$
|
|
12879
|
+
assert(logger$4q, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
|
|
12889
12880
|
const embedBlockData = blockData;
|
|
12890
|
-
assert(logger$
|
|
12881
|
+
assert(logger$4q, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
|
|
12891
12882
|
const embedClass = editor.editorEmbeds.getEmbedClass(embedBlockData.embedType);
|
|
12892
12883
|
embedClass.createEmbedContent(editor, content, embedBlockData, path, container, blockElement);
|
|
12893
12884
|
blockElement.setAttribute("data-embed-type", embedBlockData.embedType);
|
|
@@ -12915,7 +12906,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12915
12906
|
function getCaretRect$4(block, pos) {
|
|
12916
12907
|
const content = getBlockContent(block);
|
|
12917
12908
|
const rect = content.getBoundingClientRect();
|
|
12918
|
-
assert(logger$
|
|
12909
|
+
assert(logger$4q, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
|
|
12919
12910
|
if (pos.offset === 1) {
|
|
12920
12911
|
return new DOMRect(rect.right, rect.top, 0, rect.height);
|
|
12921
12912
|
}
|
|
@@ -13055,18 +13046,18 @@ var __publicField = (obj, key, value) => {
|
|
|
13055
13046
|
toStandardDoc: toStandardDoc$2,
|
|
13056
13047
|
getResources: getResources$2
|
|
13057
13048
|
};
|
|
13058
|
-
const logger$
|
|
13049
|
+
const logger$4p = getLogger("complex-block-helper");
|
|
13059
13050
|
function complexBlockGetAllChildContainers(editor, block, options) {
|
|
13060
13051
|
const blockClass = getComplexBlockClass(editor, block);
|
|
13061
13052
|
return blockClass.getChildContainers(editor, block, options);
|
|
13062
13053
|
}
|
|
13063
13054
|
function complexBlockGetSelectedContainers(editor, block, start, end) {
|
|
13064
13055
|
if (start.isSimple()) {
|
|
13065
|
-
assert(logger$
|
|
13056
|
+
assert(logger$4p, end.isSimple(), "invalid start and end position");
|
|
13066
13057
|
return complexBlockGetAllChildContainers(editor, block);
|
|
13067
13058
|
}
|
|
13068
|
-
assert(logger$
|
|
13069
|
-
assert(logger$
|
|
13059
|
+
assert(logger$4p, !start.isSimple(), "invalid start pos");
|
|
13060
|
+
assert(logger$4p, !end.isSimple(), "invalid end pos");
|
|
13070
13061
|
const blockClass = getComplexBlockClass(editor, block);
|
|
13071
13062
|
return blockClass.getSelectedContainers(editor, block, start, end);
|
|
13072
13063
|
}
|
|
@@ -13077,11 +13068,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13077
13068
|
const parentComplexBlock = getParentBlock(getParentContainer(childBlock));
|
|
13078
13069
|
if (!parentComplexBlock)
|
|
13079
13070
|
return false;
|
|
13080
|
-
assert(logger$
|
|
13071
|
+
assert(logger$4p, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
|
|
13081
13072
|
const childContainer = getParentContainer(childBlock);
|
|
13082
13073
|
const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock);
|
|
13083
13074
|
const index2 = childContainers.indexOf(childContainer);
|
|
13084
|
-
assert(logger$
|
|
13075
|
+
assert(logger$4p, index2 >= 0, "not valid child container");
|
|
13085
13076
|
return index2 === 0;
|
|
13086
13077
|
}
|
|
13087
13078
|
function complexBlockGetFirstSimpleChild(editor, complexBlock, options) {
|
|
@@ -13134,13 +13125,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13134
13125
|
return block;
|
|
13135
13126
|
}
|
|
13136
13127
|
function findPrevSimpleBlockBeforeChildContainer(editor, childContainer, options) {
|
|
13137
|
-
assert(logger$
|
|
13128
|
+
assert(logger$4p, isChildContainer(childContainer), "not a child container");
|
|
13138
13129
|
const parentComplexBlock = getParentBlock(childContainer);
|
|
13139
|
-
assert(logger$
|
|
13140
|
-
assert(logger$
|
|
13130
|
+
assert(logger$4p, parentComplexBlock, "no parent block");
|
|
13131
|
+
assert(logger$4p, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
|
|
13141
13132
|
const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock, options);
|
|
13142
13133
|
const containerIndex = childContainers.indexOf(childContainer);
|
|
13143
|
-
assert(logger$
|
|
13134
|
+
assert(logger$4p, containerIndex !== -1, "child container not found");
|
|
13144
13135
|
if (containerIndex === 0) {
|
|
13145
13136
|
const prevBlock = getPrevBlock(parentComplexBlock);
|
|
13146
13137
|
if (!prevBlock)
|
|
@@ -13158,9 +13149,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13158
13149
|
return lastBlock2;
|
|
13159
13150
|
}
|
|
13160
13151
|
function complexBlockGetTopChildContainers(editor, complexBlock) {
|
|
13161
|
-
assert(logger$
|
|
13152
|
+
assert(logger$4p, isComplexKindBlock(editor, complexBlock), "not a complex block");
|
|
13162
13153
|
const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
|
|
13163
|
-
assert(logger$
|
|
13154
|
+
assert(logger$4p, childContainers.length > 0, "no child container");
|
|
13164
13155
|
if (childContainers.length === 1) {
|
|
13165
13156
|
return childContainers;
|
|
13166
13157
|
}
|
|
@@ -13185,9 +13176,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13185
13176
|
return ret;
|
|
13186
13177
|
}
|
|
13187
13178
|
function complexBlockGetBottomChildContainers(editor, complexBlock) {
|
|
13188
|
-
assert(logger$
|
|
13179
|
+
assert(logger$4p, isComplexKindBlock(editor, complexBlock), "not a complex block");
|
|
13189
13180
|
const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
|
|
13190
|
-
assert(logger$
|
|
13181
|
+
assert(logger$4p, childContainers.length > 0, "no child container");
|
|
13191
13182
|
if (childContainers.length === 1) {
|
|
13192
13183
|
return childContainers;
|
|
13193
13184
|
}
|
|
@@ -13292,11 +13283,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13292
13283
|
return result;
|
|
13293
13284
|
}
|
|
13294
13285
|
const anchor = "";
|
|
13295
|
-
const logger$
|
|
13286
|
+
const logger$4o = getLogger("text-range");
|
|
13296
13287
|
function getBlockRangeInfo(block, blockOffset) {
|
|
13297
13288
|
const getChildRange = (child, offset) => {
|
|
13298
13289
|
if (isTextBlockContentInsertionChild(child)) {
|
|
13299
|
-
assert(logger$
|
|
13290
|
+
assert(logger$4o, offset === 0, `invalid offset for insertion child: ${offset}`);
|
|
13300
13291
|
const childOffset = 2;
|
|
13301
13292
|
return {
|
|
13302
13293
|
child,
|
|
@@ -13305,7 +13296,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13305
13296
|
};
|
|
13306
13297
|
}
|
|
13307
13298
|
if (isTextBlockContentBoxChild(child)) {
|
|
13308
|
-
assert(logger$
|
|
13299
|
+
assert(logger$4o, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
|
|
13309
13300
|
const childOffset = offset === 0 ? 1 : 2;
|
|
13310
13301
|
return {
|
|
13311
13302
|
child,
|
|
@@ -13314,17 +13305,17 @@ var __publicField = (obj, key, value) => {
|
|
|
13314
13305
|
};
|
|
13315
13306
|
}
|
|
13316
13307
|
const textNode = child.firstChild;
|
|
13317
|
-
assert(logger$
|
|
13318
|
-
assert(logger$
|
|
13308
|
+
assert(logger$4o, textNode, "no child node for text child");
|
|
13309
|
+
assert(logger$4o, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
|
|
13319
13310
|
if (textNode instanceof HTMLBRElement) {
|
|
13320
|
-
assert(logger$
|
|
13311
|
+
assert(logger$4o, offset >= 0 && offset <= 0, "invalid offset for text child");
|
|
13321
13312
|
return {
|
|
13322
13313
|
child,
|
|
13323
13314
|
container: textNode,
|
|
13324
13315
|
offset
|
|
13325
13316
|
};
|
|
13326
13317
|
}
|
|
13327
|
-
assert(logger$
|
|
13318
|
+
assert(logger$4o, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
|
|
13328
13319
|
return {
|
|
13329
13320
|
child,
|
|
13330
13321
|
container: textNode,
|
|
@@ -13353,38 +13344,38 @@ var __publicField = (obj, key, value) => {
|
|
|
13353
13344
|
}
|
|
13354
13345
|
start += childLength;
|
|
13355
13346
|
}
|
|
13356
|
-
assert(logger$
|
|
13347
|
+
assert(logger$4o, false, "failed to get range info");
|
|
13357
13348
|
}
|
|
13358
13349
|
function createChildRange(child, start, end) {
|
|
13359
13350
|
if (start === end) {
|
|
13360
|
-
assert(logger$
|
|
13351
|
+
assert(logger$4o, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
|
|
13361
13352
|
} else {
|
|
13362
|
-
assert(logger$
|
|
13353
|
+
assert(logger$4o, start < end, `invalid start & end: ${start}, ${end}`);
|
|
13363
13354
|
}
|
|
13364
13355
|
if (isTextBlockContentInsertionChild(child)) {
|
|
13365
|
-
assert(logger$
|
|
13366
|
-
assert(logger$
|
|
13356
|
+
assert(logger$4o, start === end, `invalid insertion child range offset: ${start}, ${end}`);
|
|
13357
|
+
assert(logger$4o, start === 0, `invalid insertion child range start: ${start}`);
|
|
13367
13358
|
const insertionElem = child;
|
|
13368
|
-
assert(logger$
|
|
13359
|
+
assert(logger$4o, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
|
|
13369
13360
|
const range = createExpandedRange(insertionElem, 1, insertionElem, 2);
|
|
13370
13361
|
return range;
|
|
13371
13362
|
}
|
|
13372
13363
|
if (isTextBlockContentBoxChild(child)) {
|
|
13373
|
-
assert(logger$
|
|
13374
|
-
assert(logger$
|
|
13364
|
+
assert(logger$4o, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
|
|
13365
|
+
assert(logger$4o, start === 0, `invalid box child range start: ${start}`);
|
|
13375
13366
|
const box = child;
|
|
13376
|
-
assert(logger$
|
|
13367
|
+
assert(logger$4o, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
|
|
13377
13368
|
const range = createExpandedRange(box, 1, box, 2);
|
|
13378
13369
|
return range;
|
|
13379
13370
|
}
|
|
13380
13371
|
const length = getTextBlockContentChildTextLength(child);
|
|
13381
|
-
assert(logger$
|
|
13372
|
+
assert(logger$4o, end <= length, `invalid child end: ${end}, ${length}`);
|
|
13382
13373
|
const textNode = child.firstChild;
|
|
13383
|
-
assert(logger$
|
|
13384
|
-
assert(logger$
|
|
13374
|
+
assert(logger$4o, textNode instanceof Text, "invalid block text child");
|
|
13375
|
+
assert(logger$4o, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
|
|
13385
13376
|
return createExpandedRange(textNode, start, textNode, end);
|
|
13386
13377
|
}
|
|
13387
|
-
const logger$
|
|
13378
|
+
const logger$4n = getLogger("caret-rect");
|
|
13388
13379
|
function getChildClientRects(block, child) {
|
|
13389
13380
|
if (isBox(child)) {
|
|
13390
13381
|
const box = child;
|
|
@@ -13393,7 +13384,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13393
13384
|
const blockContent = getBlockContent(block);
|
|
13394
13385
|
const lineHeight = Number.parseFloat(window.getComputedStyle(blockContent).lineHeight) || boxContent.getBoundingClientRect().height;
|
|
13395
13386
|
const rects = Array.from(boxContent.getClientRects());
|
|
13396
|
-
assert(logger$
|
|
13387
|
+
assert(logger$4n, rects.length > 0, "no box client rects");
|
|
13397
13388
|
const blockRect = blockContent.getBoundingClientRect();
|
|
13398
13389
|
const firstRect = rects[0];
|
|
13399
13390
|
const lastRect = new DOMRect(blockRect.left, firstRect.bottom, 1, lineHeight);
|
|
@@ -13413,22 +13404,22 @@ var __publicField = (obj, key, value) => {
|
|
|
13413
13404
|
const rect2 = getLastClientRect(ranges[0].child);
|
|
13414
13405
|
return new DOMRect(rect2.right, rect2.top, 1, rect2.height);
|
|
13415
13406
|
}
|
|
13416
|
-
assert(logger$
|
|
13407
|
+
assert(logger$4n, ranges[1], "invalid ranges");
|
|
13417
13408
|
const rect = getFirstClientRect(ranges[1].child);
|
|
13418
13409
|
return new DOMRect(rect.left, rect.top, 1, rect.height);
|
|
13419
13410
|
}
|
|
13420
13411
|
let rangeInfo = ranges[0];
|
|
13421
|
-
assert(logger$
|
|
13412
|
+
assert(logger$4n, ranges.length >= 1, "failed to get block range");
|
|
13422
13413
|
if (ranges.length === 1) {
|
|
13423
13414
|
rangeInfo = ranges[0];
|
|
13424
13415
|
} else {
|
|
13425
|
-
assert(logger$
|
|
13416
|
+
assert(logger$4n, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
|
|
13426
13417
|
if (isTextBlockContentInsertionChild(ranges[ranges.length - 1].child)) {
|
|
13427
13418
|
rangeInfo = ranges[ranges.length - 1];
|
|
13428
13419
|
const child = rangeInfo.child;
|
|
13429
13420
|
const content = getInsertionContent(child);
|
|
13430
13421
|
const rects2 = content.getClientRects();
|
|
13431
|
-
assert(logger$
|
|
13422
|
+
assert(logger$4n, rects2.length >= 1, "no client rects for box content");
|
|
13432
13423
|
const rect = rects2[rects2.length - 1];
|
|
13433
13424
|
return new DOMRect(rect.right, rect.y, 1, rect.height);
|
|
13434
13425
|
}
|
|
@@ -13445,9 +13436,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13445
13436
|
}
|
|
13446
13437
|
}
|
|
13447
13438
|
if (rangeInfo.container instanceof HTMLBRElement) {
|
|
13448
|
-
assert(logger$
|
|
13439
|
+
assert(logger$4n, pos.offset === 0, "invalid offset for empty block text");
|
|
13449
13440
|
const parent = rangeInfo.container.parentElement;
|
|
13450
|
-
assert(logger$
|
|
13441
|
+
assert(logger$4n, parent, "invalid br parent");
|
|
13451
13442
|
const rect = parent.getBoundingClientRect();
|
|
13452
13443
|
const ret = new DOMRect(rect.left, rect.top, 1, rect.height);
|
|
13453
13444
|
return ret;
|
|
@@ -13455,11 +13446,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13455
13446
|
const range = createRange(rangeInfo.container, rangeInfo.offset);
|
|
13456
13447
|
const rects = Array.from(range.getClientRects());
|
|
13457
13448
|
if (rects.length === 0) {
|
|
13458
|
-
assert(logger$
|
|
13459
|
-
assert(logger$
|
|
13449
|
+
assert(logger$4n, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
|
|
13450
|
+
assert(logger$4n, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
|
|
13460
13451
|
const child = rangeInfo.child;
|
|
13461
13452
|
const rects2 = getChildClientRects(block, child);
|
|
13462
|
-
assert(logger$
|
|
13453
|
+
assert(logger$4n, rects2.length >= 1, "no client rects for box content");
|
|
13463
13454
|
if (rangeInfo.offset === 1) {
|
|
13464
13455
|
const rect2 = rects2[0];
|
|
13465
13456
|
return new DOMRect(rect2.x, rect2.y, 1, rect2.height);
|
|
@@ -13505,7 +13496,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13505
13496
|
});
|
|
13506
13497
|
}
|
|
13507
13498
|
}
|
|
13508
|
-
assert(logger$
|
|
13499
|
+
assert(logger$4n, rects.length > 0, "no client rects for range");
|
|
13509
13500
|
if (pos.type === "home") {
|
|
13510
13501
|
return rects[rects.length - 1];
|
|
13511
13502
|
}
|
|
@@ -13585,13 +13576,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13585
13576
|
};
|
|
13586
13577
|
}
|
|
13587
13578
|
}
|
|
13588
|
-
const logger$
|
|
13579
|
+
const logger$4m = getLogger("selection-range");
|
|
13589
13580
|
function createEditorSelectionRange(editor, options) {
|
|
13590
13581
|
const { anchor: anchor2, focus } = options;
|
|
13591
13582
|
if (anchor2 instanceof EditorSimpleBlockPosition && focus instanceof EditorSimpleBlockPosition) {
|
|
13592
13583
|
return new EditorSimpleSelectionRange(editor, { anchor: anchor2, focus });
|
|
13593
13584
|
}
|
|
13594
|
-
assert(logger$
|
|
13585
|
+
assert(logger$4m, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
|
|
13595
13586
|
return new EditorComplexSelectionRange(editor, { anchor: anchor2, focus });
|
|
13596
13587
|
}
|
|
13597
13588
|
function createBlockSimpleRange(editor, block, anchor2, focus) {
|
|
@@ -13613,7 +13604,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13613
13604
|
const focus = createSimpleBlockPosition(range.focus.blockId, range.focus.offset, "normal");
|
|
13614
13605
|
return createEditorSelectionRange(editor, { anchor: anchor2, focus });
|
|
13615
13606
|
}
|
|
13616
|
-
const logger$
|
|
13607
|
+
const logger$4l = getLogger("range-from-point");
|
|
13617
13608
|
function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
|
|
13618
13609
|
const yOffsets = [0, -12, 12];
|
|
13619
13610
|
let x = pointX;
|
|
@@ -13645,7 +13636,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13645
13636
|
const rect = elem.getBoundingClientRect();
|
|
13646
13637
|
if (rect.width && rect.top && i === 0) {
|
|
13647
13638
|
if (rect.left + rect.width < x || rect.top + rect.height < y) {
|
|
13648
|
-
logger$
|
|
13639
|
+
logger$4l.debug("click on scrollbar, out of element rect");
|
|
13649
13640
|
return null;
|
|
13650
13641
|
}
|
|
13651
13642
|
}
|
|
@@ -13683,7 +13674,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13683
13674
|
let block = getLastChildBlock(container);
|
|
13684
13675
|
if (!isVisibleBlock(block)) {
|
|
13685
13676
|
const preBlock = getPrevVisibleBlock(block);
|
|
13686
|
-
assert(logger$
|
|
13677
|
+
assert(logger$4l, preBlock, "container must have visible block");
|
|
13687
13678
|
block = preBlock;
|
|
13688
13679
|
}
|
|
13689
13680
|
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, block.getBoundingClientRect().bottom - 4);
|
|
@@ -13702,7 +13693,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13702
13693
|
if (range instanceof EditorSimpleSelectionRange) {
|
|
13703
13694
|
return range;
|
|
13704
13695
|
}
|
|
13705
|
-
assert(logger$
|
|
13696
|
+
assert(logger$4l, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
|
|
13706
13697
|
const complexRange = range;
|
|
13707
13698
|
const container2 = editor.getContainerById(complexRange.start.childContainerId);
|
|
13708
13699
|
return getRangeInContainer(editor, container2, x, y);
|
|
@@ -13725,7 +13716,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13725
13716
|
});
|
|
13726
13717
|
return getRangeInContainer(editor, container, x, y);
|
|
13727
13718
|
}
|
|
13728
|
-
const logger$
|
|
13719
|
+
const logger$4k = getLogger("adjust-selection-pos");
|
|
13729
13720
|
function getParentContainers(block) {
|
|
13730
13721
|
const containers = [];
|
|
13731
13722
|
while (block) {
|
|
@@ -13735,10 +13726,10 @@ var __publicField = (obj, key, value) => {
|
|
|
13735
13726
|
return containers;
|
|
13736
13727
|
}
|
|
13737
13728
|
const newBlock = getParentBlock(container);
|
|
13738
|
-
assert(logger$
|
|
13729
|
+
assert(logger$4k, newBlock, "child container has not parent container");
|
|
13739
13730
|
block = newBlock;
|
|
13740
13731
|
}
|
|
13741
|
-
assert(logger$
|
|
13732
|
+
assert(logger$4k, false, "should not come here: getParentContainers");
|
|
13742
13733
|
}
|
|
13743
13734
|
function getParentBlockInContainer(container, block) {
|
|
13744
13735
|
while (block) {
|
|
@@ -13747,16 +13738,16 @@ var __publicField = (obj, key, value) => {
|
|
|
13747
13738
|
return block;
|
|
13748
13739
|
}
|
|
13749
13740
|
const newBlock = getParentBlock(parent);
|
|
13750
|
-
assert(logger$
|
|
13741
|
+
assert(logger$4k, newBlock, "could not find parent block for a child container");
|
|
13751
13742
|
block = newBlock;
|
|
13752
13743
|
}
|
|
13753
|
-
assert(logger$
|
|
13744
|
+
assert(logger$4k, false, "no parent block in specified container");
|
|
13754
13745
|
}
|
|
13755
13746
|
function getClosestParentBlock(block1, block2) {
|
|
13756
13747
|
const containers1 = getParentContainers(block1);
|
|
13757
13748
|
const containers2 = getParentContainers(block2);
|
|
13758
|
-
assert(logger$
|
|
13759
|
-
assert(logger$
|
|
13749
|
+
assert(logger$4k, containers1.length > 0 && containers2.length > 0, "block has not parent container");
|
|
13750
|
+
assert(logger$4k, containers1[0] === containers2[0], "root container does not equal");
|
|
13760
13751
|
let parentContainer = containers1[0];
|
|
13761
13752
|
for (let i = 1; i < containers1.length || containers2.length; i++) {
|
|
13762
13753
|
if (containers1[i] === containers2[i]) {
|
|
@@ -13775,23 +13766,23 @@ var __publicField = (obj, key, value) => {
|
|
|
13775
13766
|
}
|
|
13776
13767
|
function getParentContainerInComplexBlock(parentComplexBlock, element) {
|
|
13777
13768
|
let block = getParentBlock(element);
|
|
13778
|
-
assert(logger$
|
|
13769
|
+
assert(logger$4k, block, "element is not in a block");
|
|
13779
13770
|
while (block) {
|
|
13780
13771
|
const container = getParentContainer(block);
|
|
13781
|
-
assert(logger$
|
|
13772
|
+
assert(logger$4k, isChildContainer(container), "not a child container");
|
|
13782
13773
|
const parentBlock = getParentBlock(container);
|
|
13783
|
-
assert(logger$
|
|
13774
|
+
assert(logger$4k, parentBlock, "child container has not parent block");
|
|
13784
13775
|
if (parentBlock === parentComplexBlock) {
|
|
13785
13776
|
return container;
|
|
13786
13777
|
}
|
|
13787
13778
|
block = parentBlock;
|
|
13788
13779
|
}
|
|
13789
|
-
assert(logger$
|
|
13780
|
+
assert(logger$4k, false, "failed to find parent container in complex block");
|
|
13790
13781
|
}
|
|
13791
13782
|
function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
|
|
13792
13783
|
const blockId = getBlockId(complexBlock);
|
|
13793
|
-
assert(logger$
|
|
13794
|
-
assert(logger$
|
|
13784
|
+
assert(logger$4k, blockId === anchor2.blockId, "invalid start pos");
|
|
13785
|
+
assert(logger$4k, blockId === focus.blockId, "invalid end pos");
|
|
13795
13786
|
const blockClass = getComplexBlockClass(editor, complexBlock);
|
|
13796
13787
|
if (blockClass.adjustSelectionPos) {
|
|
13797
13788
|
return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
|
|
@@ -13825,8 +13816,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13825
13816
|
if (focus instanceof EditorComplexBlockPosition) {
|
|
13826
13817
|
focus = createSimpleBlockPosition(focusBlock, getBlockTextLength$6(editor, focusBlock), "end");
|
|
13827
13818
|
}
|
|
13828
|
-
assert(logger$
|
|
13829
|
-
assert(logger$
|
|
13819
|
+
assert(logger$4k, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
|
|
13820
|
+
assert(logger$4k, focus instanceof EditorSimpleBlockPosition, "not valid position type");
|
|
13830
13821
|
return {
|
|
13831
13822
|
anchor: anchor2,
|
|
13832
13823
|
focus
|
|
@@ -13880,7 +13871,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13880
13871
|
focus
|
|
13881
13872
|
};
|
|
13882
13873
|
}
|
|
13883
|
-
const logger$
|
|
13874
|
+
const logger$4j = getLogger("core");
|
|
13884
13875
|
function createBlockAnchor(editor, block, id, refClientRect) {
|
|
13885
13876
|
const tools = getBlockTools(block);
|
|
13886
13877
|
let elem = tools.querySelector(`.block-anchor[data-id=${id}]`);
|
|
@@ -13898,7 +13889,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13898
13889
|
return elem;
|
|
13899
13890
|
}
|
|
13900
13891
|
function createBlockCaretAnchor(editor, block, offset, id) {
|
|
13901
|
-
assert(logger$
|
|
13892
|
+
assert(logger$4j, isTextKindBlock(editor, block), "not a text kind block");
|
|
13902
13893
|
const caretRect = getTextCaretRect(block, createSimpleBlockPosition(block, offset, "normal"));
|
|
13903
13894
|
const blockRect = block.getBoundingClientRect();
|
|
13904
13895
|
const tools = getBlockTools(block);
|
|
@@ -14257,19 +14248,19 @@ var __publicField = (obj, key, value) => {
|
|
|
14257
14248
|
return result + (index2 ? "-" : "") + word.toLowerCase();
|
|
14258
14249
|
});
|
|
14259
14250
|
const kebabCase$1 = kebabCase;
|
|
14260
|
-
const logger$
|
|
14251
|
+
const logger$4i = getLogger("box");
|
|
14261
14252
|
function isBoxOp(op) {
|
|
14262
14253
|
if (!op.attributes)
|
|
14263
14254
|
return false;
|
|
14264
14255
|
if (!op.attributes.box)
|
|
14265
14256
|
return false;
|
|
14266
|
-
assert(logger$
|
|
14267
|
-
assert(logger$
|
|
14257
|
+
assert(logger$4i, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
|
|
14258
|
+
assert(logger$4i, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
|
|
14268
14259
|
return true;
|
|
14269
14260
|
}
|
|
14270
|
-
const logger$
|
|
14261
|
+
const logger$4h = getLogger("text-op");
|
|
14271
14262
|
function getOpLength(op) {
|
|
14272
|
-
assert(logger$
|
|
14263
|
+
assert(logger$4h, typeof op.insert === "string", "invalid op, no insert");
|
|
14273
14264
|
return op.insert.length;
|
|
14274
14265
|
}
|
|
14275
14266
|
function getOpAt(text2, offset) {
|
|
@@ -14277,7 +14268,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14277
14268
|
let pos = 0;
|
|
14278
14269
|
for (let i = 0; i < ops.length; i++) {
|
|
14279
14270
|
const op = ops[i];
|
|
14280
|
-
assert(logger$
|
|
14271
|
+
assert(logger$4h, typeof op.insert === "string", "invalid text op, no insert");
|
|
14281
14272
|
const end = pos + getOpLength(op);
|
|
14282
14273
|
if (end > offset) {
|
|
14283
14274
|
return [op];
|
|
@@ -14293,22 +14284,22 @@ var __publicField = (obj, key, value) => {
|
|
|
14293
14284
|
}
|
|
14294
14285
|
return [];
|
|
14295
14286
|
}
|
|
14296
|
-
const logger$
|
|
14287
|
+
const logger$4g = getLogger("rich-text-length");
|
|
14297
14288
|
function getTextOpLength(op) {
|
|
14298
|
-
assert(logger$
|
|
14289
|
+
assert(logger$4g, typeof op.insert === "string", "op.insert is not string");
|
|
14299
14290
|
return op.insert.length;
|
|
14300
14291
|
}
|
|
14301
14292
|
function getTextLength(ops) {
|
|
14302
14293
|
let count = 0;
|
|
14303
14294
|
ops.forEach((op) => {
|
|
14304
14295
|
if (op.insert) {
|
|
14305
|
-
assert(logger$
|
|
14296
|
+
assert(logger$4g, typeof op.insert === "string", "op.insert is not string");
|
|
14306
14297
|
count += getTextOpLength(op);
|
|
14307
14298
|
}
|
|
14308
14299
|
});
|
|
14309
14300
|
return count;
|
|
14310
14301
|
}
|
|
14311
|
-
const logger$
|
|
14302
|
+
const logger$4f = getLogger("split-text");
|
|
14312
14303
|
function splitText(ops, offset, splitResult) {
|
|
14313
14304
|
ops = cloneDeep__default.default(ops);
|
|
14314
14305
|
if (offset === 0) {
|
|
@@ -14326,8 +14317,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14326
14317
|
let counted = 0;
|
|
14327
14318
|
for (let i = 0; i < ops.length; i++) {
|
|
14328
14319
|
const op = ops[i];
|
|
14329
|
-
assert(logger$
|
|
14330
|
-
assert(logger$
|
|
14320
|
+
assert(logger$4f, typeof op === "object", `invalid op type, ${typeof op}`);
|
|
14321
|
+
assert(logger$4f, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
|
|
14331
14322
|
const subLen = getTextOpLength(op);
|
|
14332
14323
|
if (counted + subLen < offset) {
|
|
14333
14324
|
counted += subLen;
|
|
@@ -14337,18 +14328,18 @@ var __publicField = (obj, key, value) => {
|
|
|
14337
14328
|
right: ops.slice(i + 1)
|
|
14338
14329
|
};
|
|
14339
14330
|
} else {
|
|
14340
|
-
assert(logger$
|
|
14331
|
+
assert(logger$4f, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
|
|
14341
14332
|
const splitIndex = offset - counted;
|
|
14342
14333
|
const copied = cloneDeep__default.default(op);
|
|
14343
|
-
assert(logger$
|
|
14344
|
-
assert(logger$
|
|
14334
|
+
assert(logger$4f, copied.insert, "no copied.insert");
|
|
14335
|
+
assert(logger$4f, typeof copied.insert === "string", "invalid copied.insert type");
|
|
14345
14336
|
copied.insert = copied.insert.substr(0, splitIndex);
|
|
14346
14337
|
op.insert = op.insert.substr(splitIndex);
|
|
14347
14338
|
if (copied.insert === "") {
|
|
14348
|
-
assert(logger$
|
|
14339
|
+
assert(logger$4f, false, "invalid copied.insert, is empty string");
|
|
14349
14340
|
}
|
|
14350
14341
|
if (op.insert === "") {
|
|
14351
|
-
assert(logger$
|
|
14342
|
+
assert(logger$4f, false, "invalid op.insert, is empty string");
|
|
14352
14343
|
}
|
|
14353
14344
|
const right = [
|
|
14354
14345
|
op,
|
|
@@ -14367,9 +14358,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14367
14358
|
throw new Error(`invalid split offset: ${offset}, ${JSON.stringify(ops)}`);
|
|
14368
14359
|
}
|
|
14369
14360
|
function splitToThree(text2, offset, length) {
|
|
14370
|
-
assert(logger$
|
|
14371
|
-
assert(logger$
|
|
14372
|
-
assert(logger$
|
|
14361
|
+
assert(logger$4f, offset >= 0, "invalid offset, < 0");
|
|
14362
|
+
assert(logger$4f, length > 0, "invalid length, <= 0");
|
|
14363
|
+
assert(logger$4f, offset + length <= getTextLength(text2), "invalid offset + length < text length");
|
|
14373
14364
|
const { left: temp, right } = splitText(text2, offset + length);
|
|
14374
14365
|
const { left, right: middle } = splitText(temp, offset);
|
|
14375
14366
|
return { left, middle, right };
|
|
@@ -14592,9 +14583,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14592
14583
|
}
|
|
14593
14584
|
return [color, backgroundColor];
|
|
14594
14585
|
}
|
|
14595
|
-
const logger$
|
|
14586
|
+
const logger$4e = getLogger("text-block-content");
|
|
14596
14587
|
function updateBlockContentCore(editor, blockPath, content, blockText, insertions) {
|
|
14597
|
-
assert(logger$
|
|
14588
|
+
assert(logger$4e, blockText, "no text for block");
|
|
14598
14589
|
if (blockText.length === 0 && (!insertions || insertions.size === 0)) {
|
|
14599
14590
|
content.innerHTML = "<span><br></span>";
|
|
14600
14591
|
return;
|
|
@@ -14626,9 +14617,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14626
14617
|
for (let i2 = 0; i2 < text2.length; i2++) {
|
|
14627
14618
|
const op = text2[i2];
|
|
14628
14619
|
if (isBoxOp(op)) {
|
|
14629
|
-
assert(logger$
|
|
14620
|
+
assert(logger$4e, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
|
|
14630
14621
|
const span2 = editor.editorBoxes.createBox(content, op.attributes);
|
|
14631
|
-
assert(logger$
|
|
14622
|
+
assert(logger$4e, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
|
|
14632
14623
|
const ret = editor.editorBlockRenders.renderBox(blockPath, op.attributes);
|
|
14633
14624
|
if (ret.classes) {
|
|
14634
14625
|
addClass(span2, ...ret.classes);
|
|
@@ -14646,7 +14637,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14646
14637
|
fragment.appendChild(span2);
|
|
14647
14638
|
continue;
|
|
14648
14639
|
}
|
|
14649
|
-
assert(logger$
|
|
14640
|
+
assert(logger$4e, op.insert, `no insert in op: ${JSON.stringify(op)}`);
|
|
14650
14641
|
const span = createElement("span", ["text"], fragment, op.insert);
|
|
14651
14642
|
if (op.attributes) {
|
|
14652
14643
|
const ret = editor.editorBlockRenders.renderText(blockPath, op.attributes);
|
|
@@ -14677,7 +14668,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14677
14668
|
const compositionText = editor.compositingText;
|
|
14678
14669
|
if (compositionText) {
|
|
14679
14670
|
const pos = editor.selection.range.start;
|
|
14680
|
-
assert(logger$
|
|
14671
|
+
assert(logger$4e, pos.isSimple(), "not an simple position while compositing");
|
|
14681
14672
|
if (pos.blockId === blockId) {
|
|
14682
14673
|
const attributes = getAttributesAt(text2, 0);
|
|
14683
14674
|
insertions.set(pos.offset, [{
|
|
@@ -14693,11 +14684,11 @@ var __publicField = (obj, key, value) => {
|
|
|
14693
14684
|
function clearAllTempCompositionText(editor) {
|
|
14694
14685
|
const children = editor.rootContainer.querySelectorAll('span[data-type="editor-insertion"].inputting-insertion');
|
|
14695
14686
|
if (children.length) {
|
|
14696
|
-
logger$
|
|
14687
|
+
logger$4e.debug(`remove ${children.length} temp composition span`);
|
|
14697
14688
|
}
|
|
14698
14689
|
Array.from(children).forEach((c) => c.remove());
|
|
14699
14690
|
}
|
|
14700
|
-
const logger$
|
|
14691
|
+
const logger$4d = getLogger("client-rects");
|
|
14701
14692
|
function getChildrenOffsets(block) {
|
|
14702
14693
|
const children = getTextBlockContentChildren(block);
|
|
14703
14694
|
let start = 0;
|
|
@@ -14715,15 +14706,15 @@ var __publicField = (obj, key, value) => {
|
|
|
14715
14706
|
return ret;
|
|
14716
14707
|
}
|
|
14717
14708
|
function getChildrenInRange(editor, block, from, to) {
|
|
14718
|
-
assert(logger$
|
|
14709
|
+
assert(logger$4d, from < to, `invalid from & to: ${from}, ${to}`);
|
|
14719
14710
|
const blockLength = getBlockTextLength$6(editor, block);
|
|
14720
|
-
assert(logger$
|
|
14711
|
+
assert(logger$4d, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
|
|
14721
14712
|
const offsets = getChildrenOffsets(block);
|
|
14722
14713
|
const startIndex = offsets.findIndex((c) => c.startBlockOffset <= from && from < c.endBlockOffset);
|
|
14723
14714
|
const endIndex = offsets.findIndex((c) => c.startBlockOffset < to && to <= c.endBlockOffset);
|
|
14724
|
-
assert(logger$
|
|
14725
|
-
assert(logger$
|
|
14726
|
-
assert(logger$
|
|
14715
|
+
assert(logger$4d, startIndex !== -1, "failed to find start child");
|
|
14716
|
+
assert(logger$4d, endIndex !== -1, "failed to find end child");
|
|
14717
|
+
assert(logger$4d, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
|
|
14727
14718
|
if (startIndex === endIndex) {
|
|
14728
14719
|
const child = offsets[startIndex];
|
|
14729
14720
|
return [{
|
|
@@ -14805,16 +14796,16 @@ var __publicField = (obj, key, value) => {
|
|
|
14805
14796
|
return rects;
|
|
14806
14797
|
}
|
|
14807
14798
|
function getRangeClientRects(editor, block, range) {
|
|
14808
|
-
assert(logger$
|
|
14799
|
+
assert(logger$4d, range instanceof EditorSimpleSelectionRange, "invalid range");
|
|
14809
14800
|
const start = range.start;
|
|
14810
14801
|
const end = range.end;
|
|
14811
|
-
assert(logger$
|
|
14812
|
-
assert(logger$
|
|
14813
|
-
assert(logger$
|
|
14814
|
-
assert(logger$
|
|
14802
|
+
assert(logger$4d, start.isSimple(), "text block only allow simple position");
|
|
14803
|
+
assert(logger$4d, end.isSimple(), "text block only allow simple position");
|
|
14804
|
+
assert(logger$4d, start.blockId === end.blockId, "only allow update one text block selection");
|
|
14805
|
+
assert(logger$4d, start.blockId === getBlockId(block), "only allow update one text block selection");
|
|
14815
14806
|
return getClientRects$2(editor, block, start, end);
|
|
14816
14807
|
}
|
|
14817
|
-
const logger$
|
|
14808
|
+
const logger$4c = getLogger("selection-background");
|
|
14818
14809
|
function getLineHeight(elem) {
|
|
14819
14810
|
const style2 = window.getComputedStyle(elem);
|
|
14820
14811
|
const lineHeightStyle = style2.getPropertyValue("line-height");
|
|
@@ -14834,9 +14825,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14834
14825
|
return lineHeight;
|
|
14835
14826
|
}
|
|
14836
14827
|
function updateSelection$4(editor, block, start, end) {
|
|
14837
|
-
assert(logger$
|
|
14838
|
-
assert(logger$
|
|
14839
|
-
assert(logger$
|
|
14828
|
+
assert(logger$4c, start.isSimple(), "text block only allow simple position");
|
|
14829
|
+
assert(logger$4c, end.isSimple(), "text block only allow simple position");
|
|
14830
|
+
assert(logger$4c, start.blockId === end.blockId, "only allow update one text block selection");
|
|
14840
14831
|
const from = start.offset;
|
|
14841
14832
|
const to = end.offset;
|
|
14842
14833
|
if (from === to) {
|
|
@@ -14895,7 +14886,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14895
14886
|
}
|
|
14896
14887
|
});
|
|
14897
14888
|
}
|
|
14898
|
-
const logger$
|
|
14889
|
+
const logger$4b = getLogger("line-breaker");
|
|
14899
14890
|
function mergeTextRects(rects) {
|
|
14900
14891
|
const result = [];
|
|
14901
14892
|
let lastRect = null;
|
|
@@ -15022,7 +15013,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15022
15013
|
}
|
|
15023
15014
|
const textChild = child;
|
|
15024
15015
|
const rects = mergeTextRects(textChild.getClientRects());
|
|
15025
|
-
assert(logger$
|
|
15016
|
+
assert(logger$4b, rects.length > 0, "invalid text child dom");
|
|
15026
15017
|
if (rects.length === 1) {
|
|
15027
15018
|
const nextChild = children[i + 1];
|
|
15028
15019
|
if (!nextChild) {
|
|
@@ -15047,10 +15038,10 @@ var __publicField = (obj, key, value) => {
|
|
|
15047
15038
|
continue;
|
|
15048
15039
|
}
|
|
15049
15040
|
const textNode = textChild.firstChild;
|
|
15050
|
-
assert(logger$
|
|
15051
|
-
assert(logger$
|
|
15041
|
+
assert(logger$4b, textNode, "invalid text child, no text node");
|
|
15042
|
+
assert(logger$4b, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
|
|
15052
15043
|
const textChildLength = getTextBlockContentChildTextLength(textChild);
|
|
15053
|
-
assert(logger$
|
|
15044
|
+
assert(logger$4b, textNode.data.length === textChildLength, "text node data length not equal child text length");
|
|
15054
15045
|
const textRects = getTextRects(textNode);
|
|
15055
15046
|
for (let rIndex = 0; rIndex < textRects.length - 1; rIndex++) {
|
|
15056
15047
|
const rect = textRects[rIndex];
|
|
@@ -15092,7 +15083,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15092
15083
|
}
|
|
15093
15084
|
}
|
|
15094
15085
|
}
|
|
15095
|
-
assert(logger$
|
|
15086
|
+
assert(logger$4b, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
|
|
15096
15087
|
return {
|
|
15097
15088
|
lineIndex: lineBreaks.length,
|
|
15098
15089
|
lineBreaks
|
|
@@ -23865,7 +23856,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23865
23856
|
const Graphemer_1 = __importDefault(Graphemer$1);
|
|
23866
23857
|
var _default = lib$1.default = Graphemer_1.default;
|
|
23867
23858
|
const splitter = new _default();
|
|
23868
|
-
const logger$
|
|
23859
|
+
const logger$4a = getLogger("text-offset");
|
|
23869
23860
|
function getChildOffset(block, child) {
|
|
23870
23861
|
const children = getTextBlockContentChildren(block);
|
|
23871
23862
|
let start = 0;
|
|
@@ -23881,26 +23872,26 @@ var __publicField = (obj, key, value) => {
|
|
|
23881
23872
|
}
|
|
23882
23873
|
start += testLength;
|
|
23883
23874
|
}
|
|
23884
|
-
assert(logger$
|
|
23875
|
+
assert(logger$4a, false, "can not find child in children");
|
|
23885
23876
|
}
|
|
23886
23877
|
function isValidOffset(block, blockOffset) {
|
|
23887
|
-
assert(logger$
|
|
23878
|
+
assert(logger$4a, blockOffset >= 0, `invalid offset: ${blockOffset}`);
|
|
23888
23879
|
const childInfo = getTextBlockChild(block, blockOffset);
|
|
23889
23880
|
const { prev, next: next2, offset } = childInfo;
|
|
23890
23881
|
if (!prev && !next2) {
|
|
23891
|
-
assert(logger$
|
|
23882
|
+
assert(logger$4a, false, "invalid offset, no prev & next child at offset");
|
|
23892
23883
|
}
|
|
23893
23884
|
if (prev !== next2) {
|
|
23894
23885
|
return true;
|
|
23895
23886
|
}
|
|
23896
23887
|
const child = prev;
|
|
23897
|
-
assert(logger$
|
|
23888
|
+
assert(logger$4a, child, "no child");
|
|
23898
23889
|
if (isTextBlockContentBoxChild(child)) {
|
|
23899
|
-
assert(logger$
|
|
23890
|
+
assert(logger$4a, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
|
|
23900
23891
|
return true;
|
|
23901
23892
|
}
|
|
23902
23893
|
const text2 = child.textContent;
|
|
23903
|
-
assert(logger$
|
|
23894
|
+
assert(logger$4a, text2, "no content for text child");
|
|
23904
23895
|
const chars = splitter.splitGraphemes(text2);
|
|
23905
23896
|
const validOffsets = /* @__PURE__ */ new Set();
|
|
23906
23897
|
let start = 0;
|
|
@@ -23930,7 +23921,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23930
23921
|
}
|
|
23931
23922
|
function getNextValidOffset(block, blockOffset) {
|
|
23932
23923
|
const length = getTextBlockLength(block);
|
|
23933
|
-
assert(logger$
|
|
23924
|
+
assert(logger$4a, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
|
|
23934
23925
|
if (blockOffset === length) {
|
|
23935
23926
|
return length;
|
|
23936
23927
|
}
|
|
@@ -23944,7 +23935,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23944
23935
|
}
|
|
23945
23936
|
return ret;
|
|
23946
23937
|
}
|
|
23947
|
-
const logger$
|
|
23938
|
+
const logger$49 = getLogger("line-offset");
|
|
23948
23939
|
function getLineOffsets(block) {
|
|
23949
23940
|
const lineBreaks = getLineBreaks(block);
|
|
23950
23941
|
const ret = [];
|
|
@@ -23965,7 +23956,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23965
23956
|
}
|
|
23966
23957
|
function getLineOffset(block, lineIndex) {
|
|
23967
23958
|
const lines = getLineOffsets(block);
|
|
23968
|
-
assert(logger$
|
|
23959
|
+
assert(logger$49, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
|
|
23969
23960
|
return lines[lineIndex];
|
|
23970
23961
|
}
|
|
23971
23962
|
function getLineOffsetByPos(block, pos) {
|
|
@@ -24022,7 +24013,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24022
24013
|
function getLineCount(block) {
|
|
24023
24014
|
return getLineOffsets(block).length;
|
|
24024
24015
|
}
|
|
24025
|
-
const logger$
|
|
24016
|
+
const logger$48 = getLogger("find-text-position");
|
|
24026
24017
|
function isWrappedLine(block, lineIndex) {
|
|
24027
24018
|
const { start, end } = getLineOffset(block, lineIndex);
|
|
24028
24019
|
const blockId = getBlockId(block);
|
|
@@ -24033,13 +24024,13 @@ var __publicField = (obj, key, value) => {
|
|
|
24033
24024
|
return false;
|
|
24034
24025
|
}
|
|
24035
24026
|
const childInfo = getTextBlockChild(block, start);
|
|
24036
|
-
assert(logger$
|
|
24037
|
-
assert(logger$
|
|
24027
|
+
assert(logger$48, childInfo.next, "no next child at offset");
|
|
24028
|
+
assert(logger$48, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
|
|
24038
24029
|
return true;
|
|
24039
24030
|
}
|
|
24040
24031
|
function getWrappedLineOffsets(block, lineIndex) {
|
|
24041
24032
|
const blockId = getBlockId(block);
|
|
24042
|
-
assert(logger$
|
|
24033
|
+
assert(logger$48, isWrappedLine(block, lineIndex), "line is not wrapped");
|
|
24043
24034
|
const { start, end } = getLineOffset(block, lineIndex);
|
|
24044
24035
|
const homePos = createSimpleBlockPosition(blockId, start, "home");
|
|
24045
24036
|
for (let offset = start + 1; offset <= end; offset += 1) {
|
|
@@ -24054,11 +24045,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24054
24045
|
return offset - 1;
|
|
24055
24046
|
}
|
|
24056
24047
|
}
|
|
24057
|
-
assert(logger$
|
|
24048
|
+
assert(logger$48, false, "failed to find wrapped offset");
|
|
24058
24049
|
return 0;
|
|
24059
24050
|
}
|
|
24060
24051
|
function findTextPositionInLine(editor, block, lineIndex, sourceBlock, pos, findDirection, suggestedX) {
|
|
24061
|
-
assert(logger$
|
|
24052
|
+
assert(logger$48, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
|
|
24062
24053
|
const { start, end } = getLineOffset(block, lineIndex);
|
|
24063
24054
|
let from = start;
|
|
24064
24055
|
const blockId = getBlockId(block);
|
|
@@ -24100,11 +24091,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24100
24091
|
return retPos;
|
|
24101
24092
|
}
|
|
24102
24093
|
function findPrevTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
|
|
24103
|
-
assert(logger$
|
|
24094
|
+
assert(logger$48, isTextKindBlock(editor, block), "not a text block");
|
|
24104
24095
|
return findTextPositionInLine(editor, block, getLineCount(block) - 1, sourceBlock, pos, "up", suggestedX);
|
|
24105
24096
|
}
|
|
24106
24097
|
function findNextTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
|
|
24107
|
-
assert(logger$
|
|
24098
|
+
assert(logger$48, isTextKindBlock(editor, block), "not a text block");
|
|
24108
24099
|
return findTextPositionInLine(editor, block, 0, sourceBlock, pos, "down", suggestedX);
|
|
24109
24100
|
}
|
|
24110
24101
|
function moveDown(editor, block, position, suggestedX) {
|
|
@@ -24212,7 +24203,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24212
24203
|
}
|
|
24213
24204
|
return pos;
|
|
24214
24205
|
}
|
|
24215
|
-
const logger$
|
|
24206
|
+
const logger$47 = getLogger("move-caret");
|
|
24216
24207
|
function moveTextCaret(editor, block, position, direction) {
|
|
24217
24208
|
if (direction === "ArrowLeft") {
|
|
24218
24209
|
const ret = moveLeft(block, position);
|
|
@@ -24242,9 +24233,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24242
24233
|
}
|
|
24243
24234
|
return createSimpleBlockPosition(getBlockId(block), ret.offset, ret.type);
|
|
24244
24235
|
}
|
|
24245
|
-
assert(logger$
|
|
24236
|
+
assert(logger$47, false, `invalid navigation direction: ${direction}`);
|
|
24246
24237
|
}
|
|
24247
|
-
const logger$
|
|
24238
|
+
const logger$46 = getLogger("text-range");
|
|
24248
24239
|
function getBlockRects(block) {
|
|
24249
24240
|
const ret = [];
|
|
24250
24241
|
const children = getTextBlockContentChildren(block);
|
|
@@ -24302,9 +24293,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24302
24293
|
return null;
|
|
24303
24294
|
}
|
|
24304
24295
|
const children = getTextBlockContentChildren(block);
|
|
24305
|
-
assert(logger$
|
|
24296
|
+
assert(logger$46, children.indexOf(child) !== -1, "failed to find child in children");
|
|
24306
24297
|
const offsetInfo = getChildOffset(block, child);
|
|
24307
|
-
assert(logger$
|
|
24298
|
+
assert(logger$46, offsetInfo, "failed to get child offset");
|
|
24308
24299
|
const { start } = offsetInfo;
|
|
24309
24300
|
let offset;
|
|
24310
24301
|
let length;
|
|
@@ -24320,7 +24311,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24320
24311
|
}
|
|
24321
24312
|
length = 0;
|
|
24322
24313
|
} else {
|
|
24323
|
-
assert(logger$
|
|
24314
|
+
assert(logger$46, child.firstChild instanceof Text, "child is not text");
|
|
24324
24315
|
offset = start + textNodeOffsetFromPoint(child.firstChild, x, y);
|
|
24325
24316
|
length = 0;
|
|
24326
24317
|
}
|
|
@@ -24344,9 +24335,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24344
24335
|
}
|
|
24345
24336
|
return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
|
|
24346
24337
|
}
|
|
24347
|
-
const logger$
|
|
24338
|
+
const logger$45 = getLogger("create-text-op");
|
|
24348
24339
|
function createTextOp(text2, attributes) {
|
|
24349
|
-
assert(logger$
|
|
24340
|
+
assert(logger$45, text2, "text is empty");
|
|
24350
24341
|
const ret = {
|
|
24351
24342
|
insert: text2
|
|
24352
24343
|
};
|
|
@@ -24369,7 +24360,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24369
24360
|
}
|
|
24370
24361
|
return result;
|
|
24371
24362
|
}
|
|
24372
|
-
const logger$
|
|
24363
|
+
const logger$44 = getLogger("merge-ops");
|
|
24373
24364
|
function mergeOps(text2) {
|
|
24374
24365
|
if (text2.length <= 1) {
|
|
24375
24366
|
return text2;
|
|
@@ -24391,10 +24382,10 @@ var __publicField = (obj, key, value) => {
|
|
|
24391
24382
|
return false;
|
|
24392
24383
|
}
|
|
24393
24384
|
if (op1.attributes === void 0) {
|
|
24394
|
-
assert(logger$
|
|
24385
|
+
assert(logger$44, op2.attributes === void 0, "op2.attributes is not undefined");
|
|
24395
24386
|
return true;
|
|
24396
24387
|
}
|
|
24397
|
-
assert(logger$
|
|
24388
|
+
assert(logger$44, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
|
|
24398
24389
|
return isEqual__default.default(op1.attributes, op2.attributes);
|
|
24399
24390
|
};
|
|
24400
24391
|
const newOps = [];
|
|
@@ -24403,8 +24394,8 @@ var __publicField = (obj, key, value) => {
|
|
|
24403
24394
|
for (let i = 1; i < text2.length; i += 1) {
|
|
24404
24395
|
const op = text2[i];
|
|
24405
24396
|
if (isSameTypeOp(before, op)) {
|
|
24406
|
-
assert(logger$
|
|
24407
|
-
assert(logger$
|
|
24397
|
+
assert(logger$44, typeof before.insert === "string", "before.insert is not string");
|
|
24398
|
+
assert(logger$44, typeof op.insert === "string", "op.insert is not string");
|
|
24408
24399
|
before.insert += op.insert;
|
|
24409
24400
|
} else {
|
|
24410
24401
|
newOps.push(op);
|
|
@@ -24432,15 +24423,15 @@ var __publicField = (obj, key, value) => {
|
|
|
24432
24423
|
}
|
|
24433
24424
|
return text2.slice(0, i + 1);
|
|
24434
24425
|
}
|
|
24435
|
-
const logger$
|
|
24426
|
+
const logger$43 = getLogger("delete-text");
|
|
24436
24427
|
function deleteText(richText2, offset, count) {
|
|
24437
24428
|
const { left, right } = splitToThree(richText2, offset, count);
|
|
24438
24429
|
const result = [...left, ...right];
|
|
24439
24430
|
return mergeOps(result);
|
|
24440
24431
|
}
|
|
24441
24432
|
function createDeleteOps(offset, count) {
|
|
24442
|
-
assert(logger$
|
|
24443
|
-
assert(logger$
|
|
24433
|
+
assert(logger$43, offset >= 0, `invalid offset: ${offset}`);
|
|
24434
|
+
assert(logger$43, count >= 1, `invalid delete count: ${count}`);
|
|
24444
24435
|
const ops = [];
|
|
24445
24436
|
if (offset !== 0) {
|
|
24446
24437
|
ops.push({
|
|
@@ -24452,7 +24443,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24452
24443
|
});
|
|
24453
24444
|
return ops;
|
|
24454
24445
|
}
|
|
24455
|
-
const logger$
|
|
24446
|
+
const logger$42 = getLogger("delta");
|
|
24456
24447
|
function diffRichText(oldText, newText) {
|
|
24457
24448
|
const delta1D = new Delta__default.default(oldText);
|
|
24458
24449
|
const delta2D = new Delta__default.default(newText);
|
|
@@ -24462,7 +24453,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24462
24453
|
return new Delta__default.default(ops).transformPosition(cursor, !isLocalOp);
|
|
24463
24454
|
}
|
|
24464
24455
|
function isValidDocText(text2) {
|
|
24465
|
-
assert(logger$
|
|
24456
|
+
assert(logger$42, text2, "ops is null or undefined");
|
|
24466
24457
|
for (let i = 0; i < text2.length; i++) {
|
|
24467
24458
|
const op = text2[i];
|
|
24468
24459
|
if (op.insert === null || op.insert === void 0) {
|
|
@@ -24482,7 +24473,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24482
24473
|
}
|
|
24483
24474
|
class RichText {
|
|
24484
24475
|
static ensureValidText(text2) {
|
|
24485
|
-
assert(logger$
|
|
24476
|
+
assert(logger$42, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
|
|
24486
24477
|
}
|
|
24487
24478
|
static diff(oldText, newText) {
|
|
24488
24479
|
this.ensureValidText(oldText);
|
|
@@ -24504,9 +24495,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24504
24495
|
return resultText;
|
|
24505
24496
|
}
|
|
24506
24497
|
}
|
|
24507
|
-
const logger$
|
|
24498
|
+
const logger$41 = getLogger("insert-text");
|
|
24508
24499
|
function insertText(richText2, offset, text2, attributes) {
|
|
24509
|
-
assert(logger$
|
|
24500
|
+
assert(logger$41, text2, `invalid text to insert: ${text2}`);
|
|
24510
24501
|
const { left, right } = splitText(richText2, offset);
|
|
24511
24502
|
const insertedText = typeof text2 === "string" ? [createTextOp(text2, attributes)] : text2;
|
|
24512
24503
|
const result = [...left, ...insertedText, ...right];
|
|
@@ -24519,7 +24510,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24519
24510
|
};
|
|
24520
24511
|
}
|
|
24521
24512
|
function createInsertOps(offset, text2, attributes) {
|
|
24522
|
-
assert(logger$
|
|
24513
|
+
assert(logger$41, offset >= 0, `invalid offset: ${offset}`);
|
|
24523
24514
|
if (text2.length === 0) {
|
|
24524
24515
|
return [];
|
|
24525
24516
|
}
|
|
@@ -24549,7 +24540,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24549
24540
|
function cloneText(text2) {
|
|
24550
24541
|
return cloneDeep__default.default(text2);
|
|
24551
24542
|
}
|
|
24552
|
-
const logger$
|
|
24543
|
+
const logger$40 = getLogger("update-op-attribute");
|
|
24553
24544
|
function updateOpAttributes(orgOps, key, value, newAttributes) {
|
|
24554
24545
|
const ops = cloneText(orgOps);
|
|
24555
24546
|
const index2 = ops.findIndex((op2) => {
|
|
@@ -24557,7 +24548,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24557
24548
|
return false;
|
|
24558
24549
|
return op2.attributes[key] === value;
|
|
24559
24550
|
});
|
|
24560
|
-
assert(logger$
|
|
24551
|
+
assert(logger$40, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
|
|
24561
24552
|
const op = ops[index2];
|
|
24562
24553
|
op.attributes = {
|
|
24563
24554
|
...op.attributes,
|
|
@@ -24639,11 +24630,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24639
24630
|
]);
|
|
24640
24631
|
}
|
|
24641
24632
|
const FILL_CHAR = "\u200B";
|
|
24642
|
-
const logger$
|
|
24633
|
+
const logger$3$ = getLogger("to-plain-text");
|
|
24643
24634
|
function toPlainText(ops, options) {
|
|
24644
24635
|
let text2 = "";
|
|
24645
24636
|
ops.forEach((op) => {
|
|
24646
|
-
assert(logger$
|
|
24637
|
+
assert(logger$3$, typeof op.insert === "string", "invalid op");
|
|
24647
24638
|
if (op.attributes && op.attributes.box === true) {
|
|
24648
24639
|
if (options == null ? void 0 : options.boxReplacement) {
|
|
24649
24640
|
text2 += options.boxReplacement;
|
|
@@ -24698,11 +24689,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24698
24689
|
focus: pos
|
|
24699
24690
|
};
|
|
24700
24691
|
}
|
|
24701
|
-
const logger$
|
|
24692
|
+
const logger$3_ = getLogger("block-to-text");
|
|
24702
24693
|
function textBlockToText$1(editor, ops, doc2) {
|
|
24703
24694
|
let text2 = "";
|
|
24704
24695
|
ops.forEach((op) => {
|
|
24705
|
-
assert(logger$
|
|
24696
|
+
assert(logger$3_, typeof op.insert === "string", "invalid op");
|
|
24706
24697
|
if (op.attributes && op.attributes.box === true) {
|
|
24707
24698
|
const box = op.attributes;
|
|
24708
24699
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -24720,11 +24711,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24720
24711
|
});
|
|
24721
24712
|
return text2;
|
|
24722
24713
|
}
|
|
24723
|
-
const logger$
|
|
24714
|
+
const logger$3Z = getLogger("block-to-text");
|
|
24724
24715
|
function textToMarkdownText(editor, ops, doc2) {
|
|
24725
24716
|
let text2 = "";
|
|
24726
24717
|
ops.forEach((op) => {
|
|
24727
|
-
assert(logger$
|
|
24718
|
+
assert(logger$3Z, typeof op.insert === "string", "invalid op");
|
|
24728
24719
|
if (op.attributes && op.attributes.box === true) {
|
|
24729
24720
|
const box = op.attributes;
|
|
24730
24721
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -24847,12 +24838,12 @@ var __publicField = (obj, key, value) => {
|
|
|
24847
24838
|
return void 0;
|
|
24848
24839
|
}
|
|
24849
24840
|
}
|
|
24850
|
-
const logger$
|
|
24841
|
+
const logger$3Y = getLogger("block-to-text");
|
|
24851
24842
|
function textBlockToHtml(editor, blockData, doc2) {
|
|
24852
24843
|
let html = "";
|
|
24853
24844
|
const ops = blockData.text || [];
|
|
24854
24845
|
ops.forEach((op) => {
|
|
24855
|
-
assert(logger$
|
|
24846
|
+
assert(logger$3Y, typeof op.insert === "string", "invalid op");
|
|
24856
24847
|
if (op.attributes && op.attributes.box === true) {
|
|
24857
24848
|
const box = op.attributes;
|
|
24858
24849
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -24928,16 +24919,16 @@ var __publicField = (obj, key, value) => {
|
|
|
24928
24919
|
}
|
|
24929
24920
|
return `<p>${html}</p>`;
|
|
24930
24921
|
}
|
|
24931
|
-
const logger$
|
|
24922
|
+
const logger$3X = getLogger("text-block");
|
|
24932
24923
|
function createBlockContent$5(editor, path, container, blockElement, blockData) {
|
|
24933
24924
|
const { text: text2 } = blockData;
|
|
24934
|
-
assert(logger$
|
|
24925
|
+
assert(logger$3X, text2, "no text for text block");
|
|
24935
24926
|
const content = createBlockContentElement(blockElement, "div");
|
|
24936
24927
|
updateBlockContent$1(editor, path, blockData.id, content, text2);
|
|
24937
24928
|
return content;
|
|
24938
24929
|
}
|
|
24939
24930
|
function updateBlockText$1(editor, block, text2) {
|
|
24940
|
-
assert(logger$
|
|
24931
|
+
assert(logger$3X, text2, "no text to update");
|
|
24941
24932
|
const newContent = createBlockContentElement(null, "div");
|
|
24942
24933
|
updateBlockContent$1(editor, getBlockPath(block), getBlockId(block), newContent, text2);
|
|
24943
24934
|
const oldContent = getBlockContent(block);
|
|
@@ -24947,7 +24938,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24947
24938
|
return getRangeClientRects(editor, block, range);
|
|
24948
24939
|
}
|
|
24949
24940
|
function convertTo$k(editor, blockData, doc2, type) {
|
|
24950
|
-
assert(logger$
|
|
24941
|
+
assert(logger$3X, blockData.text, "no text for text block");
|
|
24951
24942
|
if (type === "text") {
|
|
24952
24943
|
return textBlockToText$1(editor, blockData.text, doc2);
|
|
24953
24944
|
}
|
|
@@ -24961,7 +24952,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24961
24952
|
blockData.id = genId();
|
|
24962
24953
|
info == null ? void 0 : info.blockIdMap.set(srcBlockData.id, blockData.id);
|
|
24963
24954
|
const { text: text2 } = blockData;
|
|
24964
|
-
assert(logger$
|
|
24955
|
+
assert(logger$3X, text2, "no text for text block");
|
|
24965
24956
|
text2.forEach((op) => {
|
|
24966
24957
|
if (op.insert && op.attributes && op.attributes.box === true) {
|
|
24967
24958
|
const boxId = genId();
|
|
@@ -24993,7 +24984,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24993
24984
|
blockToDoc: blockToDoc$1
|
|
24994
24985
|
};
|
|
24995
24986
|
const updateTextBlockContent = updateBlockContent$1;
|
|
24996
|
-
const logger$
|
|
24987
|
+
const logger$3W = getLogger("action-helper");
|
|
24997
24988
|
function editorGetBlockData(editor, block) {
|
|
24998
24989
|
const container = getParentContainer(block);
|
|
24999
24990
|
const containerId = getContainerId(container);
|
|
@@ -25001,10 +24992,10 @@ var __publicField = (obj, key, value) => {
|
|
|
25001
24992
|
return editor.doc.getBlockData(containerId, blockIndex);
|
|
25002
24993
|
}
|
|
25003
24994
|
function editorGetBlockText(editor, block) {
|
|
25004
|
-
assert(logger$
|
|
24995
|
+
assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
|
|
25005
24996
|
const data2 = editorGetBlockData(editor, block);
|
|
25006
24997
|
const text2 = data2.text;
|
|
25007
|
-
assert(logger$
|
|
24998
|
+
assert(logger$3W, text2, "no text in block");
|
|
25008
24999
|
return text2;
|
|
25009
25000
|
}
|
|
25010
25001
|
function editorGetBlockTextEx(editor, block, length) {
|
|
@@ -25012,7 +25003,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25012
25003
|
}
|
|
25013
25004
|
function editorGetBoxData(editor, box) {
|
|
25014
25005
|
const block = getParentBlock(box);
|
|
25015
|
-
assert(logger$
|
|
25006
|
+
assert(logger$3W, block, "no parent block");
|
|
25016
25007
|
const text2 = editorGetBlockText(editor, block);
|
|
25017
25008
|
const id = getBoxId(box);
|
|
25018
25009
|
const op = text2.find((op2) => {
|
|
@@ -25022,60 +25013,60 @@ var __publicField = (obj, key, value) => {
|
|
|
25022
25013
|
}
|
|
25023
25014
|
return false;
|
|
25024
25015
|
});
|
|
25025
|
-
assert(logger$
|
|
25016
|
+
assert(logger$3W, op, "failed to find box");
|
|
25026
25017
|
return op.attributes;
|
|
25027
25018
|
}
|
|
25028
|
-
const logger$
|
|
25019
|
+
const logger$3V = getLogger("block-text");
|
|
25029
25020
|
function getTextAfterOffset(editor, block, offset) {
|
|
25030
|
-
assert(logger$
|
|
25031
|
-
assert(logger$
|
|
25032
|
-
assert(logger$
|
|
25021
|
+
assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
|
|
25022
|
+
assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
|
|
25023
|
+
assert(logger$3V, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25033
25024
|
const newOffset = getNextValidOffset(block, offset);
|
|
25034
25025
|
const length = newOffset - offset;
|
|
25035
25026
|
if (length === 0) {
|
|
25036
|
-
assert(logger$
|
|
25027
|
+
assert(logger$3V, false, `no text after offset: ${offset}`);
|
|
25037
25028
|
}
|
|
25038
25029
|
const text2 = editorGetBlockText(editor, block);
|
|
25039
25030
|
const { middle } = splitToThree(text2, offset, length);
|
|
25040
|
-
assert(logger$
|
|
25031
|
+
assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
|
|
25041
25032
|
const op = middle[0];
|
|
25042
25033
|
if (isBoxOp(op)) {
|
|
25043
25034
|
return " ";
|
|
25044
25035
|
}
|
|
25045
|
-
assert(logger$
|
|
25036
|
+
assert(logger$3V, op.insert.length === 1 || op.insert.length === 2, "invalid op");
|
|
25046
25037
|
return op.insert;
|
|
25047
25038
|
}
|
|
25048
25039
|
function getTextBeforeOffset(editor, block, offset) {
|
|
25049
|
-
assert(logger$
|
|
25050
|
-
assert(logger$
|
|
25051
|
-
assert(logger$
|
|
25040
|
+
assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
|
|
25041
|
+
assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
|
|
25042
|
+
assert(logger$3V, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25052
25043
|
const newOffset = getPrevValidOffset(block, offset);
|
|
25053
25044
|
const length = offset - newOffset;
|
|
25054
25045
|
if (length === 0) {
|
|
25055
|
-
assert(logger$
|
|
25046
|
+
assert(logger$3V, false, `no text before offset: ${offset}`);
|
|
25056
25047
|
}
|
|
25057
25048
|
const text2 = editorGetBlockText(editor, block);
|
|
25058
25049
|
const { middle } = splitToThree(text2, newOffset, length);
|
|
25059
|
-
assert(logger$
|
|
25050
|
+
assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
|
|
25060
25051
|
const op = middle[0];
|
|
25061
25052
|
if (isBoxOp(op)) {
|
|
25062
25053
|
return " ";
|
|
25063
25054
|
}
|
|
25064
|
-
assert(logger$
|
|
25055
|
+
assert(logger$3V, op.insert.length === 1 || op.insert.length === 2, "invalid op");
|
|
25065
25056
|
return op.insert;
|
|
25066
25057
|
}
|
|
25067
25058
|
function getOffsetInfoBefore(editor, block, offset) {
|
|
25068
|
-
assert(logger$
|
|
25069
|
-
assert(logger$
|
|
25070
|
-
assert(logger$
|
|
25059
|
+
assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
|
|
25060
|
+
assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
|
|
25061
|
+
assert(logger$3V, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25071
25062
|
const newOffset = getPrevValidOffset(block, offset);
|
|
25072
25063
|
const length = offset - newOffset;
|
|
25073
25064
|
if (length === 0) {
|
|
25074
|
-
assert(logger$
|
|
25065
|
+
assert(logger$3V, false, `no text before offset: ${offset}`);
|
|
25075
25066
|
}
|
|
25076
25067
|
const text2 = editorGetBlockText(editor, block);
|
|
25077
25068
|
const { middle } = splitToThree(text2, newOffset, length);
|
|
25078
|
-
assert(logger$
|
|
25069
|
+
assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
|
|
25079
25070
|
const op = middle[0];
|
|
25080
25071
|
if (isBoxOp(op)) {
|
|
25081
25072
|
return {
|
|
@@ -25085,33 +25076,25 @@ var __publicField = (obj, key, value) => {
|
|
|
25085
25076
|
length: 1
|
|
25086
25077
|
};
|
|
25087
25078
|
}
|
|
25088
|
-
let charType = "text";
|
|
25089
|
-
if (isSpace(op.insert)) {
|
|
25090
|
-
charType = "space";
|
|
25091
|
-
} else if (isCJKPunctuation(op.insert)) {
|
|
25092
|
-
charType = "cjk_punctuation";
|
|
25093
|
-
} else if (isCJK(op.insert)) {
|
|
25094
|
-
charType = "cjk";
|
|
25095
|
-
}
|
|
25096
25079
|
return {
|
|
25097
25080
|
op,
|
|
25098
|
-
charType,
|
|
25081
|
+
charType: isSpace(op.insert) ? "space" : "text",
|
|
25099
25082
|
offset: newOffset,
|
|
25100
25083
|
length: op.insert.length
|
|
25101
25084
|
};
|
|
25102
25085
|
}
|
|
25103
25086
|
function getOffsetInfoAfter(editor, block, offset) {
|
|
25104
|
-
assert(logger$
|
|
25105
|
-
assert(logger$
|
|
25106
|
-
assert(logger$
|
|
25087
|
+
assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
|
|
25088
|
+
assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
|
|
25089
|
+
assert(logger$3V, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25107
25090
|
const newOffset = getNextValidOffset(block, offset);
|
|
25108
25091
|
const length = newOffset - offset;
|
|
25109
25092
|
if (length === 0) {
|
|
25110
|
-
assert(logger$
|
|
25093
|
+
assert(logger$3V, false, `no text after offset: ${offset}`);
|
|
25111
25094
|
}
|
|
25112
25095
|
const text2 = editorGetBlockText(editor, block);
|
|
25113
25096
|
const { middle } = splitToThree(text2, offset, length);
|
|
25114
|
-
assert(logger$
|
|
25097
|
+
assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
|
|
25115
25098
|
const op = middle[0];
|
|
25116
25099
|
if (isBoxOp(op)) {
|
|
25117
25100
|
return {
|
|
@@ -25121,17 +25104,9 @@ var __publicField = (obj, key, value) => {
|
|
|
25121
25104
|
length: 1
|
|
25122
25105
|
};
|
|
25123
25106
|
}
|
|
25124
|
-
let charType = "text";
|
|
25125
|
-
if (isSpace(op.insert)) {
|
|
25126
|
-
charType = "space";
|
|
25127
|
-
} else if (isCJKPunctuation(op.insert)) {
|
|
25128
|
-
charType = "cjk_punctuation";
|
|
25129
|
-
} else if (isCJK(op.insert)) {
|
|
25130
|
-
charType = "cjk";
|
|
25131
|
-
}
|
|
25132
25107
|
return {
|
|
25133
25108
|
op,
|
|
25134
|
-
charType,
|
|
25109
|
+
charType: isSpace(op.insert) ? "space" : "text",
|
|
25135
25110
|
offset,
|
|
25136
25111
|
length: op.insert.length
|
|
25137
25112
|
};
|
|
@@ -25183,7 +25158,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25183
25158
|
return null;
|
|
25184
25159
|
}
|
|
25185
25160
|
function findWordLeft(editor, block, offset) {
|
|
25186
|
-
assert(logger$
|
|
25161
|
+
assert(logger$3V, isTextKindBlock(editor, block), "invalid blok type");
|
|
25187
25162
|
if (isEmptyTextBlock(editor, block)) {
|
|
25188
25163
|
return 0;
|
|
25189
25164
|
}
|
|
@@ -25192,7 +25167,6 @@ var __publicField = (obj, key, value) => {
|
|
|
25192
25167
|
return offset - 1;
|
|
25193
25168
|
}
|
|
25194
25169
|
let start = offset;
|
|
25195
|
-
let find = offsetInfo.charType;
|
|
25196
25170
|
if (offsetInfo.charType === "space") {
|
|
25197
25171
|
const startInfo2 = findPrevOffsetNotType(editor, block, start, "space");
|
|
25198
25172
|
if (!startInfo2) {
|
|
@@ -25205,15 +25179,14 @@ var __publicField = (obj, key, value) => {
|
|
|
25205
25179
|
return startInfo2.offset;
|
|
25206
25180
|
}
|
|
25207
25181
|
start = startInfo2.offset;
|
|
25208
|
-
find = getOffsetInfoBefore(editor, block, start).charType;
|
|
25209
25182
|
}
|
|
25210
|
-
const startInfo = findPrevOffsetNotType(editor, block, start,
|
|
25183
|
+
const startInfo = findPrevOffsetNotType(editor, block, start, "text");
|
|
25211
25184
|
if (!startInfo)
|
|
25212
25185
|
return 0;
|
|
25213
25186
|
return startInfo.offset + startInfo.length;
|
|
25214
25187
|
}
|
|
25215
25188
|
function findWordEnd(editor, block, offset) {
|
|
25216
|
-
assert(logger$
|
|
25189
|
+
assert(logger$3V, isTextKindBlock(editor, block), "invalid blok type");
|
|
25217
25190
|
if (isEmptyTextBlock(editor, block)) {
|
|
25218
25191
|
return 0;
|
|
25219
25192
|
}
|
|
@@ -25222,7 +25195,6 @@ var __publicField = (obj, key, value) => {
|
|
|
25222
25195
|
return offset + 1;
|
|
25223
25196
|
}
|
|
25224
25197
|
let start = offset;
|
|
25225
|
-
let find = offsetInfo.charType;
|
|
25226
25198
|
if (offsetInfo.charType === "space") {
|
|
25227
25199
|
const startInfo2 = findAfterOffsetNotType(editor, block, start, "space");
|
|
25228
25200
|
if (!startInfo2) {
|
|
@@ -25235,17 +25207,16 @@ var __publicField = (obj, key, value) => {
|
|
|
25235
25207
|
return startInfo2.offset;
|
|
25236
25208
|
}
|
|
25237
25209
|
start = startInfo2.offset;
|
|
25238
|
-
find = getOffsetInfoAfter(editor, block, start).charType;
|
|
25239
25210
|
}
|
|
25240
|
-
const startInfo = findAfterOffsetNotType(editor, block, start,
|
|
25211
|
+
const startInfo = findAfterOffsetNotType(editor, block, start, "text");
|
|
25241
25212
|
if (!startInfo)
|
|
25242
25213
|
return getBlockTextLength$6(editor, block);
|
|
25243
25214
|
return startInfo.offset;
|
|
25244
25215
|
}
|
|
25245
|
-
const logger$
|
|
25216
|
+
const logger$3U = getLogger("text-box");
|
|
25246
25217
|
function updateBoxContent$8(editor, boxElement, boxContent, boxData) {
|
|
25247
|
-
assert(logger$
|
|
25248
|
-
assert(logger$
|
|
25218
|
+
assert(logger$3U, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
|
|
25219
|
+
assert(logger$3U, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
|
|
25249
25220
|
createElement("span", [], boxContent, boxData.text);
|
|
25250
25221
|
}
|
|
25251
25222
|
function convertTo$j(editor, boxData, doc2, type) {
|
|
@@ -25279,7 +25250,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25279
25250
|
updateBoxContent: updateBoxContent$7,
|
|
25280
25251
|
convertTo: convertTo$i
|
|
25281
25252
|
};
|
|
25282
|
-
const logger$
|
|
25253
|
+
const logger$3T = getLogger("editor-boxes");
|
|
25283
25254
|
class EditorBoxes {
|
|
25284
25255
|
constructor(editor) {
|
|
25285
25256
|
__publicField(this, "boxes", /* @__PURE__ */ new Map());
|
|
@@ -25288,12 +25259,12 @@ var __publicField = (obj, key, value) => {
|
|
|
25288
25259
|
registerBoxClass(boxClass) {
|
|
25289
25260
|
const type = boxClass.boxType;
|
|
25290
25261
|
const exists = this.boxes.get(type);
|
|
25291
|
-
assert(logger$
|
|
25262
|
+
assert(logger$3T, !exists, `duplicated box type: ${type}`);
|
|
25292
25263
|
this.boxes.set(type, boxClass);
|
|
25293
25264
|
}
|
|
25294
25265
|
getBoxClass(type) {
|
|
25295
25266
|
const exists = this.boxes.get(type);
|
|
25296
|
-
assert(logger$
|
|
25267
|
+
assert(logger$3T, exists, `unknown box type: ${type}`);
|
|
25297
25268
|
return exists;
|
|
25298
25269
|
}
|
|
25299
25270
|
createBox(blockContent, box) {
|
|
@@ -25658,7 +25629,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25658
25629
|
return { classes, attributes: newAttributes, styles: newStyles };
|
|
25659
25630
|
}
|
|
25660
25631
|
}
|
|
25661
|
-
const logger$
|
|
25632
|
+
const logger$3S = getLogger("editor-insertion");
|
|
25662
25633
|
class EditorInsertions {
|
|
25663
25634
|
constructor(editor) {
|
|
25664
25635
|
__publicField(this, "insertions", /* @__PURE__ */ new Map());
|
|
@@ -25667,12 +25638,12 @@ var __publicField = (obj, key, value) => {
|
|
|
25667
25638
|
registerInsertionClass(insertionClass) {
|
|
25668
25639
|
const type = insertionClass.insertionType;
|
|
25669
25640
|
const exists = this.insertions.get(type);
|
|
25670
|
-
assert(logger$
|
|
25641
|
+
assert(logger$3S, !exists, `duplicated insertion type: ${type}`);
|
|
25671
25642
|
this.insertions.set(type, insertionClass);
|
|
25672
25643
|
}
|
|
25673
25644
|
getInsertionClass(type) {
|
|
25674
25645
|
const exists = this.insertions.get(type);
|
|
25675
|
-
assert(logger$
|
|
25646
|
+
assert(logger$3S, exists, `unknown insertion type: ${type}`);
|
|
25676
25647
|
return exists;
|
|
25677
25648
|
}
|
|
25678
25649
|
createInsertionElement(type, id, attributes) {
|
|
@@ -25792,7 +25763,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25792
25763
|
};
|
|
25793
25764
|
}
|
|
25794
25765
|
}
|
|
25795
|
-
const logger$
|
|
25766
|
+
const logger$3R = getLogger("editor-input");
|
|
25796
25767
|
class EditorInput$1 {
|
|
25797
25768
|
constructor(editor, callbacks) {
|
|
25798
25769
|
__publicField(this, "editor");
|
|
@@ -25914,7 +25885,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25914
25885
|
return;
|
|
25915
25886
|
}
|
|
25916
25887
|
this.callbacks.onCut(event);
|
|
25917
|
-
logger$
|
|
25888
|
+
logger$3R.debug("on cut");
|
|
25918
25889
|
});
|
|
25919
25890
|
__publicField(this, "handlePaste", (event) => {
|
|
25920
25891
|
if (event.isTrusted) {
|
|
@@ -26029,11 +26000,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26029
26000
|
this.callbacks.removeHandler(handler);
|
|
26030
26001
|
}
|
|
26031
26002
|
defaultInsertText(editor, containerId, blockIndex, offset, text2) {
|
|
26032
|
-
assert(logger$
|
|
26003
|
+
assert(logger$3R, editor === this.editor, "invalid editor");
|
|
26033
26004
|
this.callbacks.defaultInsertText(editor, containerId, blockIndex, offset, text2);
|
|
26034
26005
|
}
|
|
26035
26006
|
defaultHandleKeydown(editor, event) {
|
|
26036
|
-
assert(logger$
|
|
26007
|
+
assert(logger$3R, editor === this.editor, "invalid editor");
|
|
26037
26008
|
return this.callbacks.defaultHandleKeydown(editor, event);
|
|
26038
26009
|
}
|
|
26039
26010
|
forEach(callback) {
|
|
@@ -26058,7 +26029,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26058
26029
|
input2.style.left = `${x / scale}px`;
|
|
26059
26030
|
input2.style.top = `${y / scale}px`;
|
|
26060
26031
|
}
|
|
26061
|
-
const logger$
|
|
26032
|
+
const logger$3Q = getLogger("editor-caret");
|
|
26062
26033
|
function getFirefoxVersion() {
|
|
26063
26034
|
const userAgent = window.navigator.userAgent;
|
|
26064
26035
|
const match = userAgent.match(/Firefox\/(\d+)\./);
|
|
@@ -26121,11 +26092,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26121
26092
|
return;
|
|
26122
26093
|
}
|
|
26123
26094
|
const { range } = this.editor.selection;
|
|
26124
|
-
assert(logger$
|
|
26095
|
+
assert(logger$3Q, range.isCollapsed, "range is not collapsed");
|
|
26125
26096
|
const pos = range.start;
|
|
26126
|
-
assert(logger$
|
|
26097
|
+
assert(logger$3Q, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
|
|
26127
26098
|
const block = this.editor.getBlockById(pos.blockId);
|
|
26128
|
-
assert(logger$
|
|
26099
|
+
assert(logger$3Q, isTextKindBlock(this.editor, block), "only text kind block can has caret");
|
|
26129
26100
|
let rect;
|
|
26130
26101
|
const compositionSpan = block.querySelector("span.inputting-insertion");
|
|
26131
26102
|
if (compositionSpan) {
|
|
@@ -26163,7 +26134,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26163
26134
|
clearAllSelection(editor);
|
|
26164
26135
|
editor.selection.range.getSelectedBlocks().forEach((s) => updateBlockSelection(editor, s.block, s.start, s.end));
|
|
26165
26136
|
}
|
|
26166
|
-
const logger$
|
|
26137
|
+
const logger$3P = getLogger("editor-dom");
|
|
26167
26138
|
function editorGetClientHeight(editor) {
|
|
26168
26139
|
const scrollContainer = getScrollContainer$1(editor.rootContainer);
|
|
26169
26140
|
return scrollContainer.clientHeight;
|
|
@@ -26251,7 +26222,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26251
26222
|
}
|
|
26252
26223
|
function editorScrollIntoView(editor) {
|
|
26253
26224
|
if (!isElementVisible(editor.rootContainer)) {
|
|
26254
|
-
logger$
|
|
26225
|
+
logger$3P.warn("editorScrollIntoView: editor is not visible");
|
|
26255
26226
|
return;
|
|
26256
26227
|
}
|
|
26257
26228
|
const rootClientRect = editor.rootContainer.getBoundingClientRect();
|
|
@@ -26316,7 +26287,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26316
26287
|
const { start, end } = range;
|
|
26317
26288
|
return start.blockId === getBlockId(firstChildBlock) && start.offset === 0 && end.blockId === getBlockId(lastChildBlock) && end.offset === getBlockTextLength$6(editor, lastChildBlock);
|
|
26318
26289
|
}
|
|
26319
|
-
const logger$
|
|
26290
|
+
const logger$3O = getLogger("range-in-block");
|
|
26320
26291
|
function rangeInBlock(block, range) {
|
|
26321
26292
|
const editor = range.getEditor();
|
|
26322
26293
|
const start = editor.getBlockById(range.start.blockId);
|
|
@@ -26337,16 +26308,16 @@ var __publicField = (obj, key, value) => {
|
|
|
26337
26308
|
while (prevBlock && !blocks.has(getBlockId(prevBlock))) {
|
|
26338
26309
|
prevBlock = getPrevVisibleBlock(prevBlock);
|
|
26339
26310
|
}
|
|
26340
|
-
assert(logger$
|
|
26311
|
+
assert(logger$3O, prevBlock, "no prev block while deleting a block");
|
|
26341
26312
|
newRange = createBlockSimpleRange(editor, prevBlock, getBlockTextLength$6(editor, prevBlock));
|
|
26342
26313
|
} else {
|
|
26343
26314
|
const nextBlock = getNextVisibleBlock(block);
|
|
26344
|
-
assert(logger$
|
|
26315
|
+
assert(logger$3O, nextBlock, "no prev and next block while deleting a block");
|
|
26345
26316
|
newRange = createBlockSimpleRange(editor, nextBlock, 0);
|
|
26346
26317
|
}
|
|
26347
26318
|
return newRange;
|
|
26348
26319
|
}
|
|
26349
|
-
const logger$
|
|
26320
|
+
const logger$3N = getLogger("block-to-html");
|
|
26350
26321
|
function blockToHtml(editor, blockData, doc2, path) {
|
|
26351
26322
|
const blockClass = getBlockClassByType(editor, blockData.type);
|
|
26352
26323
|
if (blockClass.convertTo) {
|
|
@@ -26355,15 +26326,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26355
26326
|
if (blockClass.blockKind !== "text") {
|
|
26356
26327
|
return `[${blockData.type}]`;
|
|
26357
26328
|
}
|
|
26358
|
-
assert(logger$
|
|
26329
|
+
assert(logger$3N, blockData.text, "no text");
|
|
26359
26330
|
const plainText = toPlainText(blockData.text);
|
|
26360
26331
|
return `<div>${escapeHtmlText(plainText)}</div>`;
|
|
26361
26332
|
}
|
|
26362
|
-
const logger$
|
|
26333
|
+
const logger$3M = getLogger("block-to-text");
|
|
26363
26334
|
function textBlockToText(editor, ops, doc2) {
|
|
26364
26335
|
let text2 = "";
|
|
26365
26336
|
ops.forEach((op) => {
|
|
26366
|
-
assert(logger$
|
|
26337
|
+
assert(logger$3M, typeof op.insert === "string", "invalid op");
|
|
26367
26338
|
if (op.attributes && op.attributes.box === true) {
|
|
26368
26339
|
const box = op.attributes;
|
|
26369
26340
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -26389,7 +26360,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26389
26360
|
if (blockClass.blockKind !== "text") {
|
|
26390
26361
|
return `[${blockData.type}]`;
|
|
26391
26362
|
}
|
|
26392
|
-
assert(logger$
|
|
26363
|
+
assert(logger$3M, blockData.text, "no text");
|
|
26393
26364
|
const plainText = textBlockToText(editor, blockData.text, doc2);
|
|
26394
26365
|
return plainText;
|
|
26395
26366
|
}
|
|
@@ -26422,11 +26393,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26422
26393
|
const markdown = lines.join("\n");
|
|
26423
26394
|
return markdown;
|
|
26424
26395
|
}
|
|
26425
|
-
const logger$
|
|
26396
|
+
const logger$3L = getLogger("get-text-position");
|
|
26426
26397
|
function editorGetTextPosition(editor, insertPos) {
|
|
26427
26398
|
const pos = insertPos != null ? insertPos : editor.selection.range.start;
|
|
26428
26399
|
if (!(pos instanceof EditorSimpleBlockPosition)) {
|
|
26429
|
-
assert(logger$
|
|
26400
|
+
assert(logger$3L, false, `invalid insert pos type: ${typeof pos}`);
|
|
26430
26401
|
}
|
|
26431
26402
|
const { blockId } = pos;
|
|
26432
26403
|
const block = editor.getBlockById(blockId);
|
|
@@ -26514,14 +26485,14 @@ var __publicField = (obj, key, value) => {
|
|
|
26514
26485
|
return attributes;
|
|
26515
26486
|
}
|
|
26516
26487
|
}
|
|
26517
|
-
const logger$
|
|
26488
|
+
const logger$3K = getLogger("insert-text");
|
|
26518
26489
|
function getTextAttributes(editor, containerId, blockIndex, offset) {
|
|
26519
26490
|
var _a, _b;
|
|
26520
26491
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26521
|
-
assert(logger$
|
|
26522
|
-
assert(logger$
|
|
26492
|
+
assert(logger$3K, blockData, "no block data");
|
|
26493
|
+
assert(logger$3K, blockData.text, "no block text");
|
|
26523
26494
|
if (getTextLength(blockData.text) === 0) {
|
|
26524
|
-
assert(logger$
|
|
26495
|
+
assert(logger$3K, offset === 0, "invalid text offset");
|
|
26525
26496
|
return BlockAttributesHandler.get(editor).getEmptyBlockTextAttributes(blockData.id);
|
|
26526
26497
|
}
|
|
26527
26498
|
if (offset === 0) {
|
|
@@ -26568,7 +26539,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26568
26539
|
}
|
|
26569
26540
|
for (let i = 0; i < text2.length; i++) {
|
|
26570
26541
|
const op = text2[i];
|
|
26571
|
-
assert(logger$
|
|
26542
|
+
assert(logger$3K, typeof op.insert === "string", "invalid text op, no insert");
|
|
26572
26543
|
const endPos = pos + getOpLength(op);
|
|
26573
26544
|
if (endPos === start) {
|
|
26574
26545
|
return false;
|
|
@@ -26582,8 +26553,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26582
26553
|
}
|
|
26583
26554
|
function editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset) {
|
|
26584
26555
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26585
|
-
assert(logger$
|
|
26586
|
-
assert(logger$
|
|
26556
|
+
assert(logger$3K, blockData, "no block data");
|
|
26557
|
+
assert(logger$3K, blockData.text, "no block text");
|
|
26587
26558
|
const attributes = getTextAttributes(editor, containerId, blockIndex, offset);
|
|
26588
26559
|
if (attributes && Object.keys(attributes).includes("link")) {
|
|
26589
26560
|
const inOp = checkRangeInOp(blockData.text, offset);
|
|
@@ -26602,21 +26573,21 @@ var __publicField = (obj, key, value) => {
|
|
|
26602
26573
|
const { containerId, blockIndex, offset } = editorGetTextPosition(editor);
|
|
26603
26574
|
editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset);
|
|
26604
26575
|
}
|
|
26605
|
-
const logger$
|
|
26576
|
+
const logger$3J = getLogger("update-composition-text");
|
|
26606
26577
|
function editorUpdateCompositionText(editor) {
|
|
26607
26578
|
const pos = editor.selection.range.start;
|
|
26608
26579
|
if (!(pos instanceof EditorSimpleBlockPosition)) {
|
|
26609
|
-
assert(logger$
|
|
26580
|
+
assert(logger$3J, false, `invalid insert pos type: ${typeof pos}`);
|
|
26610
26581
|
}
|
|
26611
26582
|
const { blockId } = pos;
|
|
26612
26583
|
const block = editor.getBlockById(blockId);
|
|
26613
|
-
assert(logger$
|
|
26584
|
+
assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
|
|
26614
26585
|
const container = getParentContainer(block);
|
|
26615
26586
|
const containerId = getContainerId(container);
|
|
26616
26587
|
const blockIndex = getBlockIndex(block);
|
|
26617
26588
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26618
|
-
assert(logger$
|
|
26619
|
-
assert(logger$
|
|
26589
|
+
assert(logger$3J, blockData, "no block data in doc");
|
|
26590
|
+
assert(logger$3J, blockData.text, "no text data in text block");
|
|
26620
26591
|
const blockContent = getBlockContent(block);
|
|
26621
26592
|
updateBlockContent$1(editor, getBlockPath(block), blockId, blockContent, blockData.text);
|
|
26622
26593
|
}
|
|
@@ -26628,25 +26599,25 @@ var __publicField = (obj, key, value) => {
|
|
|
26628
26599
|
const block = editor.getBlockById(blockData.id);
|
|
26629
26600
|
return block;
|
|
26630
26601
|
}
|
|
26631
|
-
const logger$
|
|
26602
|
+
const logger$3I = getLogger("delete-block-text");
|
|
26632
26603
|
function editorDeleteBlockText(editor, block, offset, count, options) {
|
|
26633
26604
|
if (!editor.isBlockWritable(block)) {
|
|
26634
|
-
logger$
|
|
26605
|
+
logger$3I.error("block is not writable");
|
|
26635
26606
|
return 0;
|
|
26636
26607
|
}
|
|
26637
|
-
assert(logger$
|
|
26608
|
+
assert(logger$3I, isTextKindBlock(editor, block), "block is not a text kind block");
|
|
26638
26609
|
const container = getParentContainer(block);
|
|
26639
26610
|
const containerId = getContainerId(container);
|
|
26640
26611
|
const blockIndex = getBlockIndex(block);
|
|
26641
26612
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26642
|
-
assert(logger$
|
|
26643
|
-
assert(logger$
|
|
26613
|
+
assert(logger$3I, blockData, "no block data in doc");
|
|
26614
|
+
assert(logger$3I, blockData.text, "no text data in text block");
|
|
26644
26615
|
let from = offset;
|
|
26645
26616
|
if (!isValidOffset(block, offset)) {
|
|
26646
26617
|
from = getPrevValidOffset(block, from);
|
|
26647
26618
|
}
|
|
26648
26619
|
let to = offset + count;
|
|
26649
|
-
assert(logger$
|
|
26620
|
+
assert(logger$3I, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
|
|
26650
26621
|
if (!isValidOffset(block, to)) {
|
|
26651
26622
|
to = getNextValidOffset(block, to);
|
|
26652
26623
|
}
|
|
@@ -26655,7 +26626,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26655
26626
|
editor.doc.localUpdateBlockText(containerId, blockIndex, actions2, options);
|
|
26656
26627
|
return deleteCount;
|
|
26657
26628
|
}
|
|
26658
|
-
const logger$
|
|
26629
|
+
const logger$3H = getLogger("break-text-block");
|
|
26659
26630
|
function copyBlockAttributes(editor, block) {
|
|
26660
26631
|
const blockData = editor.getBlockData(block);
|
|
26661
26632
|
const quoted = blockData.quoted;
|
|
@@ -26667,8 +26638,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26667
26638
|
return {};
|
|
26668
26639
|
}
|
|
26669
26640
|
function editorBreakTextBlock(editor, block, offset, options) {
|
|
26670
|
-
assert(logger$
|
|
26671
|
-
assert(logger$
|
|
26641
|
+
assert(logger$3H, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
|
|
26642
|
+
assert(logger$3H, offset >= 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
26672
26643
|
const container = getParentContainer(block);
|
|
26673
26644
|
const containerId = getContainerId(container);
|
|
26674
26645
|
const blockIndex = getBlockIndex(block);
|
|
@@ -26698,7 +26669,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26698
26669
|
};
|
|
26699
26670
|
}
|
|
26700
26671
|
}
|
|
26701
|
-
assert(logger$
|
|
26672
|
+
assert(logger$3H, isValidOffset(block, offset), "not a valid offset");
|
|
26702
26673
|
const text2 = editorGetBlockText(editor, block);
|
|
26703
26674
|
const { right } = splitText(text2, offset);
|
|
26704
26675
|
const rightLength = getTextLength(right);
|
|
@@ -26724,12 +26695,12 @@ var __publicField = (obj, key, value) => {
|
|
|
26724
26695
|
newBlock
|
|
26725
26696
|
};
|
|
26726
26697
|
}
|
|
26727
|
-
const logger$
|
|
26698
|
+
const logger$3G = getLogger("prepare-insert-new-block");
|
|
26728
26699
|
function editorPrepareInsertNewBlock(editor, containerId, blockIndex) {
|
|
26729
26700
|
if (containerId && blockIndex !== void 0 && blockIndex !== null) {
|
|
26730
26701
|
const container = editor.getContainerById(containerId);
|
|
26731
26702
|
const blocks = getChildBlocks(container);
|
|
26732
|
-
assert(logger$
|
|
26703
|
+
assert(logger$3G, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
|
|
26733
26704
|
return {
|
|
26734
26705
|
containerId,
|
|
26735
26706
|
blockIndex
|
|
@@ -26763,15 +26734,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26763
26734
|
blockIndex: getBlockIndex(newBlock)
|
|
26764
26735
|
};
|
|
26765
26736
|
}
|
|
26766
|
-
const logger$
|
|
26737
|
+
const logger$3F = getLogger("auto-insert-block");
|
|
26767
26738
|
function editorAutoInsertBlock(editor, blockData, containerId, blockIndex, newRange, insertBlockOptions) {
|
|
26768
26739
|
const result = editorPrepareInsertNewBlock(editor, containerId, blockIndex);
|
|
26769
|
-
assert(logger$
|
|
26740
|
+
assert(logger$3F, result, `not an valid insert position: ${editor.selection.range}`);
|
|
26770
26741
|
const defaultPos = { blockId: blockData.id, offset: 0 };
|
|
26771
26742
|
const defaultRange = { anchor: defaultPos, focus: defaultPos };
|
|
26772
26743
|
return editorInsertBlock(editor, result.containerId, result.blockIndex, blockData, newRange != null ? newRange : defaultRange, insertBlockOptions);
|
|
26773
26744
|
}
|
|
26774
|
-
const logger$
|
|
26745
|
+
const logger$3E = getLogger("delete-block");
|
|
26775
26746
|
function getAllChildContainers(editor, blockData, containerIds) {
|
|
26776
26747
|
if (blockData.children) {
|
|
26777
26748
|
containerIds.push(...blockData.children);
|
|
@@ -26788,7 +26759,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26788
26759
|
const containerId = getContainerId(container);
|
|
26789
26760
|
const blockIndex = getBlockIndex(block);
|
|
26790
26761
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26791
|
-
assert(logger$
|
|
26762
|
+
assert(logger$3E, blockData, "no block data in doc");
|
|
26792
26763
|
editor.doc.localDeleteBlock(containerId, blockIndex, createEditorSelectionRange(editor, { anchor: newRange.start, focus: newRange.end }));
|
|
26793
26764
|
return blockData;
|
|
26794
26765
|
}
|
|
@@ -26834,15 +26805,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26834
26805
|
});
|
|
26835
26806
|
editor.doc.localDeleteChildContainers(containerIds);
|
|
26836
26807
|
}
|
|
26837
|
-
const logger$
|
|
26808
|
+
const logger$3D = getLogger("merge-text-block");
|
|
26838
26809
|
function editorMergeTextBlock(editor, block1, block2) {
|
|
26839
|
-
assert(logger$
|
|
26840
|
-
assert(logger$
|
|
26810
|
+
assert(logger$3D, isTextKindBlock(editor, block1), "only text block can be merged");
|
|
26811
|
+
assert(logger$3D, isTextKindBlock(editor, block2), "only text block can be merged");
|
|
26841
26812
|
const data1 = editorGetBlockData(editor, block1);
|
|
26842
26813
|
const data2 = editorGetBlockData(editor, block2);
|
|
26843
26814
|
const text1 = data1.text;
|
|
26844
26815
|
const text2 = data2.text;
|
|
26845
|
-
assert(logger$
|
|
26816
|
+
assert(logger$3D, text1 && text2, "block data has no text");
|
|
26846
26817
|
const container = getParentContainer(block1);
|
|
26847
26818
|
const containerId = getContainerId(container);
|
|
26848
26819
|
const blockIndex = getBlockIndex(block1);
|
|
@@ -26852,15 +26823,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26852
26823
|
editorDeleteBlock(editor, block2, newRange);
|
|
26853
26824
|
return block;
|
|
26854
26825
|
}
|
|
26855
|
-
const logger$
|
|
26826
|
+
const logger$3C = getLogger("clear-selected-contents");
|
|
26856
26827
|
function deleteTextBlockSelection(editor, selectedBlock) {
|
|
26857
|
-
assert(logger$
|
|
26828
|
+
assert(logger$3C, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
|
|
26858
26829
|
const { start, end } = selectedBlock;
|
|
26859
|
-
assert(logger$
|
|
26860
|
-
assert(logger$
|
|
26830
|
+
assert(logger$3C, start.isSimple(), "not a simple block position");
|
|
26831
|
+
assert(logger$3C, end.isSimple(), "not a simple block position");
|
|
26861
26832
|
const startOffset = start.offset;
|
|
26862
26833
|
const endOffset = end.offset;
|
|
26863
|
-
assert(logger$
|
|
26834
|
+
assert(logger$3C, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
|
|
26864
26835
|
if (startOffset === endOffset) {
|
|
26865
26836
|
return;
|
|
26866
26837
|
}
|
|
@@ -26885,7 +26856,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26885
26856
|
return;
|
|
26886
26857
|
}
|
|
26887
26858
|
if (isEmbedBlock(block) || start.isSimple()) {
|
|
26888
|
-
assert(logger$
|
|
26859
|
+
assert(logger$3C, end.isSimple(), "invalid range");
|
|
26889
26860
|
const container = getParentContainer(block);
|
|
26890
26861
|
const blockIndex = getBlockIndex(block);
|
|
26891
26862
|
const newBlock = editor.insertTextBlock("", getContainerId(container), blockIndex);
|
|
@@ -26893,8 +26864,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26893
26864
|
editor.deleteBlock(block);
|
|
26894
26865
|
return;
|
|
26895
26866
|
}
|
|
26896
|
-
assert(logger$
|
|
26897
|
-
assert(logger$
|
|
26867
|
+
assert(logger$3C, isComplexKindBlock(editor, block), "invalid block kind");
|
|
26868
|
+
assert(logger$3C, !start.isSimple() && !end.isSimple(), "invalid range");
|
|
26898
26869
|
complexBlockGetSelectedContainers(editor, block, start, end);
|
|
26899
26870
|
const containers = editor.selection.range.getSelectedContainers();
|
|
26900
26871
|
containers.forEach((container, index2) => {
|
|
@@ -26911,7 +26882,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26911
26882
|
return;
|
|
26912
26883
|
}
|
|
26913
26884
|
const selectedBlocks = range.getSelectedBlocks();
|
|
26914
|
-
assert(logger$
|
|
26885
|
+
assert(logger$3C, selectedBlocks.length > 0, "no selected block");
|
|
26915
26886
|
if (selectedBlocks.length === 1) {
|
|
26916
26887
|
clearOneBlock(editor, selectedBlocks[0]);
|
|
26917
26888
|
return;
|
|
@@ -26919,7 +26890,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26919
26890
|
const firstSelectedBlock = selectedBlocks[0];
|
|
26920
26891
|
const firstBlock = firstSelectedBlock.block;
|
|
26921
26892
|
const container = getParentContainer(firstBlock);
|
|
26922
|
-
assert(logger$
|
|
26893
|
+
assert(logger$3C, selectedBlocks.length > 1, "no selected block");
|
|
26923
26894
|
const lastSelectedBlock = selectedBlocks[selectedBlocks.length - 1];
|
|
26924
26895
|
const lastBlock2 = lastSelectedBlock.block;
|
|
26925
26896
|
if (isTextKindBlock(editor, firstBlock)) {
|
|
@@ -26949,7 +26920,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26949
26920
|
}
|
|
26950
26921
|
const prevBlock = getPrevBlock(firstBlock);
|
|
26951
26922
|
const nextBlock = getNextBlock(lastBlock2);
|
|
26952
|
-
assert(logger$
|
|
26923
|
+
assert(logger$3C, prevBlock || nextBlock, "no prev or next block");
|
|
26953
26924
|
selectedBlocks.forEach((selectedBlock) => editor.deleteBlock(selectedBlock.block));
|
|
26954
26925
|
}
|
|
26955
26926
|
function editorClearSelectedContents(editor, selectionRange) {
|
|
@@ -26968,7 +26939,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26968
26939
|
editor.emit("afterClearSelection", editor);
|
|
26969
26940
|
});
|
|
26970
26941
|
}
|
|
26971
|
-
const logger$
|
|
26942
|
+
const logger$3B = getLogger("core");
|
|
26972
26943
|
function editorUpdateBlockText(editor, block, ops, options) {
|
|
26973
26944
|
const container = getParentContainer(block);
|
|
26974
26945
|
const containerId = getContainerId(container);
|
|
@@ -26981,7 +26952,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26981
26952
|
}
|
|
26982
26953
|
function editorSetBlockText(editor, block, newText, options) {
|
|
26983
26954
|
if (!editor.isBlockWritable(block)) {
|
|
26984
|
-
logger$
|
|
26955
|
+
logger$3B.error("block is not writable");
|
|
26985
26956
|
return;
|
|
26986
26957
|
}
|
|
26987
26958
|
const oldText = editor.getBlockText(block);
|
|
@@ -26994,7 +26965,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26994
26965
|
const ops = RichText.diff(oldText, newText);
|
|
26995
26966
|
return editorUpdateBlockText(editor, block, ops);
|
|
26996
26967
|
}
|
|
26997
|
-
const logger$
|
|
26968
|
+
const logger$3A = getLogger("update-block-data");
|
|
26998
26969
|
function editorUpdateBlockData(editor, block, data2, newRange, options) {
|
|
26999
26970
|
const container = getParentContainer(block);
|
|
27000
26971
|
const containerId = getContainerId(container);
|
|
@@ -27011,17 +26982,17 @@ var __publicField = (obj, key, value) => {
|
|
|
27011
26982
|
if (oldKey === "id" || oldKey === "type" || oldKey === "text") {
|
|
27012
26983
|
return;
|
|
27013
26984
|
}
|
|
27014
|
-
logger$
|
|
26985
|
+
logger$3A.debug(`delete key: ${oldKey}`);
|
|
27015
26986
|
delta.delete.push(oldKey);
|
|
27016
26987
|
}
|
|
27017
26988
|
});
|
|
27018
26989
|
const entries = Object.entries(data2);
|
|
27019
26990
|
entries.forEach(([key, value]) => {
|
|
27020
|
-
assert(logger$
|
|
26991
|
+
assert(logger$3A, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
|
|
27021
26992
|
const oldValue = oldData[key];
|
|
27022
26993
|
if (value === null || value === void 0) {
|
|
27023
26994
|
if (oldValue !== null && oldValue !== void 0) {
|
|
27024
|
-
logger$
|
|
26995
|
+
logger$3A.debug(`delete key: ${key}`);
|
|
27025
26996
|
delta.delete.push(key);
|
|
27026
26997
|
}
|
|
27027
26998
|
return;
|
|
@@ -27039,10 +27010,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27039
27010
|
}
|
|
27040
27011
|
}
|
|
27041
27012
|
if (oldKeys.has(key)) {
|
|
27042
|
-
logger$
|
|
27013
|
+
logger$3A.debug(`replace key: ${key}`);
|
|
27043
27014
|
delta.delete.push(key);
|
|
27044
27015
|
} else {
|
|
27045
|
-
logger$
|
|
27016
|
+
logger$3A.debug(`insert key: ${key}`);
|
|
27046
27017
|
}
|
|
27047
27018
|
delta.insert[key] = value;
|
|
27048
27019
|
});
|
|
@@ -27087,13 +27058,13 @@ var __publicField = (obj, key, value) => {
|
|
|
27087
27058
|
comments: {}
|
|
27088
27059
|
};
|
|
27089
27060
|
}
|
|
27090
|
-
const logger$
|
|
27061
|
+
const logger$3z = getLogger("clone-block");
|
|
27091
27062
|
function cloneBlock(editorBlocks, oldDoc, data2, info) {
|
|
27092
27063
|
var _a;
|
|
27093
27064
|
const blockClass = editorBlocks.getBlockClass(data2.type);
|
|
27094
27065
|
if (blockClass.blockToDoc) {
|
|
27095
27066
|
return blockClass.blockToDoc(oldDoc, data2, (oldDoc2, childBlock) => {
|
|
27096
|
-
assert(logger$
|
|
27067
|
+
assert(logger$3z, data2 !== childBlock, "invalid child block");
|
|
27097
27068
|
return cloneBlock(editorBlocks, oldDoc2, data2, info);
|
|
27098
27069
|
}, info);
|
|
27099
27070
|
}
|
|
@@ -27106,7 +27077,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27106
27077
|
}
|
|
27107
27078
|
const newChildContainerId = genId();
|
|
27108
27079
|
const childBlocks = oldDoc.blocks[oldChildContainerId];
|
|
27109
|
-
assert(logger$
|
|
27080
|
+
assert(logger$3z, Array.isArray(childBlocks), "invalid child blocks");
|
|
27110
27081
|
const newDocs = childBlocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
|
|
27111
27082
|
const newDoc = mergeDocs(newDocs);
|
|
27112
27083
|
const { root: root2, ...childContainersData } = newDoc.blocks;
|
|
@@ -27135,7 +27106,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27135
27106
|
if (key.startsWith(prefix1)) {
|
|
27136
27107
|
const keyContent = key.substring(prefix1.length);
|
|
27137
27108
|
const newKey = `${newContainerId}/${keyContent}`;
|
|
27138
|
-
logger$
|
|
27109
|
+
logger$3z.debug(`replace key: ${key} -> ${newKey}`);
|
|
27139
27110
|
return newKey;
|
|
27140
27111
|
}
|
|
27141
27112
|
}
|
|
@@ -27144,7 +27115,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27144
27115
|
if (key.startsWith(prefix2)) {
|
|
27145
27116
|
const keyContent = key.substring(prefix2.length);
|
|
27146
27117
|
const newKey = `${newContainerId}_${keyContent}`;
|
|
27147
|
-
logger$
|
|
27118
|
+
logger$3z.debug(`replace key: ${key} -> ${newKey}`);
|
|
27148
27119
|
return newKey;
|
|
27149
27120
|
}
|
|
27150
27121
|
}
|
|
@@ -27174,7 +27145,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27174
27145
|
}
|
|
27175
27146
|
function cloneChildContainer(editorBlocks, oldDoc, containerId, info) {
|
|
27176
27147
|
const blocks = oldDoc.blocks[containerId];
|
|
27177
|
-
assert(logger$
|
|
27148
|
+
assert(logger$3z, Array.isArray(blocks), "invalid child blocks");
|
|
27178
27149
|
const newDocs = blocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
|
|
27179
27150
|
const newDoc = mergeDocs(newDocs);
|
|
27180
27151
|
return newDoc;
|
|
@@ -27183,10 +27154,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27183
27154
|
const docs = doc2.blocks.root.map((b) => cloneBlock(editor.editorBlocks, doc2, b, info));
|
|
27184
27155
|
return cloneDeep__default.default(mergeDocs(docs));
|
|
27185
27156
|
}
|
|
27186
|
-
const logger$
|
|
27157
|
+
const logger$3y = getLogger("insert-doc");
|
|
27187
27158
|
function editorInsertDoc(editor, block, offset, insertedDoc, cloneDocResult) {
|
|
27188
27159
|
if (isComplexKindBlock(editor, block)) {
|
|
27189
|
-
logger$
|
|
27160
|
+
logger$3y.warn("failed to insert doc into a complex block");
|
|
27190
27161
|
return;
|
|
27191
27162
|
}
|
|
27192
27163
|
const doc2 = cloneDoc(editor, insertedDoc, cloneDocResult);
|
|
@@ -27220,7 +27191,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27220
27191
|
}
|
|
27221
27192
|
return;
|
|
27222
27193
|
}
|
|
27223
|
-
assert(logger$
|
|
27194
|
+
assert(logger$3y, isTextKindBlock(editor, block), "not a text block");
|
|
27224
27195
|
if (isEmptyTextBlock(editor, block)) {
|
|
27225
27196
|
const blockIndex2 = getBlockIndex(block);
|
|
27226
27197
|
let lastBlock22;
|
|
@@ -27352,11 +27323,11 @@ var __publicField = (obj, key, value) => {
|
|
|
27352
27323
|
editor.deleteBlock(block);
|
|
27353
27324
|
}
|
|
27354
27325
|
}
|
|
27355
|
-
const logger$
|
|
27326
|
+
const logger$3x = getLogger("add-text-attribute");
|
|
27356
27327
|
function editorRemoveTextAttribute(editor, block, range, attributeName) {
|
|
27357
27328
|
const { start, end } = range;
|
|
27358
|
-
assert(logger$
|
|
27359
|
-
assert(logger$
|
|
27329
|
+
assert(logger$3x, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
27330
|
+
assert(logger$3x, attributeName, "invalid attribute name");
|
|
27360
27331
|
const oldText = editor.getBlockText(block);
|
|
27361
27332
|
const newText = rangeRemoveAttribute(start.offset, end.offset - start.offset, oldText, attributeName, void 0, { ignoreValue: true });
|
|
27362
27333
|
editor.setBlockText(block, newText);
|
|
@@ -27364,8 +27335,8 @@ var __publicField = (obj, key, value) => {
|
|
|
27364
27335
|
}
|
|
27365
27336
|
function editorAddTextAttribute(editor, block, range, attributeName, value) {
|
|
27366
27337
|
const { start, end } = range;
|
|
27367
|
-
assert(logger$
|
|
27368
|
-
assert(logger$
|
|
27338
|
+
assert(logger$3x, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
27339
|
+
assert(logger$3x, attributeName, "invalid attribute name");
|
|
27369
27340
|
const oldText = editor.getBlockText(block);
|
|
27370
27341
|
const newText = rangeAddAttribute(start.offset, end.offset - start.offset, oldText, attributeName, value);
|
|
27371
27342
|
editor.setBlockText(block, newText);
|
|
@@ -27373,7 +27344,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27373
27344
|
}
|
|
27374
27345
|
function editorSetTextColor(editor, block, range, type, value) {
|
|
27375
27346
|
const { start, end } = range;
|
|
27376
|
-
assert(logger$
|
|
27347
|
+
assert(logger$3x, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
27377
27348
|
const oldText = editor.getBlockText(block);
|
|
27378
27349
|
const newText = rangeSetTextColor(start.offset, end.offset - start.offset, oldText, type, value);
|
|
27379
27350
|
editor.setBlockText(block, newText);
|
|
@@ -27462,10 +27433,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27462
27433
|
});
|
|
27463
27434
|
return [color, backgroundColor];
|
|
27464
27435
|
}
|
|
27465
|
-
const logger$
|
|
27436
|
+
const logger$3w = getLogger("move-complex-block-position");
|
|
27466
27437
|
function moveComplexBlockPosition(editor, old, type) {
|
|
27467
27438
|
const block = editor.getBlockById(old.blockId);
|
|
27468
|
-
assert(logger$
|
|
27439
|
+
assert(logger$3w, isComplexKindBlock(editor, block), "is not a complex block");
|
|
27469
27440
|
const blockClass = getComplexBlockClass(editor, block);
|
|
27470
27441
|
const focusedContainer = editor.getContainerById(old.childContainerId);
|
|
27471
27442
|
const nextContainer = blockClass.getNextContainer(editor, block, focusedContainer, type, { noWrap: true });
|
|
@@ -27474,24 +27445,24 @@ var __publicField = (obj, key, value) => {
|
|
|
27474
27445
|
}
|
|
27475
27446
|
return createComplexBlockPosition(block, getContainerId(nextContainer));
|
|
27476
27447
|
}
|
|
27477
|
-
const logger$
|
|
27448
|
+
const logger$3v = getLogger("move-simple-block-position");
|
|
27478
27449
|
function getFirstChildBlockInComplexBlock(editor, complexBlock) {
|
|
27479
27450
|
const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
|
|
27480
27451
|
if (containers.length === 0) {
|
|
27481
|
-
logger$
|
|
27452
|
+
logger$3v.warn("complex block has not any child container, not loaded?");
|
|
27482
27453
|
return null;
|
|
27483
27454
|
}
|
|
27484
|
-
assert(logger$
|
|
27455
|
+
assert(logger$3v, containers.length > 0, "complex block has not any child container");
|
|
27485
27456
|
const container = containers[0];
|
|
27486
27457
|
return getFirstChildBlock(container);
|
|
27487
27458
|
}
|
|
27488
27459
|
function getLastChildBlockInComplexBlock(editor, complexBlock) {
|
|
27489
27460
|
const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
|
|
27490
27461
|
if (containers.length === 0) {
|
|
27491
|
-
logger$
|
|
27462
|
+
logger$3v.warn("complex block has not any child container, not loaded?");
|
|
27492
27463
|
return null;
|
|
27493
27464
|
}
|
|
27494
|
-
assert(logger$
|
|
27465
|
+
assert(logger$3v, containers.length > 0, "complex block has not any child container");
|
|
27495
27466
|
const container = containers[containers.length - 1];
|
|
27496
27467
|
return getLastChildBlock(container);
|
|
27497
27468
|
}
|
|
@@ -27536,8 +27507,8 @@ var __publicField = (obj, key, value) => {
|
|
|
27536
27507
|
return null;
|
|
27537
27508
|
}
|
|
27538
27509
|
const parentComplexBlock = getParentBlock(container);
|
|
27539
|
-
assert(logger$
|
|
27540
|
-
assert(logger$
|
|
27510
|
+
assert(logger$3v, parentComplexBlock, "child container has not parent block");
|
|
27511
|
+
assert(logger$3v, isComplexKindBlock(editor, parentComplexBlock), "is not a complex block");
|
|
27541
27512
|
const nextContainer = getComplexBlockClass(editor, parentComplexBlock).getNextContainer(editor, parentComplexBlock, container, type);
|
|
27542
27513
|
if (nextContainer) {
|
|
27543
27514
|
if (isFindPrev(type)) {
|
|
@@ -27559,7 +27530,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27559
27530
|
return null;
|
|
27560
27531
|
}
|
|
27561
27532
|
const parentBlock = getParentBlock(container);
|
|
27562
|
-
assert(logger$
|
|
27533
|
+
assert(logger$3v, parentBlock, "child container has not parent block");
|
|
27563
27534
|
if (isFindPrev(type)) {
|
|
27564
27535
|
const prev = getPrevBlock(parentBlock);
|
|
27565
27536
|
if (prev) {
|
|
@@ -27614,7 +27585,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27614
27585
|
}
|
|
27615
27586
|
if (!targetBlock) {
|
|
27616
27587
|
if (isComplexKindBlock(editor, block) && complexBlockGetAllChildContainers(editor, block).length === 0) {
|
|
27617
|
-
logger$
|
|
27588
|
+
logger$3v.warn("complex block has not any child container, not loaded?");
|
|
27618
27589
|
targetBlock = direction === "ArrowDown" || direction === "ArrowRight" ? getNextVisibleBlock(block) : getPrevVisibleBlock(block);
|
|
27619
27590
|
}
|
|
27620
27591
|
}
|
|
@@ -27761,10 +27732,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27761
27732
|
editorAdjustSelection(editor, "ArrowUp", "select");
|
|
27762
27733
|
return true;
|
|
27763
27734
|
}
|
|
27764
|
-
const logger$
|
|
27735
|
+
const logger$3u = getLogger("word-offset");
|
|
27765
27736
|
function editorGetWordLeftPos(editor, type) {
|
|
27766
27737
|
const old = editor.selection.range.focus;
|
|
27767
|
-
assert(logger$
|
|
27738
|
+
assert(logger$3u, old.isSimple(), "invalid range type");
|
|
27768
27739
|
const block = editor.getBlockById(old.blockId);
|
|
27769
27740
|
if (isEmptyTextBlock(editor, block)) {
|
|
27770
27741
|
return createSimpleBlockPosition(block, 0, "home");
|
|
@@ -27789,7 +27760,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27789
27760
|
}
|
|
27790
27761
|
function editorGetWordRightPos(editor, type) {
|
|
27791
27762
|
const old = editor.selection.range.focus;
|
|
27792
|
-
assert(logger$
|
|
27763
|
+
assert(logger$3u, old.isSimple(), "invalid range type");
|
|
27793
27764
|
const block = editor.getBlockById(old.blockId);
|
|
27794
27765
|
if (isEmptyTextBlock(editor, block)) {
|
|
27795
27766
|
return createSimpleBlockPosition(block, 0, "end");
|
|
@@ -27901,10 +27872,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27901
27872
|
editor.selection.setSelection(editor.selection.getAnchorPos(), pos);
|
|
27902
27873
|
return true;
|
|
27903
27874
|
}
|
|
27904
|
-
const logger$
|
|
27875
|
+
const logger$3t = getLogger("line-offset");
|
|
27905
27876
|
function editorGetLineHomePos(editor) {
|
|
27906
27877
|
const old = editor.selection.range.focus;
|
|
27907
|
-
assert(logger$
|
|
27878
|
+
assert(logger$3t, old.isSimple(), "invalid range type");
|
|
27908
27879
|
const block = editor.getBlockById(old.blockId);
|
|
27909
27880
|
if (old.offset === 0 || !isTextKindBlock(editor, block)) {
|
|
27910
27881
|
const newPos2 = createSimpleBlockPosition(block, 0, "home");
|
|
@@ -27921,7 +27892,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27921
27892
|
}
|
|
27922
27893
|
function editorGetLineEndPos(editor) {
|
|
27923
27894
|
const old = editor.selection.range.focus;
|
|
27924
|
-
assert(logger$
|
|
27895
|
+
assert(logger$3t, old.isSimple(), "invalid range type");
|
|
27925
27896
|
const block = editor.getBlockById(old.blockId);
|
|
27926
27897
|
if (old.offset === getBlockTextLength$6(editor, block) || !isTextKindBlock(editor, block)) {
|
|
27927
27898
|
const newPos2 = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
|
|
@@ -28021,7 +27992,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28021
27992
|
editorPageDownScroll(editor);
|
|
28022
27993
|
return true;
|
|
28023
27994
|
}
|
|
28024
|
-
const logger$
|
|
27995
|
+
const logger$3s = getLogger("table-scroll");
|
|
28025
27996
|
class DomEventHandler {
|
|
28026
27997
|
constructor(editor, dom, name, handler, data2, options) {
|
|
28027
27998
|
__publicField(this, "handleEvent", (event) => {
|
|
@@ -28053,7 +28024,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28053
28024
|
const existsHandlers = this.handlers.get(element);
|
|
28054
28025
|
if (existsHandlers) {
|
|
28055
28026
|
if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
|
|
28056
|
-
logger$
|
|
28027
|
+
logger$3s.warn(`event has already registered: ${eventName}`);
|
|
28057
28028
|
return;
|
|
28058
28029
|
}
|
|
28059
28030
|
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
|
|
@@ -28163,7 +28134,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28163
28134
|
});
|
|
28164
28135
|
return true;
|
|
28165
28136
|
}
|
|
28166
|
-
const logger$
|
|
28137
|
+
const logger$3r = getLogger("select-all");
|
|
28167
28138
|
function isContainerSelectedAllChildBlocks(container, range) {
|
|
28168
28139
|
const firstBlock = getFirstChildBlock(container);
|
|
28169
28140
|
const lastBlock2 = getLastChildBlock(container);
|
|
@@ -28178,8 +28149,8 @@ var __publicField = (obj, key, value) => {
|
|
|
28178
28149
|
return range.start.blockId === blockId && range.start.childContainerId === getContainerId(first) && range.end.blockId === blockId && range.end.childContainerId === getContainerId(last);
|
|
28179
28150
|
}
|
|
28180
28151
|
function selectComplexBlock(editor, block) {
|
|
28181
|
-
assert(logger$
|
|
28182
|
-
assert(logger$
|
|
28152
|
+
assert(logger$3r, block, "no parent block");
|
|
28153
|
+
assert(logger$3r, isComplexKindBlock(editor, block), "not a complex block");
|
|
28183
28154
|
const containers = getComplexBlockClass(editor, block).getChildContainers(editor, block);
|
|
28184
28155
|
const first = containers[0];
|
|
28185
28156
|
const last = containers[containers.length - 1];
|
|
@@ -28215,13 +28186,13 @@ var __publicField = (obj, key, value) => {
|
|
|
28215
28186
|
selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
|
|
28216
28187
|
return false;
|
|
28217
28188
|
}
|
|
28218
|
-
assert(logger$
|
|
28189
|
+
assert(logger$3r, !range.isSimple(), "invalid range type");
|
|
28219
28190
|
if (isComplexBlockSelectedAllChildContainer(focusedBlock, range)) {
|
|
28220
28191
|
selectParentContainer(editor, focusedBlock);
|
|
28221
28192
|
return false;
|
|
28222
28193
|
}
|
|
28223
|
-
assert(logger$
|
|
28224
|
-
assert(logger$
|
|
28194
|
+
assert(logger$3r, focusedBlock, "no parent block");
|
|
28195
|
+
assert(logger$3r, isComplexKindBlock(editor, focusedBlock), "not a complex block");
|
|
28225
28196
|
selectComplexBlock(editor, focusedBlock);
|
|
28226
28197
|
return true;
|
|
28227
28198
|
}
|
|
@@ -28257,30 +28228,6 @@ var __publicField = (obj, key, value) => {
|
|
|
28257
28228
|
}
|
|
28258
28229
|
editor.selection.setSelection(newStartPos, newEndPos);
|
|
28259
28230
|
}
|
|
28260
|
-
function editorMoveBlockStart(editor) {
|
|
28261
|
-
const focus = editor.selection.range.focus;
|
|
28262
|
-
const block = editor.getBlockById(focus.blockId);
|
|
28263
|
-
if (!block)
|
|
28264
|
-
return false;
|
|
28265
|
-
if (!isSimpleBlock(editor, block))
|
|
28266
|
-
return false;
|
|
28267
|
-
const newPos = createSimpleBlockPosition(block, 0, "home");
|
|
28268
|
-
editor.selection.setSelection(newPos);
|
|
28269
|
-
editor.selection.updateLastCaretRect();
|
|
28270
|
-
return true;
|
|
28271
|
-
}
|
|
28272
|
-
function editorMoveBlockEnd(editor) {
|
|
28273
|
-
const focus = editor.selection.range.focus;
|
|
28274
|
-
const block = editor.getBlockById(focus.blockId);
|
|
28275
|
-
if (!block)
|
|
28276
|
-
return false;
|
|
28277
|
-
if (!isSimpleBlock(editor, block))
|
|
28278
|
-
return false;
|
|
28279
|
-
const newPos = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
|
|
28280
|
-
editor.selection.setSelection(newPos);
|
|
28281
|
-
editor.selection.updateLastCaretRect();
|
|
28282
|
-
return true;
|
|
28283
|
-
}
|
|
28284
28231
|
function editorFocusToEnd(editor) {
|
|
28285
28232
|
editorSelectEnd(editor);
|
|
28286
28233
|
editor.focus();
|
|
@@ -28360,7 +28307,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28360
28307
|
}
|
|
28361
28308
|
return cloned;
|
|
28362
28309
|
}
|
|
28363
|
-
const logger$
|
|
28310
|
+
const logger$3q = getLogger("selected-block-to-doc");
|
|
28364
28311
|
function appendBlockChildren(editor, data2, doc2) {
|
|
28365
28312
|
if (!data2.children)
|
|
28366
28313
|
return;
|
|
@@ -28381,7 +28328,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28381
28328
|
if (isTextKindBlock(editor, selectedBlock.block)) {
|
|
28382
28329
|
const start = selectedBlock.start;
|
|
28383
28330
|
const end = selectedBlock.end;
|
|
28384
|
-
assert(logger$
|
|
28331
|
+
assert(logger$3q, data2.text, "no block text");
|
|
28385
28332
|
if (start.offset === end.offset) {
|
|
28386
28333
|
return {
|
|
28387
28334
|
blocks: {
|
|
@@ -28415,8 +28362,8 @@ var __publicField = (obj, key, value) => {
|
|
|
28415
28362
|
comments: {}
|
|
28416
28363
|
};
|
|
28417
28364
|
}
|
|
28418
|
-
assert(logger$
|
|
28419
|
-
assert(logger$
|
|
28365
|
+
assert(logger$3q, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
|
|
28366
|
+
assert(logger$3q, data2.children, "no children");
|
|
28420
28367
|
const ret = {
|
|
28421
28368
|
blocks: {
|
|
28422
28369
|
root: [
|
|
@@ -28434,9 +28381,9 @@ var __publicField = (obj, key, value) => {
|
|
|
28434
28381
|
const end = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
|
|
28435
28382
|
return selectedBlockToDoc(editor, { block, start, end });
|
|
28436
28383
|
}
|
|
28437
|
-
const logger$
|
|
28384
|
+
const logger$3p = getLogger("block-to-doc");
|
|
28438
28385
|
function blocksToDoc(editor, blocks) {
|
|
28439
|
-
assert(logger$
|
|
28386
|
+
assert(logger$3p, blocks.length > 0, "invalid params, no blocks");
|
|
28440
28387
|
const docs = blocks.map((b) => blockToDoc(editor, b));
|
|
28441
28388
|
return mergeDocs(docs);
|
|
28442
28389
|
}
|
|
@@ -28456,7 +28403,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28456
28403
|
const newDocs = selectedBlocks.map((s) => selectedBlockToDoc(editor, s));
|
|
28457
28404
|
return mergeDocs(newDocs);
|
|
28458
28405
|
}
|
|
28459
|
-
const logger$
|
|
28406
|
+
const logger$3o = getLogger("ensure-block-visible");
|
|
28460
28407
|
function ensureBlockVisible(editor, block) {
|
|
28461
28408
|
var _a;
|
|
28462
28409
|
while (block) {
|
|
@@ -28466,16 +28413,16 @@ var __publicField = (obj, key, value) => {
|
|
|
28466
28413
|
return;
|
|
28467
28414
|
}
|
|
28468
28415
|
const parentComplexBlock = getParentBlock(container);
|
|
28469
|
-
assert(logger$
|
|
28416
|
+
assert(logger$3o, parentComplexBlock, "no parent block");
|
|
28470
28417
|
const parentComplexBlockClass = getBlockClass(editor, parentComplexBlock);
|
|
28471
28418
|
if (parentComplexBlockClass.isChildContainerVisible && !((_a = parentComplexBlockClass.isChildContainerVisible) == null ? void 0 : _a.call(parentComplexBlockClass, editor, parentComplexBlock, container))) {
|
|
28472
|
-
assert(logger$
|
|
28419
|
+
assert(logger$3o, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
|
|
28473
28420
|
parentComplexBlockClass.showChildContainer(editor, parentComplexBlock, container);
|
|
28474
28421
|
}
|
|
28475
28422
|
block = parentComplexBlock;
|
|
28476
28423
|
}
|
|
28477
28424
|
}
|
|
28478
|
-
const logger$
|
|
28425
|
+
const logger$3n = getLogger("editor-selection");
|
|
28479
28426
|
class EditorSelection {
|
|
28480
28427
|
constructor(editor) {
|
|
28481
28428
|
__publicField(this, "editor");
|
|
@@ -28488,7 +28435,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28488
28435
|
}
|
|
28489
28436
|
const range = this.range;
|
|
28490
28437
|
if (rangeInBlock(deletedBlock, range)) {
|
|
28491
|
-
logger$
|
|
28438
|
+
logger$3n.debug("adjust selection because remote deleted current block");
|
|
28492
28439
|
const newRange = moveSelectionBeforeDeleteBlock(editor, deletedBlock);
|
|
28493
28440
|
this.setRange(newRange, { noScroll: true });
|
|
28494
28441
|
}
|
|
@@ -28613,14 +28560,14 @@ var __publicField = (obj, key, value) => {
|
|
|
28613
28560
|
if (pos.isSimple()) {
|
|
28614
28561
|
const ok = pos.offset >= 0 && pos.offset <= getBlockTextLength$6(this.editor, block);
|
|
28615
28562
|
if (!ok) {
|
|
28616
|
-
assert(logger$
|
|
28563
|
+
assert(logger$3n, false, "invalid block position, out of range");
|
|
28617
28564
|
}
|
|
28618
28565
|
} else {
|
|
28619
28566
|
const childContainerId = pos.childContainerId;
|
|
28620
28567
|
const container = this.editor.getContainerById(childContainerId);
|
|
28621
28568
|
const ok = !!container;
|
|
28622
28569
|
if (!ok) {
|
|
28623
|
-
assert(logger$
|
|
28570
|
+
assert(logger$3n, false, "invalid complex block position, no container found");
|
|
28624
28571
|
}
|
|
28625
28572
|
}
|
|
28626
28573
|
}
|
|
@@ -28681,7 +28628,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28681
28628
|
let container = getParentContainer(block);
|
|
28682
28629
|
while (isChildContainer(container)) {
|
|
28683
28630
|
const parentBlock = getParentBlock(container);
|
|
28684
|
-
assert(logger$
|
|
28631
|
+
assert(logger$3n, parentBlock, "parent block not found");
|
|
28685
28632
|
addClass(parentBlock, "child-focused");
|
|
28686
28633
|
container = getParentContainer(parentBlock);
|
|
28687
28634
|
}
|
|
@@ -28791,15 +28738,15 @@ var __publicField = (obj, key, value) => {
|
|
|
28791
28738
|
editor.undoManager.redo();
|
|
28792
28739
|
return true;
|
|
28793
28740
|
}
|
|
28794
|
-
const logger$
|
|
28741
|
+
const logger$3m = getLogger("delete-text");
|
|
28795
28742
|
function editorDeleteText(editor, type, count, insertPos) {
|
|
28796
28743
|
const pos = insertPos != null ? insertPos : editor.selection.range.start;
|
|
28797
28744
|
if (!(pos instanceof EditorSimpleBlockPosition)) {
|
|
28798
|
-
assert(logger$
|
|
28745
|
+
assert(logger$3m, false, `invalid insert pos type: ${typeof pos}`);
|
|
28799
28746
|
}
|
|
28800
28747
|
const { blockId } = pos;
|
|
28801
28748
|
const block = editor.getBlockById(blockId);
|
|
28802
|
-
assert(logger$
|
|
28749
|
+
assert(logger$3m, isTextKindBlock(editor, block), "block is not a text kind block");
|
|
28803
28750
|
let { offset } = pos;
|
|
28804
28751
|
if (type === "backward") {
|
|
28805
28752
|
if (offset - count < 0) {
|
|
@@ -28829,7 +28776,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28829
28776
|
}
|
|
28830
28777
|
return false;
|
|
28831
28778
|
}
|
|
28832
|
-
const logger$
|
|
28779
|
+
const logger$3l = getLogger("handle-backspace");
|
|
28833
28780
|
function tryDeleteEmptyBlock(editor, block) {
|
|
28834
28781
|
if (!isEmptyTextBlock(editor, block)) {
|
|
28835
28782
|
return;
|
|
@@ -28869,7 +28816,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28869
28816
|
}
|
|
28870
28817
|
} else {
|
|
28871
28818
|
tryDeleteEmptyBlock(editor, block);
|
|
28872
|
-
assert(logger$
|
|
28819
|
+
assert(logger$3l, isEmbedBlock(prevBlock), "prev block is not embed block");
|
|
28873
28820
|
editor.selection.selectBlock(prevBlock, 1);
|
|
28874
28821
|
}
|
|
28875
28822
|
} else {
|
|
@@ -28896,7 +28843,6 @@ var __publicField = (obj, key, value) => {
|
|
|
28896
28843
|
editor.deleteBlock(block);
|
|
28897
28844
|
}
|
|
28898
28845
|
}
|
|
28899
|
-
const logger$3l = getLogger("word-offset");
|
|
28900
28846
|
function handleEditorDelete(editor, event) {
|
|
28901
28847
|
if (!editor.selection.range.isCollapsed()) {
|
|
28902
28848
|
editor.clearSelectedContents();
|
|
@@ -28931,130 +28877,6 @@ var __publicField = (obj, key, value) => {
|
|
|
28931
28877
|
editor.deleteBlock(block);
|
|
28932
28878
|
}
|
|
28933
28879
|
}
|
|
28934
|
-
function handleEditorDeleteLeftWord(editor, event) {
|
|
28935
|
-
const old = editor.selection.range.focus;
|
|
28936
|
-
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
28937
|
-
const block = editor.getBlockById(old.blockId);
|
|
28938
|
-
if (!isTextKindBlock(editor, block)) {
|
|
28939
|
-
editor.deleteBlock(block);
|
|
28940
|
-
return true;
|
|
28941
|
-
}
|
|
28942
|
-
if (old.offset === 0) {
|
|
28943
|
-
const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
|
|
28944
|
-
if (!isTextKindBlock(editor, block2))
|
|
28945
|
-
return true;
|
|
28946
|
-
return !isEmptyTextBlock(editor, block2);
|
|
28947
|
-
};
|
|
28948
|
-
const prevBlock = getPrevVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
|
|
28949
|
-
if (!prevBlock)
|
|
28950
|
-
return false;
|
|
28951
|
-
const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
|
|
28952
|
-
const emptyTextBlocks = getBlocksBetween(prevBlock, block, matchEmptyTextBlock);
|
|
28953
|
-
emptyTextBlocks.forEach((b) => {
|
|
28954
|
-
editor.deleteBlock(b);
|
|
28955
|
-
});
|
|
28956
|
-
if (!isTextKindBlock(editor, prevBlock)) {
|
|
28957
|
-
editor.deleteBlock(prevBlock);
|
|
28958
|
-
return true;
|
|
28959
|
-
}
|
|
28960
|
-
const textBlockLen = getBlockTextLength$6(editor, prevBlock);
|
|
28961
|
-
const newOffset2 = findWordLeft(editor, prevBlock, textBlockLen);
|
|
28962
|
-
editor.deleteTextFromBlock(prevBlock, newOffset2, textBlockLen - newOffset2);
|
|
28963
|
-
const currentBlockText = editor.getBlockText(block);
|
|
28964
|
-
editor.insertTextToBlock(prevBlock, newOffset2, currentBlockText);
|
|
28965
|
-
editor.deleteBlock(block);
|
|
28966
|
-
const pos = createSimpleBlockPosition(prevBlock, newOffset2, "normal");
|
|
28967
|
-
editor.selection.setSelection(pos);
|
|
28968
|
-
editor.selection.updateLastCaretRect();
|
|
28969
|
-
return true;
|
|
28970
|
-
}
|
|
28971
|
-
const newOffset = findWordLeft(editor, block, old.offset);
|
|
28972
|
-
const deletedCount = old.offset - newOffset;
|
|
28973
|
-
editor.deleteTextFromBlock(block, newOffset, deletedCount);
|
|
28974
|
-
return true;
|
|
28975
|
-
}
|
|
28976
|
-
function handleEditorDeleteRightWord(editor, event) {
|
|
28977
|
-
const old = editor.selection.range.focus;
|
|
28978
|
-
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
28979
|
-
const block = editor.getBlockById(old.blockId);
|
|
28980
|
-
if (!isTextKindBlock(editor, block)) {
|
|
28981
|
-
editor.deleteBlock(block);
|
|
28982
|
-
return true;
|
|
28983
|
-
}
|
|
28984
|
-
if (old.offset === getTextBlockLength(block)) {
|
|
28985
|
-
const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
|
|
28986
|
-
if (!isTextKindBlock(editor, block2))
|
|
28987
|
-
return true;
|
|
28988
|
-
return !isEmptyTextBlock(editor, block2);
|
|
28989
|
-
};
|
|
28990
|
-
const nextBlock = getNextVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
|
|
28991
|
-
if (!nextBlock)
|
|
28992
|
-
return false;
|
|
28993
|
-
const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
|
|
28994
|
-
const emptyTextBlocks = getBlocksBetween(block, nextBlock, matchEmptyTextBlock);
|
|
28995
|
-
emptyTextBlocks.forEach((b) => {
|
|
28996
|
-
editor.deleteBlock(b);
|
|
28997
|
-
});
|
|
28998
|
-
if (!isTextKindBlock(editor, nextBlock)) {
|
|
28999
|
-
editor.deleteBlock(nextBlock);
|
|
29000
|
-
return true;
|
|
29001
|
-
}
|
|
29002
|
-
const newOffset = findWordEnd(editor, nextBlock, 0);
|
|
29003
|
-
editor.deleteTextFromBlock(nextBlock, 0, newOffset);
|
|
29004
|
-
const nextBlockText = editor.getBlockText(nextBlock);
|
|
29005
|
-
editor.insertTextToBlock(block, old.offset, nextBlockText);
|
|
29006
|
-
editor.deleteBlock(nextBlock);
|
|
29007
|
-
const pos = createSimpleBlockPosition(block, old.offset, "normal");
|
|
29008
|
-
editor.selection.setSelection(pos);
|
|
29009
|
-
editor.selection.updateLastCaretRect();
|
|
29010
|
-
return true;
|
|
29011
|
-
}
|
|
29012
|
-
const endOffset = findWordEnd(editor, block, old.offset);
|
|
29013
|
-
const deletedCount = endOffset - old.offset;
|
|
29014
|
-
editor.deleteTextFromBlock(block, old.offset, deletedCount);
|
|
29015
|
-
return true;
|
|
29016
|
-
}
|
|
29017
|
-
function handleEditorDeleteAfterWords(editor) {
|
|
29018
|
-
const old = editor.selection.range.focus;
|
|
29019
|
-
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
29020
|
-
const block = editor.getBlockById(old.blockId);
|
|
29021
|
-
if (!isTextKindBlock(editor, block)) {
|
|
29022
|
-
editor.deleteBlock(block);
|
|
29023
|
-
return;
|
|
29024
|
-
}
|
|
29025
|
-
const needDeleteCount = getTextBlockLength(block) - old.offset;
|
|
29026
|
-
if (needDeleteCount === 0)
|
|
29027
|
-
return;
|
|
29028
|
-
editor.deleteTextFromBlock(block, old.offset, needDeleteCount);
|
|
29029
|
-
}
|
|
29030
|
-
function handleEditorDeleteRightChar(editor) {
|
|
29031
|
-
const old = editor.selection.range.focus;
|
|
29032
|
-
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
29033
|
-
const block = editor.getBlockById(old.blockId);
|
|
29034
|
-
if (!isTextKindBlock(editor, block)) {
|
|
29035
|
-
editor.deleteBlock(block);
|
|
29036
|
-
return;
|
|
29037
|
-
}
|
|
29038
|
-
if (old.offset === getBlockTextLength$6(editor, block)) {
|
|
29039
|
-
const nextVisibleBlock = getNextVisibleBlock(block);
|
|
29040
|
-
if (!nextVisibleBlock)
|
|
29041
|
-
return;
|
|
29042
|
-
if (!isTextKindBlock(editor, nextVisibleBlock))
|
|
29043
|
-
return;
|
|
29044
|
-
if (isEmptyTextBlock(editor, nextVisibleBlock)) {
|
|
29045
|
-
editor.deleteBlock(nextVisibleBlock);
|
|
29046
|
-
return;
|
|
29047
|
-
}
|
|
29048
|
-
const nextBlockText = editor.getBlockText(nextVisibleBlock);
|
|
29049
|
-
editor.deleteBlock(nextVisibleBlock);
|
|
29050
|
-
editor.insertTextToBlock(block, old.offset, nextBlockText);
|
|
29051
|
-
const pos = createSimpleBlockPosition(block, old.offset, "normal");
|
|
29052
|
-
editor.selection.setSelection(pos);
|
|
29053
|
-
editor.selection.updateLastCaretRect();
|
|
29054
|
-
return;
|
|
29055
|
-
}
|
|
29056
|
-
editorDeleteText(editor, "forward", 1, null);
|
|
29057
|
-
}
|
|
29058
28880
|
function handleEditorEnterEvent$1(editor, event) {
|
|
29059
28881
|
if (isFullSelectedOneComplexBlock(editor)) {
|
|
29060
28882
|
const focusedBlock2 = editor.getFocusedBlock();
|
|
@@ -29276,42 +29098,6 @@ var __publicField = (obj, key, value) => {
|
|
|
29276
29098
|
return true;
|
|
29277
29099
|
});
|
|
29278
29100
|
}
|
|
29279
|
-
function editorHandleDeleteLeftWord(editor, event) {
|
|
29280
|
-
if (editor.readonly || !editor.isWritable()) {
|
|
29281
|
-
return false;
|
|
29282
|
-
}
|
|
29283
|
-
return editor.undoManager.runInGroup(() => {
|
|
29284
|
-
handleEditorDeleteLeftWord(editor);
|
|
29285
|
-
return true;
|
|
29286
|
-
});
|
|
29287
|
-
}
|
|
29288
|
-
function editorHandleDeleteRightWord(editor, event) {
|
|
29289
|
-
if (editor.readonly || !editor.isWritable()) {
|
|
29290
|
-
return false;
|
|
29291
|
-
}
|
|
29292
|
-
return editor.undoManager.runInGroup(() => {
|
|
29293
|
-
handleEditorDeleteRightWord(editor);
|
|
29294
|
-
return true;
|
|
29295
|
-
});
|
|
29296
|
-
}
|
|
29297
|
-
function editorHandleDeleteAfterWords(editor, event) {
|
|
29298
|
-
if (editor.readonly || !editor.isWritable()) {
|
|
29299
|
-
return false;
|
|
29300
|
-
}
|
|
29301
|
-
return editor.undoManager.runInGroup(() => {
|
|
29302
|
-
handleEditorDeleteAfterWords(editor);
|
|
29303
|
-
return true;
|
|
29304
|
-
});
|
|
29305
|
-
}
|
|
29306
|
-
function editorHandleDeleteRightChar(editor, event) {
|
|
29307
|
-
if (editor.readonly || !editor.isWritable()) {
|
|
29308
|
-
return false;
|
|
29309
|
-
}
|
|
29310
|
-
return editor.undoManager.runInGroup(() => {
|
|
29311
|
-
handleEditorDeleteRightChar(editor);
|
|
29312
|
-
return true;
|
|
29313
|
-
});
|
|
29314
|
-
}
|
|
29315
29101
|
function editorHandleBackspace(editor, event) {
|
|
29316
29102
|
if (editor.readonly || !editor.isWritable()) {
|
|
29317
29103
|
return false;
|
|
@@ -29405,10 +29191,6 @@ ${codeText}
|
|
|
29405
29191
|
__proto__: null,
|
|
29406
29192
|
editorHandleEnter,
|
|
29407
29193
|
editorHandleDelete,
|
|
29408
|
-
editorHandleDeleteLeftWord,
|
|
29409
|
-
editorHandleDeleteRightWord,
|
|
29410
|
-
editorHandleDeleteAfterWords,
|
|
29411
|
-
editorHandleDeleteRightChar,
|
|
29412
29194
|
editorHandleBackspace,
|
|
29413
29195
|
editorHandleInsertBr,
|
|
29414
29196
|
editorHandlePastePlainText,
|
|
@@ -29416,41 +29198,6 @@ ${codeText}
|
|
|
29416
29198
|
getSelectedCodeBlockMarkdown,
|
|
29417
29199
|
editorHandleCopyMarkdown
|
|
29418
29200
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
29419
|
-
const MacShortcuts = {
|
|
29420
|
-
"Cmd+ArrowLeft": editorMoveLineHome,
|
|
29421
|
-
"Cmd+ArrowRight": editorMoveLineEnd,
|
|
29422
|
-
"Option+ArrowLeft": editorMoveWordLeft,
|
|
29423
|
-
"Option+ArrowRight": editorMoveWordEnd,
|
|
29424
|
-
"Option+Shift+ArrowLeft": editorSelectWordLeft,
|
|
29425
|
-
"Option+Shift+ArrowRight": editorSelectWordEnd,
|
|
29426
|
-
"Cmd+Shift+ArrowLeft": editorSelectLineHome,
|
|
29427
|
-
"Cmd+Shift+ArrowRight": editorSelectLineEnd,
|
|
29428
|
-
"Ctrl+A": editorMoveBlockStart,
|
|
29429
|
-
"Ctrl+E": editorMoveBlockEnd,
|
|
29430
|
-
"Option+Delete": editorHandleDeleteRightWord,
|
|
29431
|
-
"Option+Backspace": editorHandleDeleteLeftWord,
|
|
29432
|
-
"Ctrl+B": editorMoveLeft,
|
|
29433
|
-
"Ctrl+F": editorMoveRight,
|
|
29434
|
-
"Ctrl+N": editorMoveDown,
|
|
29435
|
-
"Ctrl+P": editorMoveUp,
|
|
29436
|
-
"Ctrl+K": editorHandleDeleteAfterWords,
|
|
29437
|
-
"Ctrl+H": editorHandleBackspace,
|
|
29438
|
-
"Ctrl+D": editorHandleDeleteRightChar
|
|
29439
|
-
};
|
|
29440
|
-
const WinLinuxShortcuts = {
|
|
29441
|
-
"Home": editorMoveLineHome,
|
|
29442
|
-
"End": editorMoveLineEnd,
|
|
29443
|
-
"Shift+Home": editorSelectLineHome,
|
|
29444
|
-
"Shift+End": editorSelectLineEnd,
|
|
29445
|
-
"Ctrl+Delete": editorHandleDeleteRightWord,
|
|
29446
|
-
"Ctrl+Backspace": editorHandleDeleteLeftWord,
|
|
29447
|
-
"Ctrl+ArrowLeft": editorMoveWordLeft,
|
|
29448
|
-
"Ctrl+ArrowRight": editorMoveWordEnd,
|
|
29449
|
-
"Ctrl+Shift+ArrowLeft": editorSelectWordLeft,
|
|
29450
|
-
"Ctrl+Shift+ArrowRight": editorSelectWordEnd
|
|
29451
|
-
};
|
|
29452
|
-
const isMac = clientType.isMac;
|
|
29453
|
-
const CustomShortcuts = isMac ? MacShortcuts : WinLinuxShortcuts;
|
|
29454
29201
|
const DefaultShortcuts = {
|
|
29455
29202
|
"ArrowDown": editorMoveDown,
|
|
29456
29203
|
"ArrowUp": editorMoveUp,
|
|
@@ -29460,11 +29207,19 @@ ${codeText}
|
|
|
29460
29207
|
"Shift+ArrowUp": editorSelectUp,
|
|
29461
29208
|
"Shift+ArrowLeft": editorSelectLeft,
|
|
29462
29209
|
"Shift+ArrowRight": editorSelectRight,
|
|
29210
|
+
"CtrlOrCmd+ArrowLeft": editorMoveWordLeft,
|
|
29211
|
+
"CtrlOrCmd+ArrowRight": editorMoveWordEnd,
|
|
29212
|
+
"CtrlOrCmd+Shift+ArrowLeft": editorSelectWordLeft,
|
|
29213
|
+
"CtrlOrCmd+Shift+ArrowRight": editorSelectWordEnd,
|
|
29463
29214
|
"CtrlOrCmd+ArrowUp": editorMoveHome,
|
|
29464
29215
|
"CtrlOrCmd+ArrowDown": editorMoveEnd,
|
|
29465
29216
|
"CtrlOrCmd+Shift+ArrowUp": editorSelectHome,
|
|
29466
29217
|
"CtrlOrCmd+Shift+ArrowDown": editorSelectEnd,
|
|
29467
29218
|
"CtrlOrCmd+A": editorSelectAll,
|
|
29219
|
+
"Home": editorMoveLineHome,
|
|
29220
|
+
"End": editorMoveLineEnd,
|
|
29221
|
+
"Shift+Home": editorSelectLineHome,
|
|
29222
|
+
"Shift+End": editorSelectLineEnd,
|
|
29468
29223
|
"PageUp": editorMovePageUp,
|
|
29469
29224
|
"PageDown": editorMovePageDown,
|
|
29470
29225
|
"Shift+PageUp": editorSelectPageUp,
|
|
@@ -29476,8 +29231,7 @@ ${codeText}
|
|
|
29476
29231
|
"Backspace": editorHandleBackspace,
|
|
29477
29232
|
"Shift+Enter": editorHandleInsertBr,
|
|
29478
29233
|
"CtrlOrCmd+Shift+V": editorHandlePastePlainText,
|
|
29479
|
-
"CtrlOrCmd+Shift+C": editorHandleCopyMarkdown
|
|
29480
|
-
...CustomShortcuts
|
|
29234
|
+
"CtrlOrCmd+Shift+C": editorHandleCopyMarkdown
|
|
29481
29235
|
};
|
|
29482
29236
|
function editorHandleKeyboardEvent(editor, event) {
|
|
29483
29237
|
const result = editor.shortcuts.handleKeyboardEvents(editor, event);
|
|
@@ -43255,21 +43009,8 @@ ${codeText}
|
|
|
43255
43009
|
const textColorItem = "";
|
|
43256
43010
|
const DEFAULT_BG_COLOR = 2;
|
|
43257
43011
|
const NULLABLE_COLOR = -1;
|
|
43258
|
-
const STORAGE_NAME = "color-item";
|
|
43259
|
-
function getColorsFromLocalStorage(editor) {
|
|
43260
|
-
const colors = [null, null];
|
|
43261
|
-
const color = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-color`) || "", 10);
|
|
43262
|
-
const backgroundColor = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-backgroundColor`) || `${DEFAULT_BG_COLOR}`, 10);
|
|
43263
|
-
if (!Number.isNaN(color)) {
|
|
43264
|
-
colors[0] = color;
|
|
43265
|
-
}
|
|
43266
|
-
if (!Number.isNaN(backgroundColor)) {
|
|
43267
|
-
colors[1] = backgroundColor;
|
|
43268
|
-
}
|
|
43269
|
-
return colors;
|
|
43270
|
-
}
|
|
43271
43012
|
class TextColorItem extends tinyTypedEmitter.TypedEmitter {
|
|
43272
|
-
constructor(editor, storageName =
|
|
43013
|
+
constructor(editor, storageName = "color-item") {
|
|
43273
43014
|
super();
|
|
43274
43015
|
__publicField(this, "id", "text-color-item");
|
|
43275
43016
|
__publicField(this, "name", i18n$1.t("colorPalette.name"));
|
|
@@ -50964,7 +50705,7 @@ ${codeText}
|
|
|
50964
50705
|
}
|
|
50965
50706
|
return handleDragList(editor, draggedBlock, targetBlock, insertPos);
|
|
50966
50707
|
}
|
|
50967
|
-
function executeShortcut$
|
|
50708
|
+
function executeShortcut$1(editor, type) {
|
|
50968
50709
|
if (!editor.isWritable()) {
|
|
50969
50710
|
return false;
|
|
50970
50711
|
}
|
|
@@ -50978,8 +50719,8 @@ ${codeText}
|
|
|
50978
50719
|
return true;
|
|
50979
50720
|
}
|
|
50980
50721
|
const ListBlockShortcuts = {
|
|
50981
|
-
"Shift+CtrlOrCmd+L": (editor) => executeShortcut$
|
|
50982
|
-
"Shift+CtrlOrCmd+U": (editor) => executeShortcut$
|
|
50722
|
+
"Shift+CtrlOrCmd+L": (editor) => executeShortcut$1(editor, "ordered-list"),
|
|
50723
|
+
"Shift+CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "unordered-list")
|
|
50983
50724
|
};
|
|
50984
50725
|
function getBlockPadding$1(block) {
|
|
50985
50726
|
const padding = block.getAttribute("block-padding-level");
|
|
@@ -61489,31 +61230,6 @@ $$${mathData.mathjaxText}$$
|
|
|
61489
61230
|
return editor.addCustom("overflow-tooltip-helper", () => new OverflowTooltipHelper(editor));
|
|
61490
61231
|
}
|
|
61491
61232
|
}
|
|
61492
|
-
function executeShortcut$2(editor, style2) {
|
|
61493
|
-
if (!editor.isWritable()) {
|
|
61494
|
-
return false;
|
|
61495
|
-
}
|
|
61496
|
-
const range = editor.selection.range;
|
|
61497
|
-
const allCommands = editor.editorCommandProviders.getCommands(range);
|
|
61498
|
-
const alignCommands = allCommands.flatMap((command2) => {
|
|
61499
|
-
if (command2.id === "align") {
|
|
61500
|
-
return command2.children;
|
|
61501
|
-
}
|
|
61502
|
-
return [];
|
|
61503
|
-
});
|
|
61504
|
-
const command = alignCommands.find((c) => c.id === `align-${style2}`);
|
|
61505
|
-
if (!command) {
|
|
61506
|
-
return false;
|
|
61507
|
-
}
|
|
61508
|
-
editor.editorCommandProviders.executeCommand(range, command, {});
|
|
61509
|
-
OnesEditorToolbar.get(editor).update("selectionChange");
|
|
61510
|
-
return true;
|
|
61511
|
-
}
|
|
61512
|
-
const AlignShortcuts = {
|
|
61513
|
-
"CtrlOrCmd+Shift+E": (editor) => executeShortcut$2(editor, "center"),
|
|
61514
|
-
"CtrlOrCmd+Shift+O": (editor) => executeShortcut$2(editor, "left"),
|
|
61515
|
-
"CtrlOrCmd+Shift+R": (editor) => executeShortcut$2(editor, "right")
|
|
61516
|
-
};
|
|
61517
61233
|
const TextCommands = {
|
|
61518
61234
|
"text/style-bold": "bold",
|
|
61519
61235
|
"text/style-italic": "italic",
|
|
@@ -61522,15 +61238,14 @@ $$${mathData.mathjaxText}$$
|
|
|
61522
61238
|
"text/style-code": "code",
|
|
61523
61239
|
"text/style-sub": "subscript",
|
|
61524
61240
|
"text/style-super": "superscript",
|
|
61525
|
-
link: "link"
|
|
61526
|
-
"insert-link": "link"
|
|
61241
|
+
link: "link"
|
|
61527
61242
|
};
|
|
61528
61243
|
function getTextCommands(editor, blockCommands) {
|
|
61529
61244
|
const styleCommandsSet = new Set(Object.keys(TextCommands));
|
|
61530
61245
|
const styleCommands = blockCommands.filter((command) => styleCommandsSet.has(command.id));
|
|
61531
61246
|
return styleCommands;
|
|
61532
61247
|
}
|
|
61533
|
-
function executeShortcut
|
|
61248
|
+
function executeShortcut(editor, style2) {
|
|
61534
61249
|
if (!editor.isWritable()) {
|
|
61535
61250
|
return false;
|
|
61536
61251
|
}
|
|
@@ -61540,7 +61255,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61540
61255
|
const range = editor.selection.range;
|
|
61541
61256
|
const allCommands = editor.editorCommandProviders.getCommands(range);
|
|
61542
61257
|
const textCommands = getTextCommands(editor, allCommands);
|
|
61543
|
-
const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link"
|
|
61258
|
+
const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link");
|
|
61544
61259
|
if (!command) {
|
|
61545
61260
|
return false;
|
|
61546
61261
|
}
|
|
@@ -61575,37 +61290,13 @@ $$${mathData.mathjaxText}$$
|
|
|
61575
61290
|
return shortcuts2;
|
|
61576
61291
|
};
|
|
61577
61292
|
const TextStyleShortcuts = {
|
|
61578
|
-
"CtrlOrCmd+B": (editor) => executeShortcut
|
|
61579
|
-
"CtrlOrCmd+I": (editor) => executeShortcut
|
|
61580
|
-
"CtrlOrCmd+U": (editor) => executeShortcut
|
|
61581
|
-
"CtrlOrCmd+D": (editor) => executeShortcut
|
|
61582
|
-
"CtrlOrCmd+K": (editor) => executeShortcut
|
|
61293
|
+
"CtrlOrCmd+B": (editor) => executeShortcut(editor, "style-bold"),
|
|
61294
|
+
"CtrlOrCmd+I": (editor) => executeShortcut(editor, "style-italic"),
|
|
61295
|
+
"CtrlOrCmd+U": (editor) => executeShortcut(editor, "style-underline"),
|
|
61296
|
+
"CtrlOrCmd+D": (editor) => executeShortcut(editor, "style-strikethrough"),
|
|
61297
|
+
"CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
|
|
61583
61298
|
...headingShortcut()
|
|
61584
61299
|
};
|
|
61585
|
-
function executeShortcut(editor) {
|
|
61586
|
-
if (!editor.isWritable()) {
|
|
61587
|
-
return false;
|
|
61588
|
-
}
|
|
61589
|
-
const range = editor.selection.range;
|
|
61590
|
-
if (range.isCollapsed()) {
|
|
61591
|
-
return false;
|
|
61592
|
-
}
|
|
61593
|
-
editor.undoManager.runInGroup(() => {
|
|
61594
|
-
const colors = getColorsFromLocalStorage(editor);
|
|
61595
|
-
colors.forEach((color, idx) => {
|
|
61596
|
-
if (color === null) {
|
|
61597
|
-
return;
|
|
61598
|
-
}
|
|
61599
|
-
const type = idx === 0 ? "color" : "backgroundColor";
|
|
61600
|
-
editorRangeSetColor(editor, type, color, () => {
|
|
61601
|
-
});
|
|
61602
|
-
});
|
|
61603
|
-
});
|
|
61604
|
-
return true;
|
|
61605
|
-
}
|
|
61606
|
-
const TextColorShortcuts = {
|
|
61607
|
-
"CtrlOrCmd+Alt+KeyH": (editor) => executeShortcut(editor)
|
|
61608
|
-
};
|
|
61609
61300
|
const zhCN$p = {
|
|
61610
61301
|
quickMenu: {
|
|
61611
61302
|
basic: {
|
|
@@ -62364,7 +62055,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62364
62055
|
__publicField(this, "updateButtonColor", (range) => {
|
|
62365
62056
|
const currentTextColor = editorRangeGetColor(this.editor, range, this.getEmptyTextBlockColor);
|
|
62366
62057
|
this.colorItem.setCurrentTextColors(currentTextColor);
|
|
62367
|
-
const lastButtonColor = getColorsFromLocalStorage(
|
|
62058
|
+
const lastButtonColor = this.colorItem.getColorsFromLocalStorage();
|
|
62368
62059
|
this.colorItem.setCurrentButtonColor(lastButtonColor);
|
|
62369
62060
|
});
|
|
62370
62061
|
__publicField(this, "setActiveAttribute", (type, value) => {
|
|
@@ -73986,6 +73677,8 @@ ${codeText}
|
|
|
73986
73677
|
});
|
|
73987
73678
|
}
|
|
73988
73679
|
const StyleTags = {
|
|
73680
|
+
i: "style-italic",
|
|
73681
|
+
b: "style-bold",
|
|
73989
73682
|
u: "style-underline",
|
|
73990
73683
|
strong: "style-bold",
|
|
73991
73684
|
em: "style-italic",
|
|
@@ -74139,6 +73832,18 @@ ${codeText}
|
|
|
74139
73832
|
}
|
|
74140
73833
|
if (token.type === "html") {
|
|
74141
73834
|
const html = token.text;
|
|
73835
|
+
const testBr = html.trim().toLowerCase();
|
|
73836
|
+
if (testBr === "<br>" || testBr === "<br/>" || testBr === "<br />") {
|
|
73837
|
+
return [{
|
|
73838
|
+
insert: " ",
|
|
73839
|
+
attributes: {
|
|
73840
|
+
id: genId(),
|
|
73841
|
+
created: Date.now(),
|
|
73842
|
+
box: true,
|
|
73843
|
+
type: "br"
|
|
73844
|
+
}
|
|
73845
|
+
}];
|
|
73846
|
+
}
|
|
74142
73847
|
applyHtmlToText(html, attributes);
|
|
74143
73848
|
applyColorTagToText(html, attributes);
|
|
74144
73849
|
applyFontSizeTagToText(html, attributes);
|
|
@@ -74173,6 +73878,22 @@ ${codeText}
|
|
|
74173
73878
|
}
|
|
74174
73879
|
}];
|
|
74175
73880
|
}
|
|
73881
|
+
if (token.type === "image") {
|
|
73882
|
+
const href = token.href || "";
|
|
73883
|
+
if (href) {
|
|
73884
|
+
const boxData = {
|
|
73885
|
+
id: genId(),
|
|
73886
|
+
created: Date.now(),
|
|
73887
|
+
box: true,
|
|
73888
|
+
type: "image",
|
|
73889
|
+
src: href
|
|
73890
|
+
};
|
|
73891
|
+
return [{
|
|
73892
|
+
insert: " ",
|
|
73893
|
+
attributes: boxData
|
|
73894
|
+
}];
|
|
73895
|
+
}
|
|
73896
|
+
}
|
|
74176
73897
|
logger$Q.warn(`unknown token in text: ${JSON.stringify(token)}`);
|
|
74177
73898
|
return [];
|
|
74178
73899
|
});
|
|
@@ -74514,15 +74235,24 @@ ${codeText}
|
|
|
74514
74235
|
children: []
|
|
74515
74236
|
};
|
|
74516
74237
|
const groups = groupTokens(tokens);
|
|
74517
|
-
groups.forEach((
|
|
74518
|
-
const token = tokens2[0];
|
|
74238
|
+
groups.forEach((childTokens, index2) => {
|
|
74519
74239
|
if (index2 === 0) {
|
|
74240
|
+
const token = childTokens[0];
|
|
74520
74241
|
if (isInlineToken(token)) {
|
|
74521
|
-
ret.text = tokensToText(
|
|
74242
|
+
ret.text = tokensToText(childTokens, {}, options);
|
|
74522
74243
|
return;
|
|
74523
74244
|
}
|
|
74524
74245
|
}
|
|
74525
|
-
|
|
74246
|
+
if (childTokens.every((token) => isInlineToken(token))) {
|
|
74247
|
+
const blockText = tokensToText(childTokens, {}, options);
|
|
74248
|
+
ret.children.push({
|
|
74249
|
+
id: genId(),
|
|
74250
|
+
type: "text",
|
|
74251
|
+
text: blockText
|
|
74252
|
+
});
|
|
74253
|
+
return;
|
|
74254
|
+
}
|
|
74255
|
+
ret.children.push(...tokensToBlocks(childTokens, options));
|
|
74526
74256
|
});
|
|
74527
74257
|
return ret;
|
|
74528
74258
|
}
|
|
@@ -75835,8 +75565,8 @@ ${content}
|
|
|
75835
75565
|
const container = document.createElement("div");
|
|
75836
75566
|
container.classList.add("highlight-text-wizdoc");
|
|
75837
75567
|
const code = document.createElement("pre");
|
|
75568
|
+
code.textContent = base64;
|
|
75838
75569
|
container.appendChild(code);
|
|
75839
|
-
code.innerText = base64;
|
|
75840
75570
|
node.insertAdjacentElement("beforebegin", container);
|
|
75841
75571
|
node.remove();
|
|
75842
75572
|
return;
|
|
@@ -92219,11 +91949,9 @@ ${data2.plantumlText}
|
|
|
92219
91949
|
FindReplaceShortcuts,
|
|
92220
91950
|
BlockPaddingShortcuts,
|
|
92221
91951
|
TextStyleShortcuts,
|
|
92222
|
-
AlignShortcuts,
|
|
92223
91952
|
AutoLinkShortcuts,
|
|
92224
91953
|
DefaultShortcuts,
|
|
92225
91954
|
ListBlockShortcuts,
|
|
92226
|
-
TextColorShortcuts,
|
|
92227
91955
|
...options.shortcuts || []
|
|
92228
91956
|
],
|
|
92229
91957
|
colors: [
|
|
@@ -92432,7 +92160,7 @@ ${data2.plantumlText}
|
|
|
92432
92160
|
}
|
|
92433
92161
|
}
|
|
92434
92162
|
});
|
|
92435
|
-
editor.version = "2.5.
|
|
92163
|
+
editor.version = "2.5.1-beta.10";
|
|
92436
92164
|
return editor;
|
|
92437
92165
|
}
|
|
92438
92166
|
function isDoc(doc2) {
|
|
@@ -92545,7 +92273,7 @@ ${data2.plantumlText}
|
|
|
92545
92273
|
}
|
|
92546
92274
|
});
|
|
92547
92275
|
OnesEditorToolbar.register(editor);
|
|
92548
|
-
editor.version = "2.5.
|
|
92276
|
+
editor.version = "2.5.1-beta.10";
|
|
92549
92277
|
return editor;
|
|
92550
92278
|
}
|
|
92551
92279
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -138331,7 +138059,6 @@ ${data2.plantumlText}
|
|
|
138331
138059
|
exports2.AlignProvider = AlignProvider;
|
|
138332
138060
|
exports2.AlignRightIcon = AlignRightIcon;
|
|
138333
138061
|
exports2.AlignRightItem = AlignRightItem;
|
|
138334
|
-
exports2.AlignShortcuts = AlignShortcuts;
|
|
138335
138062
|
exports2.AnchorBox = AnchorBox;
|
|
138336
138063
|
exports2.ArrowDownIcon = ArrowDownIcon$1;
|
|
138337
138064
|
exports2.ArrowLeftIcon = arrowLeft;
|
|
@@ -138588,7 +138315,6 @@ ${data2.plantumlText}
|
|
|
138588
138315
|
exports2.TextBox = TextBox;
|
|
138589
138316
|
exports2.TextColorIcon = TextColorIcon;
|
|
138590
138317
|
exports2.TextColorItem = TextColorItem;
|
|
138591
|
-
exports2.TextColorShortcuts = TextColorShortcuts;
|
|
138592
138318
|
exports2.TextCommandProvider = TextCommandProvider;
|
|
138593
138319
|
exports2.TextGroupIcon = TextGroupIcon;
|
|
138594
138320
|
exports2.TextIcon = TextIcon;
|
|
@@ -138758,8 +138484,6 @@ ${data2.plantumlText}
|
|
|
138758
138484
|
exports2.editorInsertTextToBlock = editorInsertTextToBlock;
|
|
138759
138485
|
exports2.editorInsertTextToBlockEx = editorInsertTextToBlockEx;
|
|
138760
138486
|
exports2.editorMergeTextBlock = editorMergeTextBlock;
|
|
138761
|
-
exports2.editorMoveBlockEnd = editorMoveBlockEnd;
|
|
138762
|
-
exports2.editorMoveBlockStart = editorMoveBlockStart;
|
|
138763
138487
|
exports2.editorMoveDown = editorMoveDown;
|
|
138764
138488
|
exports2.editorMoveEnd = editorMoveEnd;
|
|
138765
138489
|
exports2.editorMoveHome = editorMoveHome;
|
|
@@ -138864,7 +138588,6 @@ ${data2.plantumlText}
|
|
|
138864
138588
|
exports2.getBlockTextLength = getBlockTextLength$6;
|
|
138865
138589
|
exports2.getBlockTools = getBlockTools;
|
|
138866
138590
|
exports2.getBlockType = getBlockType;
|
|
138867
|
-
exports2.getBlocksBetween = getBlocksBetween;
|
|
138868
138591
|
exports2.getBlocksWidth = getBlocksWidth;
|
|
138869
138592
|
exports2.getBoxContent = getBoxContent;
|
|
138870
138593
|
exports2.getBoxId = getBoxId;
|
|
@@ -138877,7 +138600,6 @@ ${data2.plantumlText}
|
|
|
138877
138600
|
exports2.getClosestContainerByCondition = getClosestContainerByCondition;
|
|
138878
138601
|
exports2.getColorFromAttributes = getColorFromAttributes;
|
|
138879
138602
|
exports2.getColorFromContent = getColorFromContent;
|
|
138880
|
-
exports2.getColorsFromLocalStorage = getColorsFromLocalStorage;
|
|
138881
138603
|
exports2.getComplexBlockClass = getComplexBlockClass;
|
|
138882
138604
|
exports2.getContainerBlockOverrideOptions = getContainerBlockOverrideOptions;
|
|
138883
138605
|
exports2.getContainerBlockPath = getContainerBlockPath;
|
|
@@ -138980,7 +138702,6 @@ ${data2.plantumlText}
|
|
|
138980
138702
|
exports2.isBox = isBox;
|
|
138981
138703
|
exports2.isBoxOp = isBoxOp;
|
|
138982
138704
|
exports2.isCJK = isCJK;
|
|
138983
|
-
exports2.isCJKPunctuation = isCJKPunctuation;
|
|
138984
138705
|
exports2.isChildContainer = isChildContainer;
|
|
138985
138706
|
exports2.isChildNode = isChildNode;
|
|
138986
138707
|
exports2.isClipboardEmpty = isClipboardEmpty$1;
|
|
@@ -139053,7 +138774,7 @@ ${data2.plantumlText}
|
|
|
139053
138774
|
exports2.loadJs = loadJs;
|
|
139054
138775
|
exports2.loadJsPromise = loadJsPromise;
|
|
139055
138776
|
exports2.lockers = lockers;
|
|
139056
|
-
exports2.logger = logger$
|
|
138777
|
+
exports2.logger = logger$4p;
|
|
139057
138778
|
exports2.markdownToDoc = markdownToDoc;
|
|
139058
138779
|
exports2.mergeCommands = mergeCommands;
|
|
139059
138780
|
exports2.mergeDocs = mergeDocs;
|