@ones-editor/editor 2.5.1-beta.15 → 2.5.1-beta.16
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 +3 -2
- 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 +4 -0
- package/@ones-editor/core/src/core/input-handler/handle-delete.d.ts +4 -0
- package/@ones-editor/core/src/core/selection/actions/index.d.ts +3 -1
- package/@ones-editor/core/src/core/selection/actions/move-block-end.d.ts +2 -0
- package/@ones-editor/core/src/core/selection/actions/move-block-start.d.ts +2 -0
- package/@ones-editor/core/src/utils/character.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/align-shortcuts.d.ts +2 -0
- package/@ones-editor/ui/src/shortcuts/index.d.ts +3 -2
- package/@ones-editor/ui/src/shortcuts/text-color-shortcuts.d.ts +2 -0
- package/@ones-editor/ui/src/shortcuts/text-style-shortcuts.d.ts +1 -2
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest.d.ts +3 -0
- package/@ones-editor/ui-base/src/color-button/index.d.ts +1 -2
- package/@ones-editor/ui-base/src/color-button/text-color-item.d.ts +2 -0
- package/dist/index.js +860 -489
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44,7 +44,6 @@ div.editor-root {
|
|
|
44
44
|
box-sizing: border-box;
|
|
45
45
|
min-height: 100%;
|
|
46
46
|
width: 100%;
|
|
47
|
-
z-index: 1;
|
|
48
47
|
}
|
|
49
48
|
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 {
|
|
50
49
|
cursor: pointer;
|
|
@@ -8901,7 +8900,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8901
8900
|
imageExportFailed: "\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F"
|
|
8902
8901
|
}
|
|
8903
8902
|
};
|
|
8904
|
-
const logger$
|
|
8903
|
+
const logger$4S = getLogger("i18n");
|
|
8905
8904
|
const langs$3 = {
|
|
8906
8905
|
"en-US": enUS$x,
|
|
8907
8906
|
"zh-CN": zhCN$x,
|
|
@@ -8921,7 +8920,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8921
8920
|
function t$8(key, args) {
|
|
8922
8921
|
const ret = i18n.get(key, args);
|
|
8923
8922
|
if (ret === key) {
|
|
8924
|
-
logger$
|
|
8923
|
+
logger$4S.warn(`no locale value for key ${key}`);
|
|
8925
8924
|
}
|
|
8926
8925
|
return ret;
|
|
8927
8926
|
}
|
|
@@ -9534,7 +9533,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9534
9533
|
this._callbacks.clear();
|
|
9535
9534
|
}
|
|
9536
9535
|
}
|
|
9537
|
-
const logger$
|
|
9536
|
+
const logger$4R = getLogger("await-locker");
|
|
9538
9537
|
class AwaitLock {
|
|
9539
9538
|
constructor() {
|
|
9540
9539
|
__publicField(this, "_acquired", false);
|
|
@@ -9576,7 +9575,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9576
9575
|
}
|
|
9577
9576
|
if (this._waitingResolvers.length > 0) {
|
|
9578
9577
|
const resolve = this._waitingResolvers.shift();
|
|
9579
|
-
assert(logger$
|
|
9578
|
+
assert(logger$4R, resolve, "Resolver missing");
|
|
9580
9579
|
resolve(void 0);
|
|
9581
9580
|
} else {
|
|
9582
9581
|
this._acquired = false;
|
|
@@ -9659,7 +9658,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9659
9658
|
isMobileSafari: false
|
|
9660
9659
|
};
|
|
9661
9660
|
clientType.isMobileSafari = clientType.isMobile && clientType.isSafari;
|
|
9662
|
-
const logger$
|
|
9661
|
+
const logger$4Q = getLogger("dom-utils");
|
|
9663
9662
|
function addClass(dom, ...className) {
|
|
9664
9663
|
if (dom && dom.nodeType === Node.ELEMENT_NODE) {
|
|
9665
9664
|
dom.classList.add(...className);
|
|
@@ -9713,7 +9712,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9713
9712
|
range.setStart(node, offset);
|
|
9714
9713
|
return range;
|
|
9715
9714
|
} catch (err) {
|
|
9716
|
-
assert(logger$
|
|
9715
|
+
assert(logger$4Q, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
|
|
9717
9716
|
}
|
|
9718
9717
|
}
|
|
9719
9718
|
function createExpandedRange(startNode, startOffset, endNode, endOffset) {
|
|
@@ -9723,17 +9722,17 @@ var __publicField = (obj, key, value) => {
|
|
|
9723
9722
|
range.setEnd(endNode, endOffset);
|
|
9724
9723
|
return range;
|
|
9725
9724
|
} catch (err) {
|
|
9726
|
-
assert(logger$
|
|
9725
|
+
assert(logger$4Q, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
|
|
9727
9726
|
}
|
|
9728
9727
|
}
|
|
9729
9728
|
function getFirstClientRect(elem) {
|
|
9730
9729
|
const rects = elem.getClientRects();
|
|
9731
|
-
assert(logger$
|
|
9730
|
+
assert(logger$4Q, rects.length >= 1, "getFirstClientRect: no rects");
|
|
9732
9731
|
return rects[0];
|
|
9733
9732
|
}
|
|
9734
9733
|
function getLastClientRect(elem) {
|
|
9735
9734
|
const rects = elem.getClientRects();
|
|
9736
|
-
assert(logger$
|
|
9735
|
+
assert(logger$4Q, rects.length >= 1, "getLastClientRect: no rects");
|
|
9737
9736
|
return rects[rects.length - 1];
|
|
9738
9737
|
}
|
|
9739
9738
|
function getDistanceSquare(rect, x, y) {
|
|
@@ -9780,7 +9779,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9780
9779
|
return 0;
|
|
9781
9780
|
}
|
|
9782
9781
|
if (!elem1.parentElement || !elem2.parentElement) {
|
|
9783
|
-
assert(logger$
|
|
9782
|
+
assert(logger$4Q, false, "invalid dom node to compare");
|
|
9784
9783
|
}
|
|
9785
9784
|
if (elem1.parentElement === elem2.parentElement) {
|
|
9786
9785
|
const children = Array.from(elem1.parentElement.children);
|
|
@@ -9797,7 +9796,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9797
9796
|
const parents1 = getParents(elem1);
|
|
9798
9797
|
const parents2 = getParents(elem2);
|
|
9799
9798
|
if (parents1[0] !== parents2[0]) {
|
|
9800
|
-
assert(logger$
|
|
9799
|
+
assert(logger$4Q, false, "invalid dom node to compare, different tree");
|
|
9801
9800
|
}
|
|
9802
9801
|
for (let i = 1; ; i++) {
|
|
9803
9802
|
const parent1 = parents1[i];
|
|
@@ -10397,7 +10396,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10397
10396
|
}
|
|
10398
10397
|
}
|
|
10399
10398
|
const MIN_DISTANCE_THRESHOLD$3 = 3;
|
|
10400
|
-
const logger$
|
|
10399
|
+
const logger$4P = getLogger("drag-drop");
|
|
10401
10400
|
class DragDrop {
|
|
10402
10401
|
constructor(options) {
|
|
10403
10402
|
__publicField(this, "dragStarted", false);
|
|
@@ -10418,7 +10417,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10418
10417
|
var _a;
|
|
10419
10418
|
event.preventDefault();
|
|
10420
10419
|
event.stopPropagation();
|
|
10421
|
-
assert(logger$
|
|
10420
|
+
assert(logger$4P, this.mouseDownEvent, "no mouse down event");
|
|
10422
10421
|
const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
|
|
10423
10422
|
const newPos = DragDrop.getEventPosition(event);
|
|
10424
10423
|
const deltaX = newPos.x - oldPos.x;
|
|
@@ -10434,7 +10433,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10434
10433
|
});
|
|
10435
10434
|
__publicField(this, "handleMouseUp", (event) => {
|
|
10436
10435
|
if (event instanceof MouseEvent && event.button === 0 || event instanceof TouchEvent) {
|
|
10437
|
-
assert(logger$
|
|
10436
|
+
assert(logger$4P, this.mouseDownEvent, "no mouse down event");
|
|
10438
10437
|
const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
|
|
10439
10438
|
const newPos = DragDrop.getEventPosition(event);
|
|
10440
10439
|
const deltaX = newPos.x - oldPos.x;
|
|
@@ -10543,7 +10542,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10543
10542
|
const dragDrop = new DragDrop(options);
|
|
10544
10543
|
return dragDrop;
|
|
10545
10544
|
}
|
|
10546
|
-
const logger$
|
|
10545
|
+
const logger$4O = getLogger("character");
|
|
10547
10546
|
function checkChar(charCode, rangeList) {
|
|
10548
10547
|
for (let i = 0; i < rangeList.length; i++) {
|
|
10549
10548
|
const start = rangeList[i][0];
|
|
@@ -10588,9 +10587,13 @@ var __publicField = (obj, key, value) => {
|
|
|
10588
10587
|
];
|
|
10589
10588
|
return checkChar(str.charCodeAt(0), CJKRange);
|
|
10590
10589
|
}
|
|
10590
|
+
function isCJKPunctuation(char) {
|
|
10591
|
+
const reg = /[\u3000-\u303F\uFF00-\uFFEF\u2000-\u206F\u2E00-\u2E7F]/;
|
|
10592
|
+
return reg.test(char);
|
|
10593
|
+
}
|
|
10591
10594
|
function trimChar(s, char) {
|
|
10592
10595
|
let c = char;
|
|
10593
|
-
assert(logger$
|
|
10596
|
+
assert(logger$4O, c.length === 1, "invalid char length");
|
|
10594
10597
|
if (c === "]")
|
|
10595
10598
|
c = "\\]";
|
|
10596
10599
|
if (c === "\\")
|
|
@@ -10931,7 +10934,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10931
10934
|
return 200;
|
|
10932
10935
|
}
|
|
10933
10936
|
}
|
|
10934
|
-
const logger$
|
|
10937
|
+
const logger$4N = getLogger("editor-clipboard");
|
|
10935
10938
|
async function setClipboardDataByEvent(items, event) {
|
|
10936
10939
|
if (event.clipboardData) {
|
|
10937
10940
|
const data2 = event.clipboardData;
|
|
@@ -10989,7 +10992,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10989
10992
|
document.body.removeChild(textarea2);
|
|
10990
10993
|
return true;
|
|
10991
10994
|
} catch (ex) {
|
|
10992
|
-
logger$
|
|
10995
|
+
logger$4N.error(ex);
|
|
10993
10996
|
document.body.removeChild(textarea2);
|
|
10994
10997
|
return false;
|
|
10995
10998
|
}
|
|
@@ -11010,7 +11013,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11010
11013
|
document.body.removeChild(div);
|
|
11011
11014
|
return true;
|
|
11012
11015
|
} catch (ex) {
|
|
11013
|
-
logger$
|
|
11016
|
+
logger$4N.error(ex);
|
|
11014
11017
|
document.body.removeChild(div);
|
|
11015
11018
|
return false;
|
|
11016
11019
|
}
|
|
@@ -11037,7 +11040,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11037
11040
|
await navigator.clipboard.write([clipboardItems]);
|
|
11038
11041
|
return true;
|
|
11039
11042
|
} catch (err) {
|
|
11040
|
-
logger$
|
|
11043
|
+
logger$4N.error(err);
|
|
11041
11044
|
return await execCommandCopy(items);
|
|
11042
11045
|
}
|
|
11043
11046
|
}
|
|
@@ -11093,7 +11096,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11093
11096
|
a.click();
|
|
11094
11097
|
a.remove();
|
|
11095
11098
|
}
|
|
11096
|
-
const logger$
|
|
11099
|
+
const logger$4M = getLogger("auto-scroll");
|
|
11097
11100
|
function scrollable(scrollElement, direction) {
|
|
11098
11101
|
if (scrollElement.scrollHeight === scrollElement.clientHeight) {
|
|
11099
11102
|
return false;
|
|
@@ -11117,7 +11120,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11117
11120
|
const isHorizontal = direction === "left" || direction === "right";
|
|
11118
11121
|
const scroll = () => {
|
|
11119
11122
|
if (!scrollable(scrollElement, direction)) {
|
|
11120
|
-
logger$
|
|
11123
|
+
logger$4M.debug("No need for scroll");
|
|
11121
11124
|
return null;
|
|
11122
11125
|
}
|
|
11123
11126
|
if (isHorizontal) {
|
|
@@ -11174,7 +11177,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11174
11177
|
if (this.scrolling) {
|
|
11175
11178
|
return;
|
|
11176
11179
|
}
|
|
11177
|
-
logger$
|
|
11180
|
+
logger$4M.debug(`scroll direction: ${direction}`);
|
|
11178
11181
|
this.cancelScroll = continuousScroll(scrollElement, {
|
|
11179
11182
|
direction,
|
|
11180
11183
|
step
|
|
@@ -11424,7 +11427,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11424
11427
|
const colorIndex = Math.abs(typeof content === "string" && content.trim() ? hashCode(content.trim()) : 0) % ColorNames.length;
|
|
11425
11428
|
return ColorNames[colorIndex];
|
|
11426
11429
|
}
|
|
11427
|
-
const logger$
|
|
11430
|
+
const logger$4L = getLogger("container");
|
|
11428
11431
|
function isContainer(elem) {
|
|
11429
11432
|
return elem.getAttribute("data-type") === "editor-container";
|
|
11430
11433
|
}
|
|
@@ -11436,9 +11439,9 @@ var __publicField = (obj, key, value) => {
|
|
|
11436
11439
|
}
|
|
11437
11440
|
function getContainerId(container) {
|
|
11438
11441
|
const id = container.getAttribute("data-container-id");
|
|
11439
|
-
assert(logger$
|
|
11442
|
+
assert(logger$4L, id, "no id for container");
|
|
11440
11443
|
if (isRootContainer(container)) {
|
|
11441
|
-
assert(logger$
|
|
11444
|
+
assert(logger$4L, id === "root", `invalid root container id, : ${id}`);
|
|
11442
11445
|
}
|
|
11443
11446
|
return id;
|
|
11444
11447
|
}
|
|
@@ -11449,7 +11452,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11449
11452
|
function generateEditorContainerId(containerId) {
|
|
11450
11453
|
return `ones-editor-container-${containerId}`;
|
|
11451
11454
|
}
|
|
11452
|
-
const logger$
|
|
11455
|
+
const logger$4K = getLogger("element");
|
|
11453
11456
|
function createContainerElement(parent, type, containerId) {
|
|
11454
11457
|
const container = createElement("div", [type], parent);
|
|
11455
11458
|
container.setAttribute("data-type", "editor-container");
|
|
@@ -11460,7 +11463,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11460
11463
|
}
|
|
11461
11464
|
function getContainerById(editor, containerId) {
|
|
11462
11465
|
const container = editor.rootElement.querySelector(`[data-container-id=${containerId}]`);
|
|
11463
|
-
assert(logger$
|
|
11466
|
+
assert(logger$4K, container, `no container: ${containerId}`);
|
|
11464
11467
|
return container;
|
|
11465
11468
|
}
|
|
11466
11469
|
function getExistsContainerById(editor, containerId) {
|
|
@@ -11469,7 +11472,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11469
11472
|
}
|
|
11470
11473
|
function getContainerBlocksElement(container) {
|
|
11471
11474
|
const blocks = container.querySelector(":scope > .container-blocks");
|
|
11472
|
-
assert(logger$
|
|
11475
|
+
assert(logger$4K, blocks, "no container blocks element");
|
|
11473
11476
|
return blocks;
|
|
11474
11477
|
}
|
|
11475
11478
|
function getContainerToolsElement(container) {
|
|
@@ -11482,11 +11485,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11482
11485
|
function isContainerBlocksElement(element) {
|
|
11483
11486
|
return element.classList.contains("container-blocks");
|
|
11484
11487
|
}
|
|
11485
|
-
const logger$
|
|
11488
|
+
const logger$4J = getLogger("container-children");
|
|
11486
11489
|
function getChildBlocks(container, traverseChild) {
|
|
11487
11490
|
const content = getContainerBlocksElement(container);
|
|
11488
11491
|
const blocks = Array.from(content.children);
|
|
11489
|
-
assert(logger$
|
|
11492
|
+
assert(logger$4J, blocks.length > 0, "container have not any child block");
|
|
11490
11493
|
if (traverseChild) {
|
|
11491
11494
|
const { condition, editor } = traverseChild;
|
|
11492
11495
|
return blocks.reduce((result, block) => {
|
|
@@ -11509,7 +11512,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11509
11512
|
}
|
|
11510
11513
|
function getFirstChildBlock(container) {
|
|
11511
11514
|
const block = container.querySelector(":scope > .container-blocks > div[data-type=editor-block]");
|
|
11512
|
-
assert(logger$
|
|
11515
|
+
assert(logger$4J, block, "container have not any child block");
|
|
11513
11516
|
return block;
|
|
11514
11517
|
}
|
|
11515
11518
|
function getLastChildBlock(container) {
|
|
@@ -11521,14 +11524,14 @@ var __publicField = (obj, key, value) => {
|
|
|
11521
11524
|
}
|
|
11522
11525
|
function getBlockByIndex(container, blockIndex) {
|
|
11523
11526
|
const block = getChildBlocks(container)[blockIndex];
|
|
11524
|
-
assert(logger$
|
|
11527
|
+
assert(logger$4J, block, `container have not block at index ${blockIndex}`);
|
|
11525
11528
|
return block;
|
|
11526
11529
|
}
|
|
11527
11530
|
function findBlockByIndex(container, blockIndex) {
|
|
11528
11531
|
var _a;
|
|
11529
11532
|
return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
|
|
11530
11533
|
}
|
|
11531
|
-
const logger$
|
|
11534
|
+
const logger$4I = getLogger("block-dom");
|
|
11532
11535
|
function isBlock$1(node) {
|
|
11533
11536
|
if (!(node instanceof HTMLDivElement)) {
|
|
11534
11537
|
return false;
|
|
@@ -11549,12 +11552,12 @@ var __publicField = (obj, key, value) => {
|
|
|
11549
11552
|
}
|
|
11550
11553
|
function getBlockId(block) {
|
|
11551
11554
|
const { id } = block;
|
|
11552
|
-
assert(logger$
|
|
11555
|
+
assert(logger$4I, id, "no block id");
|
|
11553
11556
|
return id;
|
|
11554
11557
|
}
|
|
11555
11558
|
function getBlockType(block) {
|
|
11556
11559
|
const type = block.getAttribute("data-block-type");
|
|
11557
|
-
assert(logger$
|
|
11560
|
+
assert(logger$4I, type, "invalid block dom, no data-type");
|
|
11558
11561
|
return type;
|
|
11559
11562
|
}
|
|
11560
11563
|
function getParentBlock(node) {
|
|
@@ -11577,12 +11580,12 @@ var __publicField = (obj, key, value) => {
|
|
|
11577
11580
|
}
|
|
11578
11581
|
function getParentContainer(block) {
|
|
11579
11582
|
const container = block.closest("div[data-type=editor-container]");
|
|
11580
|
-
assert(logger$
|
|
11583
|
+
assert(logger$4I, container, "failed to get block container");
|
|
11581
11584
|
return container;
|
|
11582
11585
|
}
|
|
11583
11586
|
function getBlockContent(block) {
|
|
11584
11587
|
const content = block.querySelector(":scope >div[data-type=block-content]");
|
|
11585
|
-
assert(logger$
|
|
11588
|
+
assert(logger$4I, content, "no block content");
|
|
11586
11589
|
return content;
|
|
11587
11590
|
}
|
|
11588
11591
|
function getBlockTools(block) {
|
|
@@ -11591,7 +11594,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11591
11594
|
tools = createElement("div", [], block);
|
|
11592
11595
|
tools.setAttribute("data-type", "block-tools");
|
|
11593
11596
|
}
|
|
11594
|
-
assert(logger$
|
|
11597
|
+
assert(logger$4I, tools, "no block tools");
|
|
11595
11598
|
return tools;
|
|
11596
11599
|
}
|
|
11597
11600
|
function getExistsBlockTools(block) {
|
|
@@ -11612,7 +11615,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11612
11615
|
function createBlockElement(editor, path, data2) {
|
|
11613
11616
|
const blockData = editor.editorDecorators.decorateBlock(path, data2);
|
|
11614
11617
|
const { id, type } = blockData;
|
|
11615
|
-
assert(logger$
|
|
11618
|
+
assert(logger$4I, id, "no block id");
|
|
11616
11619
|
const elem = createElement("div", [`${type}-block`], null);
|
|
11617
11620
|
elem.id = id;
|
|
11618
11621
|
elem.setAttribute("data-type", "editor-block");
|
|
@@ -11650,7 +11653,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11650
11653
|
}
|
|
11651
11654
|
function getBoxTypeFromElement(box) {
|
|
11652
11655
|
const type = box.getAttribute("data-box-type");
|
|
11653
|
-
assert(logger$
|
|
11656
|
+
assert(logger$4I, type, "not a valid box element, no type");
|
|
11654
11657
|
return type;
|
|
11655
11658
|
}
|
|
11656
11659
|
function isBox(node) {
|
|
@@ -11661,7 +11664,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11661
11664
|
}
|
|
11662
11665
|
function getBoxId(box) {
|
|
11663
11666
|
const { id } = box;
|
|
11664
|
-
assert(logger$
|
|
11667
|
+
assert(logger$4I, id, "no box id");
|
|
11665
11668
|
return id;
|
|
11666
11669
|
}
|
|
11667
11670
|
function getParentBox(node) {
|
|
@@ -11683,7 +11686,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11683
11686
|
}
|
|
11684
11687
|
function getBoxContent(box) {
|
|
11685
11688
|
const content = box.querySelector("span[data-type=box-content]");
|
|
11686
|
-
assert(logger$
|
|
11689
|
+
assert(logger$4I, content, "invalid box dom, no content");
|
|
11687
11690
|
return content;
|
|
11688
11691
|
}
|
|
11689
11692
|
function createInsertionElement(type, id, attributes) {
|
|
@@ -11705,7 +11708,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11705
11708
|
}
|
|
11706
11709
|
function getInsertionContent(insertion) {
|
|
11707
11710
|
const content = insertion.querySelector("span[data-type=insertion-content]");
|
|
11708
|
-
assert(logger$
|
|
11711
|
+
assert(logger$4I, content, "invalid insertion-child dom, no content");
|
|
11709
11712
|
return content;
|
|
11710
11713
|
}
|
|
11711
11714
|
function getPrevBlock(block) {
|
|
@@ -11728,31 +11731,44 @@ var __publicField = (obj, key, value) => {
|
|
|
11728
11731
|
}
|
|
11729
11732
|
return null;
|
|
11730
11733
|
}
|
|
11731
|
-
function getPrevVisibleBlock(block) {
|
|
11734
|
+
function getPrevVisibleBlock(block, matcher) {
|
|
11735
|
+
const mergedMatcher = matcher || (() => true);
|
|
11732
11736
|
let prev = block.previousElementSibling;
|
|
11733
11737
|
while (prev) {
|
|
11734
|
-
if (isBlock$1(prev) && isVisibleBlock(prev)) {
|
|
11738
|
+
if (isBlock$1(prev) && isVisibleBlock(prev) && mergedMatcher(prev)) {
|
|
11735
11739
|
return prev;
|
|
11736
11740
|
}
|
|
11737
11741
|
prev = prev.previousElementSibling;
|
|
11738
11742
|
}
|
|
11739
11743
|
return null;
|
|
11740
11744
|
}
|
|
11741
|
-
function getNextVisibleBlock(block) {
|
|
11745
|
+
function getNextVisibleBlock(block, matcher) {
|
|
11746
|
+
const mergedMatcher = matcher || (() => true);
|
|
11742
11747
|
let next2 = block.nextElementSibling;
|
|
11743
11748
|
while (next2) {
|
|
11744
|
-
if (isBlock$1(next2) && isVisibleBlock(next2)) {
|
|
11749
|
+
if (isBlock$1(next2) && isVisibleBlock(next2) && mergedMatcher(next2)) {
|
|
11745
11750
|
return next2;
|
|
11746
11751
|
}
|
|
11747
11752
|
next2 = next2.nextElementSibling;
|
|
11748
11753
|
}
|
|
11749
11754
|
return null;
|
|
11750
11755
|
}
|
|
11756
|
+
function getBlocksBetween(start, end, matcher) {
|
|
11757
|
+
const blocks = [];
|
|
11758
|
+
let cur = start;
|
|
11759
|
+
while (cur !== end) {
|
|
11760
|
+
if (isBlock$1(cur) && matcher(cur)) {
|
|
11761
|
+
blocks.push(cur);
|
|
11762
|
+
}
|
|
11763
|
+
cur = cur.nextElementSibling;
|
|
11764
|
+
}
|
|
11765
|
+
return blocks;
|
|
11766
|
+
}
|
|
11751
11767
|
function getBlockIndex(block) {
|
|
11752
11768
|
const container = getParentContainer(block);
|
|
11753
11769
|
const children = getChildBlocks(container);
|
|
11754
11770
|
const index2 = children.indexOf(block);
|
|
11755
|
-
assert(logger$
|
|
11771
|
+
assert(logger$4I, index2 !== -1, "invalid block & container dom, failed to get block index");
|
|
11756
11772
|
return index2;
|
|
11757
11773
|
}
|
|
11758
11774
|
function isInBlock(target) {
|
|
@@ -11777,18 +11793,18 @@ var __publicField = (obj, key, value) => {
|
|
|
11777
11793
|
function isTitleBlock$2(block) {
|
|
11778
11794
|
return block.hasAttribute("data-document-title");
|
|
11779
11795
|
}
|
|
11780
|
-
const logger$
|
|
11796
|
+
const logger$4H = getLogger("block-class");
|
|
11781
11797
|
function getBlockClass(editor, block) {
|
|
11782
11798
|
return editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
11783
11799
|
}
|
|
11784
11800
|
function getTextBlockClass(editor, block) {
|
|
11785
11801
|
const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
11786
|
-
assert(logger$
|
|
11802
|
+
assert(logger$4H, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
|
|
11787
11803
|
return text2;
|
|
11788
11804
|
}
|
|
11789
11805
|
function getComplexBlockClass(editor, block) {
|
|
11790
11806
|
const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
11791
|
-
assert(logger$
|
|
11807
|
+
assert(logger$4H, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
|
|
11792
11808
|
return complex;
|
|
11793
11809
|
}
|
|
11794
11810
|
function getBlockClassByType(editor, type) {
|
|
@@ -11809,7 +11825,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11809
11825
|
function getBlockKind(editor, block) {
|
|
11810
11826
|
return getBlockClass(editor, block).blockKind;
|
|
11811
11827
|
}
|
|
11812
|
-
const logger$
|
|
11828
|
+
const logger$4G = getLogger("text-block-child");
|
|
11813
11829
|
function isTextBlockContentChild(elem) {
|
|
11814
11830
|
if (elem.tagName !== "SPAN") {
|
|
11815
11831
|
return false;
|
|
@@ -11817,14 +11833,14 @@ var __publicField = (obj, key, value) => {
|
|
|
11817
11833
|
return true;
|
|
11818
11834
|
}
|
|
11819
11835
|
function isTextBlockContentBoxChild(elem) {
|
|
11820
|
-
assert(logger$
|
|
11836
|
+
assert(logger$4G, isTextBlockContentChild(elem), "not a valid text child");
|
|
11821
11837
|
if (elem.getAttribute("data-type") === "editor-box") {
|
|
11822
11838
|
return true;
|
|
11823
11839
|
}
|
|
11824
11840
|
return false;
|
|
11825
11841
|
}
|
|
11826
11842
|
function isTextBlockContentInsertionChild(elem) {
|
|
11827
|
-
assert(logger$
|
|
11843
|
+
assert(logger$4G, isTextBlockContentChild(elem), "not a valid text child");
|
|
11828
11844
|
if (elem.getAttribute("data-type") === "editor-insertion") {
|
|
11829
11845
|
return true;
|
|
11830
11846
|
}
|
|
@@ -11834,7 +11850,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11834
11850
|
return !isTextBlockContentBoxChild(elem) && !isTextBlockContentInsertionChild(elem);
|
|
11835
11851
|
}
|
|
11836
11852
|
function getTextBlockContentChildType(child) {
|
|
11837
|
-
assert(logger$
|
|
11853
|
+
assert(logger$4G, isTextBlockContentChild(child), "not a valid text child");
|
|
11838
11854
|
if (isTextBlockContentBoxChild(child)) {
|
|
11839
11855
|
return "box";
|
|
11840
11856
|
}
|
|
@@ -11849,15 +11865,15 @@ var __publicField = (obj, key, value) => {
|
|
|
11849
11865
|
return 0;
|
|
11850
11866
|
if (type === "box")
|
|
11851
11867
|
return 1;
|
|
11852
|
-
assert(logger$
|
|
11853
|
-
assert(logger$
|
|
11868
|
+
assert(logger$4G, child.textContent !== null, "text block content is undefined");
|
|
11869
|
+
assert(logger$4G, child.textContent.length >= 0, "text block content length is negative");
|
|
11854
11870
|
return child.textContent.length;
|
|
11855
11871
|
}
|
|
11856
11872
|
function getTextBlockContentChildren(block) {
|
|
11857
11873
|
const content = getBlockContent(block);
|
|
11858
11874
|
const children = Array.from(content.children);
|
|
11859
11875
|
children.forEach((child) => {
|
|
11860
|
-
assert(logger$
|
|
11876
|
+
assert(logger$4G, isTextBlockContentChild(child), "not a valid text child");
|
|
11861
11877
|
});
|
|
11862
11878
|
return children;
|
|
11863
11879
|
}
|
|
@@ -11886,17 +11902,17 @@ var __publicField = (obj, key, value) => {
|
|
|
11886
11902
|
};
|
|
11887
11903
|
}
|
|
11888
11904
|
const offset = blockOffset - start;
|
|
11889
|
-
assert(logger$
|
|
11890
|
-
assert(logger$
|
|
11905
|
+
assert(logger$4G, offset > 0, "invalid offset value");
|
|
11906
|
+
assert(logger$4G, !isTextBlockContentBoxChild(child), "invalid box child");
|
|
11891
11907
|
return {
|
|
11892
11908
|
prev: child,
|
|
11893
11909
|
next: child,
|
|
11894
11910
|
offset
|
|
11895
11911
|
};
|
|
11896
11912
|
}
|
|
11897
|
-
assert(logger$
|
|
11913
|
+
assert(logger$4G, false, `invalid block child at position: ${blockOffset}`);
|
|
11898
11914
|
}
|
|
11899
|
-
const logger$
|
|
11915
|
+
const logger$4F = getLogger("block-path");
|
|
11900
11916
|
function getBlockPath(block) {
|
|
11901
11917
|
const ret = [];
|
|
11902
11918
|
let current = block;
|
|
@@ -11910,26 +11926,26 @@ var __publicField = (obj, key, value) => {
|
|
|
11910
11926
|
return ret;
|
|
11911
11927
|
}
|
|
11912
11928
|
const parentBlock = getParentBlock(container);
|
|
11913
|
-
assert(logger$
|
|
11929
|
+
assert(logger$4F, parentBlock, "no parent block");
|
|
11914
11930
|
current = parentBlock;
|
|
11915
11931
|
}
|
|
11916
|
-
assert(logger$
|
|
11932
|
+
assert(logger$4F, false, "no parent block");
|
|
11917
11933
|
return [];
|
|
11918
11934
|
}
|
|
11919
|
-
const logger$
|
|
11935
|
+
const logger$4E = getLogger("child-container-path");
|
|
11920
11936
|
function getContainerBlockPath(container) {
|
|
11921
11937
|
if (isRootContainer(container)) {
|
|
11922
11938
|
return [];
|
|
11923
11939
|
}
|
|
11924
11940
|
const parentBlock = getParentBlock(container);
|
|
11925
|
-
assert(logger$
|
|
11941
|
+
assert(logger$4E, parentBlock, "no parent block");
|
|
11926
11942
|
return getBlockPath(parentBlock);
|
|
11927
11943
|
}
|
|
11928
|
-
const logger$
|
|
11944
|
+
const logger$4D = getLogger("load-blocks");
|
|
11929
11945
|
function loadBlocks(editor, container, path) {
|
|
11930
11946
|
const containerId = getContainerId(container);
|
|
11931
11947
|
const blocks = getContainerBlocks$1(container, editor.doc);
|
|
11932
|
-
assert(logger$
|
|
11948
|
+
assert(logger$4D, blocks.length > 0, "no blocks in container");
|
|
11933
11949
|
const fragment = document.createDocumentFragment();
|
|
11934
11950
|
blocks.forEach((b, index2) => {
|
|
11935
11951
|
const block = editor.editorBlocks.createBlock([...path, { containerId, blockIndex: index2 }], container, b);
|
|
@@ -11945,7 +11961,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11945
11961
|
return block;
|
|
11946
11962
|
}
|
|
11947
11963
|
const blocks = getChildBlocks(container);
|
|
11948
|
-
assert(logger$
|
|
11964
|
+
assert(logger$4D, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
|
|
11949
11965
|
if (blockIndex === blocks.length) {
|
|
11950
11966
|
containerBlocksElement.appendChild(block);
|
|
11951
11967
|
} else {
|
|
@@ -11963,7 +11979,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11963
11979
|
insertBlockAt(container, blockIndex, block);
|
|
11964
11980
|
return block;
|
|
11965
11981
|
}
|
|
11966
|
-
const logger$
|
|
11982
|
+
const logger$4C = getLogger("root-container");
|
|
11967
11983
|
const MIN_DISTANCE_THRESHOLD$2 = 3;
|
|
11968
11984
|
class RootContainer {
|
|
11969
11985
|
constructor(editor, rootContainer) {
|
|
@@ -11991,7 +12007,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11991
12007
|
this.editor.selection.updateSelection(null);
|
|
11992
12008
|
this.editor.emit("resize", this.editor);
|
|
11993
12009
|
} catch (err) {
|
|
11994
|
-
logger$
|
|
12010
|
+
logger$4C.warn(`failed to update selection while container resizing: ${err.message}`);
|
|
11995
12011
|
}
|
|
11996
12012
|
});
|
|
11997
12013
|
__publicField(this, "handleClick", (event) => {
|
|
@@ -12024,7 +12040,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12024
12040
|
const box = getParentBox(elem);
|
|
12025
12041
|
if (box) {
|
|
12026
12042
|
const block2 = getParentBlock(box);
|
|
12027
|
-
assert(logger$
|
|
12043
|
+
assert(logger$4C, block2, "no parent block");
|
|
12028
12044
|
(_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
|
|
12029
12045
|
return;
|
|
12030
12046
|
}
|
|
@@ -12079,7 +12095,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12079
12095
|
this.editor.input.focus({ preventScroll: true });
|
|
12080
12096
|
});
|
|
12081
12097
|
__publicField(this, "handleMouseMove", (event) => {
|
|
12082
|
-
assert(logger$
|
|
12098
|
+
assert(logger$4C, this.mouseDownEvent, "no mouse down event");
|
|
12083
12099
|
if (ensureIsMobileEvent(this.mouseDownEvent))
|
|
12084
12100
|
return;
|
|
12085
12101
|
const deltaX = event.x - this.mouseDownEvent.x;
|
|
@@ -12195,7 +12211,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12195
12211
|
loadBlocks(editor, container, path);
|
|
12196
12212
|
return container;
|
|
12197
12213
|
}
|
|
12198
|
-
const logger$
|
|
12214
|
+
const logger$4B = getLogger("block");
|
|
12199
12215
|
function getBlockTextLength$6(editor, block) {
|
|
12200
12216
|
return getBlockClass(editor, block).getBlockTextLength(block);
|
|
12201
12217
|
}
|
|
@@ -12214,7 +12230,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12214
12230
|
return block;
|
|
12215
12231
|
}
|
|
12216
12232
|
const parent = getParentBlock(container);
|
|
12217
|
-
assert(logger$
|
|
12233
|
+
assert(logger$4B, parent, "no parent block exists for child container");
|
|
12218
12234
|
block = parent;
|
|
12219
12235
|
}
|
|
12220
12236
|
}
|
|
@@ -12250,7 +12266,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12250
12266
|
}
|
|
12251
12267
|
return fun(editor, block, options);
|
|
12252
12268
|
} catch (err) {
|
|
12253
|
-
logger$
|
|
12269
|
+
logger$4B.debug(`unsupported block type: ${type}`);
|
|
12254
12270
|
return null;
|
|
12255
12271
|
}
|
|
12256
12272
|
}
|
|
@@ -12270,7 +12286,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12270
12286
|
const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
|
|
12271
12287
|
Object.entries(styles).forEach(([, value]) => {
|
|
12272
12288
|
const type = typeof value;
|
|
12273
|
-
assert(logger$
|
|
12289
|
+
assert(logger$4B, type === "string" || type === "number" || type === "boolean", "invalid style value");
|
|
12274
12290
|
});
|
|
12275
12291
|
return styles;
|
|
12276
12292
|
}
|
|
@@ -12395,7 +12411,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12395
12411
|
}
|
|
12396
12412
|
return { element: null, blockCommands: [], boxCommands: [] };
|
|
12397
12413
|
}
|
|
12398
|
-
const logger$
|
|
12414
|
+
const logger$4A = getLogger("embed-block-common");
|
|
12399
12415
|
function isColumnsBlock(block) {
|
|
12400
12416
|
return getBlockType(block) === "layout";
|
|
12401
12417
|
}
|
|
@@ -12403,9 +12419,9 @@ var __publicField = (obj, key, value) => {
|
|
|
12403
12419
|
return getBlockType(block) === "embed";
|
|
12404
12420
|
}
|
|
12405
12421
|
function getEmbedType(block) {
|
|
12406
|
-
assert(logger$
|
|
12422
|
+
assert(logger$4A, isEmbedBlock(block), "not an embed block");
|
|
12407
12423
|
const type = block.getAttribute("data-embed-type");
|
|
12408
|
-
assert(logger$
|
|
12424
|
+
assert(logger$4A, type, "no embed data type");
|
|
12409
12425
|
return type;
|
|
12410
12426
|
}
|
|
12411
12427
|
function getEmbedClassFromBlock(editor, block) {
|
|
@@ -12471,10 +12487,10 @@ var __publicField = (obj, key, value) => {
|
|
|
12471
12487
|
data: (_c = overrideOptions == null ? void 0 : overrideOptions.data) != null ? _c : data2
|
|
12472
12488
|
});
|
|
12473
12489
|
}
|
|
12474
|
-
const logger$
|
|
12490
|
+
const logger$4z = getLogger("execute-block-command");
|
|
12475
12491
|
function executeEmbedBlockCommand(editor, block, commandGroup, item) {
|
|
12476
12492
|
var _a;
|
|
12477
|
-
assert(logger$
|
|
12493
|
+
assert(logger$4z, isEmbedBlock(block), "not a embed block");
|
|
12478
12494
|
const embedType = getEmbedType(block);
|
|
12479
12495
|
const embed = getEmbedClassByType(editor, embedType);
|
|
12480
12496
|
if (!embed.getOptions) {
|
|
@@ -12507,14 +12523,14 @@ var __publicField = (obj, key, value) => {
|
|
|
12507
12523
|
}
|
|
12508
12524
|
return void 0;
|
|
12509
12525
|
}
|
|
12510
|
-
const logger$
|
|
12526
|
+
const logger$4y = getLogger("block-class");
|
|
12511
12527
|
function isHeadingBlock$1(block) {
|
|
12512
12528
|
return !!block.getAttribute("data-style-heading");
|
|
12513
12529
|
}
|
|
12514
12530
|
function getBlockHeading(block) {
|
|
12515
12531
|
var _a;
|
|
12516
12532
|
const heading = Number.parseInt((_a = block.getAttribute("data-style-heading")) != null ? _a : "", 10);
|
|
12517
|
-
assert(logger$
|
|
12533
|
+
assert(logger$4y, heading, "not a heading block");
|
|
12518
12534
|
return heading;
|
|
12519
12535
|
}
|
|
12520
12536
|
function isExpandedHeadingBlock(block) {
|
|
@@ -12525,7 +12541,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12525
12541
|
}
|
|
12526
12542
|
function getHeadingBlockChildren(block, oldHeading) {
|
|
12527
12543
|
if (!oldHeading) {
|
|
12528
|
-
assert(logger$
|
|
12544
|
+
assert(logger$4y, isHeadingBlock$1(block), "not a heading block");
|
|
12529
12545
|
}
|
|
12530
12546
|
const children = [];
|
|
12531
12547
|
const heading = oldHeading != null ? oldHeading : getBlockHeading(block);
|
|
@@ -12555,7 +12571,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12555
12571
|
}
|
|
12556
12572
|
return children;
|
|
12557
12573
|
}
|
|
12558
|
-
const logger$
|
|
12574
|
+
const logger$4x = getLogger("complex-block-position");
|
|
12559
12575
|
class EditorComplexBlockPosition {
|
|
12560
12576
|
constructor(block, childContainerId, custom) {
|
|
12561
12577
|
__publicField(this, "blockId");
|
|
@@ -12564,7 +12580,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12564
12580
|
if (block instanceof HTMLElement) {
|
|
12565
12581
|
this.blockId = getBlockId(block);
|
|
12566
12582
|
} else {
|
|
12567
|
-
assert(logger$
|
|
12583
|
+
assert(logger$4x, typeof block === "string", `not a valid block id: ${block}`);
|
|
12568
12584
|
this.blockId = block;
|
|
12569
12585
|
}
|
|
12570
12586
|
this.childContainerId = childContainerId;
|
|
@@ -12576,7 +12592,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12576
12592
|
return false;
|
|
12577
12593
|
}
|
|
12578
12594
|
}
|
|
12579
|
-
const logger$
|
|
12595
|
+
const logger$4w = getLogger("simple-block-position");
|
|
12580
12596
|
class EditorSimpleBlockPosition {
|
|
12581
12597
|
constructor(block, offset, type) {
|
|
12582
12598
|
__publicField(this, "blockId");
|
|
@@ -12585,7 +12601,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12585
12601
|
if (block instanceof HTMLElement) {
|
|
12586
12602
|
this.blockId = getBlockId(block);
|
|
12587
12603
|
} else {
|
|
12588
|
-
assert(logger$
|
|
12604
|
+
assert(logger$4w, typeof block === "string", `not a valid block id: ${block}`);
|
|
12589
12605
|
this.blockId = block;
|
|
12590
12606
|
}
|
|
12591
12607
|
this.offset = offset;
|
|
@@ -12595,7 +12611,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12595
12611
|
return true;
|
|
12596
12612
|
}
|
|
12597
12613
|
}
|
|
12598
|
-
const logger$
|
|
12614
|
+
const logger$4v = getLogger("editor-position");
|
|
12599
12615
|
function createSimpleBlockPosition(block, offset, type) {
|
|
12600
12616
|
return new EditorSimpleBlockPosition(block, offset, type);
|
|
12601
12617
|
}
|
|
@@ -12617,7 +12633,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12617
12633
|
}
|
|
12618
12634
|
const block1 = editor.getBlockById(pos1.blockId);
|
|
12619
12635
|
const block2 = editor.getBlockById(pos2.blockId);
|
|
12620
|
-
assert(logger$
|
|
12636
|
+
assert(logger$4v, block1 !== block2, "comparePosition: blocks are the same");
|
|
12621
12637
|
return compareElement(block1, block2);
|
|
12622
12638
|
}
|
|
12623
12639
|
if (isComplexBlockPosition(pos1) && isComplexBlockPosition(pos2)) {
|
|
@@ -12628,13 +12644,13 @@ var __publicField = (obj, key, value) => {
|
|
|
12628
12644
|
}
|
|
12629
12645
|
const container1 = editor.getContainerById(p1.childContainerId);
|
|
12630
12646
|
const container2 = editor.getContainerById(p2.childContainerId);
|
|
12631
|
-
assert(logger$
|
|
12647
|
+
assert(logger$4v, container1 !== container2, "comparePosition: containers are the same");
|
|
12632
12648
|
return compareElement(container1, container2);
|
|
12633
12649
|
}
|
|
12634
|
-
assert(logger$
|
|
12650
|
+
assert(logger$4v, false, "invalid ");
|
|
12635
12651
|
return 0;
|
|
12636
12652
|
}
|
|
12637
|
-
const logger$
|
|
12653
|
+
const logger$4u = getLogger("simple-range");
|
|
12638
12654
|
class EditorSimpleSelectionRange {
|
|
12639
12655
|
constructor(editor, options) {
|
|
12640
12656
|
__publicField(this, "editor");
|
|
@@ -12683,11 +12699,11 @@ var __publicField = (obj, key, value) => {
|
|
|
12683
12699
|
const { editor } = this;
|
|
12684
12700
|
const startBlock = editor.getBlockById(this.start.blockId);
|
|
12685
12701
|
const endBlock = editor.getBlockById(this.end.blockId);
|
|
12686
|
-
assert(logger$
|
|
12687
|
-
assert(logger$
|
|
12702
|
+
assert(logger$4u, startBlock, "no start block");
|
|
12703
|
+
assert(logger$4u, endBlock, "no end block");
|
|
12688
12704
|
const startContainer = getParentContainer(startBlock);
|
|
12689
12705
|
const endContainer = getParentContainer(endBlock);
|
|
12690
|
-
assert(logger$
|
|
12706
|
+
assert(logger$4u, startContainer === endContainer, "invalid range");
|
|
12691
12707
|
const ret = [];
|
|
12692
12708
|
if (startBlock === endBlock) {
|
|
12693
12709
|
ret.push({
|
|
@@ -12698,7 +12714,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12698
12714
|
} else {
|
|
12699
12715
|
const startIndex = getBlockIndex(startBlock);
|
|
12700
12716
|
const endIndex = getBlockIndex(endBlock);
|
|
12701
|
-
assert(logger$
|
|
12717
|
+
assert(logger$4u, startIndex < endIndex, "invalid range, start > index");
|
|
12702
12718
|
ret.push({
|
|
12703
12719
|
block: startBlock,
|
|
12704
12720
|
start: this.start,
|
|
@@ -12798,7 +12814,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12798
12814
|
clearSelection: clearSelection$6,
|
|
12799
12815
|
convertTo: convertTo$m
|
|
12800
12816
|
};
|
|
12801
|
-
const logger$
|
|
12817
|
+
const logger$4t = getLogger("editor-blocks");
|
|
12802
12818
|
class EditorBlocks {
|
|
12803
12819
|
constructor(editor) {
|
|
12804
12820
|
__publicField(this, "blocks", /* @__PURE__ */ new Map());
|
|
@@ -12807,12 +12823,12 @@ var __publicField = (obj, key, value) => {
|
|
|
12807
12823
|
registerBlockClass(blockClass) {
|
|
12808
12824
|
const type = blockClass.blockType;
|
|
12809
12825
|
const exists = this.blocks.get(type);
|
|
12810
|
-
assert(logger$
|
|
12826
|
+
assert(logger$4t, !exists, `duplicated block type: ${type}`);
|
|
12811
12827
|
this.blocks.set(type, blockClass);
|
|
12812
12828
|
}
|
|
12813
12829
|
getBlockClass(type) {
|
|
12814
12830
|
const exists = this.blocks.get(type);
|
|
12815
|
-
assert(logger$
|
|
12831
|
+
assert(logger$4t, exists, `unknown block type: ${type}`);
|
|
12816
12832
|
return exists;
|
|
12817
12833
|
}
|
|
12818
12834
|
hasBlock(type) {
|
|
@@ -12828,7 +12844,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12828
12844
|
}
|
|
12829
12845
|
const content = blockClass.createBlockContent(this.editor, path, container, blockElement, block);
|
|
12830
12846
|
if (content.parentElement !== blockElement) {
|
|
12831
|
-
logger$
|
|
12847
|
+
logger$4t.warn("content parent is not block");
|
|
12832
12848
|
blockElement.appendChild(content);
|
|
12833
12849
|
}
|
|
12834
12850
|
this.editor.blockHooks.forEach((hook) => {
|
|
@@ -12849,7 +12865,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12849
12865
|
return newBlock;
|
|
12850
12866
|
}
|
|
12851
12867
|
}
|
|
12852
|
-
const logger$
|
|
12868
|
+
const logger$4s = getLogger("editor-embeds");
|
|
12853
12869
|
class EditorEmbeds {
|
|
12854
12870
|
constructor(editor) {
|
|
12855
12871
|
__publicField(this, "objects", /* @__PURE__ */ new Map());
|
|
@@ -12858,12 +12874,12 @@ var __publicField = (obj, key, value) => {
|
|
|
12858
12874
|
registerEmbedClass(embedClass) {
|
|
12859
12875
|
const type = embedClass.embedType;
|
|
12860
12876
|
const exists = this.objects.get(type);
|
|
12861
|
-
assert(logger$
|
|
12877
|
+
assert(logger$4s, !exists, `duplicated embed object type: ${type}`);
|
|
12862
12878
|
this.objects.set(type, embedClass);
|
|
12863
12879
|
}
|
|
12864
12880
|
getEmbedClass(type) {
|
|
12865
12881
|
const exists = this.objects.get(type);
|
|
12866
|
-
assert(logger$
|
|
12882
|
+
assert(logger$4s, exists, `unknown embed type: ${type}`);
|
|
12867
12883
|
return exists;
|
|
12868
12884
|
}
|
|
12869
12885
|
getEmbedClassFromBlock(block) {
|
|
@@ -12873,12 +12889,12 @@ var __publicField = (obj, key, value) => {
|
|
|
12873
12889
|
this.objects.forEach(callback);
|
|
12874
12890
|
}
|
|
12875
12891
|
}
|
|
12876
|
-
const logger$
|
|
12892
|
+
const logger$4r = getLogger("embed-block");
|
|
12877
12893
|
function createBlockContent$6(editor, path, container, blockElement, blockData) {
|
|
12878
12894
|
const content = createBlockContentElement(blockElement, "div");
|
|
12879
|
-
assert(logger$
|
|
12895
|
+
assert(logger$4r, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
|
|
12880
12896
|
const embedBlockData = blockData;
|
|
12881
|
-
assert(logger$
|
|
12897
|
+
assert(logger$4r, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
|
|
12882
12898
|
const embedClass = editor.editorEmbeds.getEmbedClass(embedBlockData.embedType);
|
|
12883
12899
|
embedClass.createEmbedContent(editor, content, embedBlockData, path, container, blockElement);
|
|
12884
12900
|
blockElement.setAttribute("data-embed-type", embedBlockData.embedType);
|
|
@@ -12906,7 +12922,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12906
12922
|
function getCaretRect$4(block, pos) {
|
|
12907
12923
|
const content = getBlockContent(block);
|
|
12908
12924
|
const rect = content.getBoundingClientRect();
|
|
12909
|
-
assert(logger$
|
|
12925
|
+
assert(logger$4r, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
|
|
12910
12926
|
if (pos.offset === 1) {
|
|
12911
12927
|
return new DOMRect(rect.right, rect.top, 0, rect.height);
|
|
12912
12928
|
}
|
|
@@ -13046,18 +13062,18 @@ var __publicField = (obj, key, value) => {
|
|
|
13046
13062
|
toStandardDoc: toStandardDoc$2,
|
|
13047
13063
|
getResources: getResources$2
|
|
13048
13064
|
};
|
|
13049
|
-
const logger$
|
|
13065
|
+
const logger$4q = getLogger("complex-block-helper");
|
|
13050
13066
|
function complexBlockGetAllChildContainers(editor, block, options) {
|
|
13051
13067
|
const blockClass = getComplexBlockClass(editor, block);
|
|
13052
13068
|
return blockClass.getChildContainers(editor, block, options);
|
|
13053
13069
|
}
|
|
13054
13070
|
function complexBlockGetSelectedContainers(editor, block, start, end) {
|
|
13055
13071
|
if (start.isSimple()) {
|
|
13056
|
-
assert(logger$
|
|
13072
|
+
assert(logger$4q, end.isSimple(), "invalid start and end position");
|
|
13057
13073
|
return complexBlockGetAllChildContainers(editor, block);
|
|
13058
13074
|
}
|
|
13059
|
-
assert(logger$
|
|
13060
|
-
assert(logger$
|
|
13075
|
+
assert(logger$4q, !start.isSimple(), "invalid start pos");
|
|
13076
|
+
assert(logger$4q, !end.isSimple(), "invalid end pos");
|
|
13061
13077
|
const blockClass = getComplexBlockClass(editor, block);
|
|
13062
13078
|
return blockClass.getSelectedContainers(editor, block, start, end);
|
|
13063
13079
|
}
|
|
@@ -13068,11 +13084,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13068
13084
|
const parentComplexBlock = getParentBlock(getParentContainer(childBlock));
|
|
13069
13085
|
if (!parentComplexBlock)
|
|
13070
13086
|
return false;
|
|
13071
|
-
assert(logger$
|
|
13087
|
+
assert(logger$4q, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
|
|
13072
13088
|
const childContainer = getParentContainer(childBlock);
|
|
13073
13089
|
const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock);
|
|
13074
13090
|
const index2 = childContainers.indexOf(childContainer);
|
|
13075
|
-
assert(logger$
|
|
13091
|
+
assert(logger$4q, index2 >= 0, "not valid child container");
|
|
13076
13092
|
return index2 === 0;
|
|
13077
13093
|
}
|
|
13078
13094
|
function complexBlockGetFirstSimpleChild(editor, complexBlock, options) {
|
|
@@ -13125,13 +13141,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13125
13141
|
return block;
|
|
13126
13142
|
}
|
|
13127
13143
|
function findPrevSimpleBlockBeforeChildContainer(editor, childContainer, options) {
|
|
13128
|
-
assert(logger$
|
|
13144
|
+
assert(logger$4q, isChildContainer(childContainer), "not a child container");
|
|
13129
13145
|
const parentComplexBlock = getParentBlock(childContainer);
|
|
13130
|
-
assert(logger$
|
|
13131
|
-
assert(logger$
|
|
13146
|
+
assert(logger$4q, parentComplexBlock, "no parent block");
|
|
13147
|
+
assert(logger$4q, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
|
|
13132
13148
|
const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock, options);
|
|
13133
13149
|
const containerIndex = childContainers.indexOf(childContainer);
|
|
13134
|
-
assert(logger$
|
|
13150
|
+
assert(logger$4q, containerIndex !== -1, "child container not found");
|
|
13135
13151
|
if (containerIndex === 0) {
|
|
13136
13152
|
const prevBlock = getPrevBlock(parentComplexBlock);
|
|
13137
13153
|
if (!prevBlock)
|
|
@@ -13149,9 +13165,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13149
13165
|
return lastBlock2;
|
|
13150
13166
|
}
|
|
13151
13167
|
function complexBlockGetTopChildContainers(editor, complexBlock) {
|
|
13152
|
-
assert(logger$
|
|
13168
|
+
assert(logger$4q, isComplexKindBlock(editor, complexBlock), "not a complex block");
|
|
13153
13169
|
const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
|
|
13154
|
-
assert(logger$
|
|
13170
|
+
assert(logger$4q, childContainers.length > 0, "no child container");
|
|
13155
13171
|
if (childContainers.length === 1) {
|
|
13156
13172
|
return childContainers;
|
|
13157
13173
|
}
|
|
@@ -13176,9 +13192,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13176
13192
|
return ret;
|
|
13177
13193
|
}
|
|
13178
13194
|
function complexBlockGetBottomChildContainers(editor, complexBlock) {
|
|
13179
|
-
assert(logger$
|
|
13195
|
+
assert(logger$4q, isComplexKindBlock(editor, complexBlock), "not a complex block");
|
|
13180
13196
|
const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
|
|
13181
|
-
assert(logger$
|
|
13197
|
+
assert(logger$4q, childContainers.length > 0, "no child container");
|
|
13182
13198
|
if (childContainers.length === 1) {
|
|
13183
13199
|
return childContainers;
|
|
13184
13200
|
}
|
|
@@ -13283,11 +13299,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13283
13299
|
return result;
|
|
13284
13300
|
}
|
|
13285
13301
|
const anchor = "";
|
|
13286
|
-
const logger$
|
|
13302
|
+
const logger$4p = getLogger("text-range");
|
|
13287
13303
|
function getBlockRangeInfo(block, blockOffset) {
|
|
13288
13304
|
const getChildRange = (child, offset) => {
|
|
13289
13305
|
if (isTextBlockContentInsertionChild(child)) {
|
|
13290
|
-
assert(logger$
|
|
13306
|
+
assert(logger$4p, offset === 0, `invalid offset for insertion child: ${offset}`);
|
|
13291
13307
|
const childOffset = 2;
|
|
13292
13308
|
return {
|
|
13293
13309
|
child,
|
|
@@ -13296,7 +13312,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13296
13312
|
};
|
|
13297
13313
|
}
|
|
13298
13314
|
if (isTextBlockContentBoxChild(child)) {
|
|
13299
|
-
assert(logger$
|
|
13315
|
+
assert(logger$4p, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
|
|
13300
13316
|
const childOffset = offset === 0 ? 1 : 2;
|
|
13301
13317
|
return {
|
|
13302
13318
|
child,
|
|
@@ -13305,17 +13321,17 @@ var __publicField = (obj, key, value) => {
|
|
|
13305
13321
|
};
|
|
13306
13322
|
}
|
|
13307
13323
|
const textNode = child.firstChild;
|
|
13308
|
-
assert(logger$
|
|
13309
|
-
assert(logger$
|
|
13324
|
+
assert(logger$4p, textNode, "no child node for text child");
|
|
13325
|
+
assert(logger$4p, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
|
|
13310
13326
|
if (textNode instanceof HTMLBRElement) {
|
|
13311
|
-
assert(logger$
|
|
13327
|
+
assert(logger$4p, offset >= 0 && offset <= 0, "invalid offset for text child");
|
|
13312
13328
|
return {
|
|
13313
13329
|
child,
|
|
13314
13330
|
container: textNode,
|
|
13315
13331
|
offset
|
|
13316
13332
|
};
|
|
13317
13333
|
}
|
|
13318
|
-
assert(logger$
|
|
13334
|
+
assert(logger$4p, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
|
|
13319
13335
|
return {
|
|
13320
13336
|
child,
|
|
13321
13337
|
container: textNode,
|
|
@@ -13344,38 +13360,38 @@ var __publicField = (obj, key, value) => {
|
|
|
13344
13360
|
}
|
|
13345
13361
|
start += childLength;
|
|
13346
13362
|
}
|
|
13347
|
-
assert(logger$
|
|
13363
|
+
assert(logger$4p, false, "failed to get range info");
|
|
13348
13364
|
}
|
|
13349
13365
|
function createChildRange(child, start, end) {
|
|
13350
13366
|
if (start === end) {
|
|
13351
|
-
assert(logger$
|
|
13367
|
+
assert(logger$4p, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
|
|
13352
13368
|
} else {
|
|
13353
|
-
assert(logger$
|
|
13369
|
+
assert(logger$4p, start < end, `invalid start & end: ${start}, ${end}`);
|
|
13354
13370
|
}
|
|
13355
13371
|
if (isTextBlockContentInsertionChild(child)) {
|
|
13356
|
-
assert(logger$
|
|
13357
|
-
assert(logger$
|
|
13372
|
+
assert(logger$4p, start === end, `invalid insertion child range offset: ${start}, ${end}`);
|
|
13373
|
+
assert(logger$4p, start === 0, `invalid insertion child range start: ${start}`);
|
|
13358
13374
|
const insertionElem = child;
|
|
13359
|
-
assert(logger$
|
|
13375
|
+
assert(logger$4p, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
|
|
13360
13376
|
const range = createExpandedRange(insertionElem, 1, insertionElem, 2);
|
|
13361
13377
|
return range;
|
|
13362
13378
|
}
|
|
13363
13379
|
if (isTextBlockContentBoxChild(child)) {
|
|
13364
|
-
assert(logger$
|
|
13365
|
-
assert(logger$
|
|
13380
|
+
assert(logger$4p, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
|
|
13381
|
+
assert(logger$4p, start === 0, `invalid box child range start: ${start}`);
|
|
13366
13382
|
const box = child;
|
|
13367
|
-
assert(logger$
|
|
13383
|
+
assert(logger$4p, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
|
|
13368
13384
|
const range = createExpandedRange(box, 1, box, 2);
|
|
13369
13385
|
return range;
|
|
13370
13386
|
}
|
|
13371
13387
|
const length = getTextBlockContentChildTextLength(child);
|
|
13372
|
-
assert(logger$
|
|
13388
|
+
assert(logger$4p, end <= length, `invalid child end: ${end}, ${length}`);
|
|
13373
13389
|
const textNode = child.firstChild;
|
|
13374
|
-
assert(logger$
|
|
13375
|
-
assert(logger$
|
|
13390
|
+
assert(logger$4p, textNode instanceof Text, "invalid block text child");
|
|
13391
|
+
assert(logger$4p, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
|
|
13376
13392
|
return createExpandedRange(textNode, start, textNode, end);
|
|
13377
13393
|
}
|
|
13378
|
-
const logger$
|
|
13394
|
+
const logger$4o = getLogger("caret-rect");
|
|
13379
13395
|
function getChildClientRects(block, child) {
|
|
13380
13396
|
if (isBox(child)) {
|
|
13381
13397
|
const box = child;
|
|
@@ -13384,7 +13400,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13384
13400
|
const blockContent = getBlockContent(block);
|
|
13385
13401
|
const lineHeight = Number.parseFloat(window.getComputedStyle(blockContent).lineHeight) || boxContent.getBoundingClientRect().height;
|
|
13386
13402
|
const rects = Array.from(boxContent.getClientRects());
|
|
13387
|
-
assert(logger$
|
|
13403
|
+
assert(logger$4o, rects.length > 0, "no box client rects");
|
|
13388
13404
|
const blockRect = blockContent.getBoundingClientRect();
|
|
13389
13405
|
const firstRect = rects[0];
|
|
13390
13406
|
const lastRect = new DOMRect(blockRect.left, firstRect.bottom, 1, lineHeight);
|
|
@@ -13404,22 +13420,22 @@ var __publicField = (obj, key, value) => {
|
|
|
13404
13420
|
const rect2 = getLastClientRect(ranges[0].child);
|
|
13405
13421
|
return new DOMRect(rect2.right, rect2.top, 1, rect2.height);
|
|
13406
13422
|
}
|
|
13407
|
-
assert(logger$
|
|
13423
|
+
assert(logger$4o, ranges[1], "invalid ranges");
|
|
13408
13424
|
const rect = getFirstClientRect(ranges[1].child);
|
|
13409
13425
|
return new DOMRect(rect.left, rect.top, 1, rect.height);
|
|
13410
13426
|
}
|
|
13411
13427
|
let rangeInfo = ranges[0];
|
|
13412
|
-
assert(logger$
|
|
13428
|
+
assert(logger$4o, ranges.length >= 1, "failed to get block range");
|
|
13413
13429
|
if (ranges.length === 1) {
|
|
13414
13430
|
rangeInfo = ranges[0];
|
|
13415
13431
|
} else {
|
|
13416
|
-
assert(logger$
|
|
13432
|
+
assert(logger$4o, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
|
|
13417
13433
|
if (isTextBlockContentInsertionChild(ranges[ranges.length - 1].child)) {
|
|
13418
13434
|
rangeInfo = ranges[ranges.length - 1];
|
|
13419
13435
|
const child = rangeInfo.child;
|
|
13420
13436
|
const content = getInsertionContent(child);
|
|
13421
13437
|
const rects2 = content.getClientRects();
|
|
13422
|
-
assert(logger$
|
|
13438
|
+
assert(logger$4o, rects2.length >= 1, "no client rects for box content");
|
|
13423
13439
|
const rect = rects2[rects2.length - 1];
|
|
13424
13440
|
return new DOMRect(rect.right, rect.y, 1, rect.height);
|
|
13425
13441
|
}
|
|
@@ -13436,9 +13452,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13436
13452
|
}
|
|
13437
13453
|
}
|
|
13438
13454
|
if (rangeInfo.container instanceof HTMLBRElement) {
|
|
13439
|
-
assert(logger$
|
|
13455
|
+
assert(logger$4o, pos.offset === 0, "invalid offset for empty block text");
|
|
13440
13456
|
const parent = rangeInfo.container.parentElement;
|
|
13441
|
-
assert(logger$
|
|
13457
|
+
assert(logger$4o, parent, "invalid br parent");
|
|
13442
13458
|
const rect = parent.getBoundingClientRect();
|
|
13443
13459
|
const ret = new DOMRect(rect.left, rect.top, 1, rect.height);
|
|
13444
13460
|
return ret;
|
|
@@ -13446,11 +13462,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13446
13462
|
const range = createRange(rangeInfo.container, rangeInfo.offset);
|
|
13447
13463
|
const rects = Array.from(range.getClientRects());
|
|
13448
13464
|
if (rects.length === 0) {
|
|
13449
|
-
assert(logger$
|
|
13450
|
-
assert(logger$
|
|
13465
|
+
assert(logger$4o, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
|
|
13466
|
+
assert(logger$4o, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
|
|
13451
13467
|
const child = rangeInfo.child;
|
|
13452
13468
|
const rects2 = getChildClientRects(block, child);
|
|
13453
|
-
assert(logger$
|
|
13469
|
+
assert(logger$4o, rects2.length >= 1, "no client rects for box content");
|
|
13454
13470
|
if (rangeInfo.offset === 1) {
|
|
13455
13471
|
const rect2 = rects2[0];
|
|
13456
13472
|
return new DOMRect(rect2.x, rect2.y, 1, rect2.height);
|
|
@@ -13496,7 +13512,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13496
13512
|
});
|
|
13497
13513
|
}
|
|
13498
13514
|
}
|
|
13499
|
-
assert(logger$
|
|
13515
|
+
assert(logger$4o, rects.length > 0, "no client rects for range");
|
|
13500
13516
|
if (pos.type === "home") {
|
|
13501
13517
|
return rects[rects.length - 1];
|
|
13502
13518
|
}
|
|
@@ -13576,13 +13592,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13576
13592
|
};
|
|
13577
13593
|
}
|
|
13578
13594
|
}
|
|
13579
|
-
const logger$
|
|
13595
|
+
const logger$4n = getLogger("selection-range");
|
|
13580
13596
|
function createEditorSelectionRange(editor, options) {
|
|
13581
13597
|
const { anchor: anchor2, focus } = options;
|
|
13582
13598
|
if (anchor2 instanceof EditorSimpleBlockPosition && focus instanceof EditorSimpleBlockPosition) {
|
|
13583
13599
|
return new EditorSimpleSelectionRange(editor, { anchor: anchor2, focus });
|
|
13584
13600
|
}
|
|
13585
|
-
assert(logger$
|
|
13601
|
+
assert(logger$4n, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
|
|
13586
13602
|
return new EditorComplexSelectionRange(editor, { anchor: anchor2, focus });
|
|
13587
13603
|
}
|
|
13588
13604
|
function createBlockSimpleRange(editor, block, anchor2, focus) {
|
|
@@ -13604,7 +13620,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13604
13620
|
const focus = createSimpleBlockPosition(range.focus.blockId, range.focus.offset, "normal");
|
|
13605
13621
|
return createEditorSelectionRange(editor, { anchor: anchor2, focus });
|
|
13606
13622
|
}
|
|
13607
|
-
const logger$
|
|
13623
|
+
const logger$4m = getLogger("range-from-point");
|
|
13608
13624
|
function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
|
|
13609
13625
|
const yOffsets = [0, -12, 12];
|
|
13610
13626
|
let x = pointX;
|
|
@@ -13636,7 +13652,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13636
13652
|
const rect = elem.getBoundingClientRect();
|
|
13637
13653
|
if (rect.width && rect.top && i === 0) {
|
|
13638
13654
|
if (rect.left + rect.width < x || rect.top + rect.height < y) {
|
|
13639
|
-
logger$
|
|
13655
|
+
logger$4m.debug("click on scrollbar, out of element rect");
|
|
13640
13656
|
return null;
|
|
13641
13657
|
}
|
|
13642
13658
|
}
|
|
@@ -13674,7 +13690,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13674
13690
|
let block = getLastChildBlock(container);
|
|
13675
13691
|
if (!isVisibleBlock(block)) {
|
|
13676
13692
|
const preBlock = getPrevVisibleBlock(block);
|
|
13677
|
-
assert(logger$
|
|
13693
|
+
assert(logger$4m, preBlock, "container must have visible block");
|
|
13678
13694
|
block = preBlock;
|
|
13679
13695
|
}
|
|
13680
13696
|
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, block.getBoundingClientRect().bottom - 4);
|
|
@@ -13693,7 +13709,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13693
13709
|
if (range instanceof EditorSimpleSelectionRange) {
|
|
13694
13710
|
return range;
|
|
13695
13711
|
}
|
|
13696
|
-
assert(logger$
|
|
13712
|
+
assert(logger$4m, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
|
|
13697
13713
|
const complexRange = range;
|
|
13698
13714
|
const container2 = editor.getContainerById(complexRange.start.childContainerId);
|
|
13699
13715
|
return getRangeInContainer(editor, container2, x, y);
|
|
@@ -13716,7 +13732,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13716
13732
|
});
|
|
13717
13733
|
return getRangeInContainer(editor, container, x, y);
|
|
13718
13734
|
}
|
|
13719
|
-
const logger$
|
|
13735
|
+
const logger$4l = getLogger("adjust-selection-pos");
|
|
13720
13736
|
function getParentContainers(block) {
|
|
13721
13737
|
const containers = [];
|
|
13722
13738
|
while (block) {
|
|
@@ -13726,10 +13742,10 @@ var __publicField = (obj, key, value) => {
|
|
|
13726
13742
|
return containers;
|
|
13727
13743
|
}
|
|
13728
13744
|
const newBlock = getParentBlock(container);
|
|
13729
|
-
assert(logger$
|
|
13745
|
+
assert(logger$4l, newBlock, "child container has not parent container");
|
|
13730
13746
|
block = newBlock;
|
|
13731
13747
|
}
|
|
13732
|
-
assert(logger$
|
|
13748
|
+
assert(logger$4l, false, "should not come here: getParentContainers");
|
|
13733
13749
|
}
|
|
13734
13750
|
function getParentBlockInContainer(container, block) {
|
|
13735
13751
|
while (block) {
|
|
@@ -13738,16 +13754,16 @@ var __publicField = (obj, key, value) => {
|
|
|
13738
13754
|
return block;
|
|
13739
13755
|
}
|
|
13740
13756
|
const newBlock = getParentBlock(parent);
|
|
13741
|
-
assert(logger$
|
|
13757
|
+
assert(logger$4l, newBlock, "could not find parent block for a child container");
|
|
13742
13758
|
block = newBlock;
|
|
13743
13759
|
}
|
|
13744
|
-
assert(logger$
|
|
13760
|
+
assert(logger$4l, false, "no parent block in specified container");
|
|
13745
13761
|
}
|
|
13746
13762
|
function getClosestParentBlock(block1, block2) {
|
|
13747
13763
|
const containers1 = getParentContainers(block1);
|
|
13748
13764
|
const containers2 = getParentContainers(block2);
|
|
13749
|
-
assert(logger$
|
|
13750
|
-
assert(logger$
|
|
13765
|
+
assert(logger$4l, containers1.length > 0 && containers2.length > 0, "block has not parent container");
|
|
13766
|
+
assert(logger$4l, containers1[0] === containers2[0], "root container does not equal");
|
|
13751
13767
|
let parentContainer = containers1[0];
|
|
13752
13768
|
for (let i = 1; i < containers1.length || containers2.length; i++) {
|
|
13753
13769
|
if (containers1[i] === containers2[i]) {
|
|
@@ -13766,23 +13782,23 @@ var __publicField = (obj, key, value) => {
|
|
|
13766
13782
|
}
|
|
13767
13783
|
function getParentContainerInComplexBlock(parentComplexBlock, element) {
|
|
13768
13784
|
let block = getParentBlock(element);
|
|
13769
|
-
assert(logger$
|
|
13785
|
+
assert(logger$4l, block, "element is not in a block");
|
|
13770
13786
|
while (block) {
|
|
13771
13787
|
const container = getParentContainer(block);
|
|
13772
|
-
assert(logger$
|
|
13788
|
+
assert(logger$4l, isChildContainer(container), "not a child container");
|
|
13773
13789
|
const parentBlock = getParentBlock(container);
|
|
13774
|
-
assert(logger$
|
|
13790
|
+
assert(logger$4l, parentBlock, "child container has not parent block");
|
|
13775
13791
|
if (parentBlock === parentComplexBlock) {
|
|
13776
13792
|
return container;
|
|
13777
13793
|
}
|
|
13778
13794
|
block = parentBlock;
|
|
13779
13795
|
}
|
|
13780
|
-
assert(logger$
|
|
13796
|
+
assert(logger$4l, false, "failed to find parent container in complex block");
|
|
13781
13797
|
}
|
|
13782
13798
|
function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
|
|
13783
13799
|
const blockId = getBlockId(complexBlock);
|
|
13784
|
-
assert(logger$
|
|
13785
|
-
assert(logger$
|
|
13800
|
+
assert(logger$4l, blockId === anchor2.blockId, "invalid start pos");
|
|
13801
|
+
assert(logger$4l, blockId === focus.blockId, "invalid end pos");
|
|
13786
13802
|
const blockClass = getComplexBlockClass(editor, complexBlock);
|
|
13787
13803
|
if (blockClass.adjustSelectionPos) {
|
|
13788
13804
|
return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
|
|
@@ -13816,8 +13832,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13816
13832
|
if (focus instanceof EditorComplexBlockPosition) {
|
|
13817
13833
|
focus = createSimpleBlockPosition(focusBlock, getBlockTextLength$6(editor, focusBlock), "end");
|
|
13818
13834
|
}
|
|
13819
|
-
assert(logger$
|
|
13820
|
-
assert(logger$
|
|
13835
|
+
assert(logger$4l, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
|
|
13836
|
+
assert(logger$4l, focus instanceof EditorSimpleBlockPosition, "not valid position type");
|
|
13821
13837
|
return {
|
|
13822
13838
|
anchor: anchor2,
|
|
13823
13839
|
focus
|
|
@@ -13871,7 +13887,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13871
13887
|
focus
|
|
13872
13888
|
};
|
|
13873
13889
|
}
|
|
13874
|
-
const logger$
|
|
13890
|
+
const logger$4k = getLogger("core");
|
|
13875
13891
|
function createBlockAnchor(editor, block, id, refClientRect) {
|
|
13876
13892
|
const tools = getBlockTools(block);
|
|
13877
13893
|
let elem = tools.querySelector(`.block-anchor[data-id=${id}]`);
|
|
@@ -13889,7 +13905,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13889
13905
|
return elem;
|
|
13890
13906
|
}
|
|
13891
13907
|
function createBlockCaretAnchor(editor, block, offset, id) {
|
|
13892
|
-
assert(logger$
|
|
13908
|
+
assert(logger$4k, isTextKindBlock(editor, block), "not a text kind block");
|
|
13893
13909
|
const caretRect = getTextCaretRect(block, createSimpleBlockPosition(block, offset, "normal"));
|
|
13894
13910
|
const blockRect = block.getBoundingClientRect();
|
|
13895
13911
|
const tools = getBlockTools(block);
|
|
@@ -14248,19 +14264,19 @@ var __publicField = (obj, key, value) => {
|
|
|
14248
14264
|
return result + (index2 ? "-" : "") + word.toLowerCase();
|
|
14249
14265
|
});
|
|
14250
14266
|
const kebabCase$1 = kebabCase;
|
|
14251
|
-
const logger$
|
|
14267
|
+
const logger$4j = getLogger("box");
|
|
14252
14268
|
function isBoxOp(op) {
|
|
14253
14269
|
if (!op.attributes)
|
|
14254
14270
|
return false;
|
|
14255
14271
|
if (!op.attributes.box)
|
|
14256
14272
|
return false;
|
|
14257
|
-
assert(logger$
|
|
14258
|
-
assert(logger$
|
|
14273
|
+
assert(logger$4j, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
|
|
14274
|
+
assert(logger$4j, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
|
|
14259
14275
|
return true;
|
|
14260
14276
|
}
|
|
14261
|
-
const logger$
|
|
14277
|
+
const logger$4i = getLogger("text-op");
|
|
14262
14278
|
function getOpLength(op) {
|
|
14263
|
-
assert(logger$
|
|
14279
|
+
assert(logger$4i, typeof op.insert === "string", "invalid op, no insert");
|
|
14264
14280
|
return op.insert.length;
|
|
14265
14281
|
}
|
|
14266
14282
|
function getOpAt(text2, offset) {
|
|
@@ -14268,7 +14284,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14268
14284
|
let pos = 0;
|
|
14269
14285
|
for (let i = 0; i < ops.length; i++) {
|
|
14270
14286
|
const op = ops[i];
|
|
14271
|
-
assert(logger$
|
|
14287
|
+
assert(logger$4i, typeof op.insert === "string", "invalid text op, no insert");
|
|
14272
14288
|
const end = pos + getOpLength(op);
|
|
14273
14289
|
if (end > offset) {
|
|
14274
14290
|
return [op];
|
|
@@ -14284,22 +14300,22 @@ var __publicField = (obj, key, value) => {
|
|
|
14284
14300
|
}
|
|
14285
14301
|
return [];
|
|
14286
14302
|
}
|
|
14287
|
-
const logger$
|
|
14303
|
+
const logger$4h = getLogger("rich-text-length");
|
|
14288
14304
|
function getTextOpLength(op) {
|
|
14289
|
-
assert(logger$
|
|
14305
|
+
assert(logger$4h, typeof op.insert === "string", "op.insert is not string");
|
|
14290
14306
|
return op.insert.length;
|
|
14291
14307
|
}
|
|
14292
14308
|
function getTextLength(ops) {
|
|
14293
14309
|
let count = 0;
|
|
14294
14310
|
ops.forEach((op) => {
|
|
14295
14311
|
if (op.insert) {
|
|
14296
|
-
assert(logger$
|
|
14312
|
+
assert(logger$4h, typeof op.insert === "string", "op.insert is not string");
|
|
14297
14313
|
count += getTextOpLength(op);
|
|
14298
14314
|
}
|
|
14299
14315
|
});
|
|
14300
14316
|
return count;
|
|
14301
14317
|
}
|
|
14302
|
-
const logger$
|
|
14318
|
+
const logger$4g = getLogger("split-text");
|
|
14303
14319
|
function splitText(ops, offset, splitResult) {
|
|
14304
14320
|
ops = cloneDeep__default.default(ops);
|
|
14305
14321
|
if (offset === 0) {
|
|
@@ -14317,8 +14333,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14317
14333
|
let counted = 0;
|
|
14318
14334
|
for (let i = 0; i < ops.length; i++) {
|
|
14319
14335
|
const op = ops[i];
|
|
14320
|
-
assert(logger$
|
|
14321
|
-
assert(logger$
|
|
14336
|
+
assert(logger$4g, typeof op === "object", `invalid op type, ${typeof op}`);
|
|
14337
|
+
assert(logger$4g, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
|
|
14322
14338
|
const subLen = getTextOpLength(op);
|
|
14323
14339
|
if (counted + subLen < offset) {
|
|
14324
14340
|
counted += subLen;
|
|
@@ -14328,18 +14344,18 @@ var __publicField = (obj, key, value) => {
|
|
|
14328
14344
|
right: ops.slice(i + 1)
|
|
14329
14345
|
};
|
|
14330
14346
|
} else {
|
|
14331
|
-
assert(logger$
|
|
14347
|
+
assert(logger$4g, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
|
|
14332
14348
|
const splitIndex = offset - counted;
|
|
14333
14349
|
const copied = cloneDeep__default.default(op);
|
|
14334
|
-
assert(logger$
|
|
14335
|
-
assert(logger$
|
|
14350
|
+
assert(logger$4g, copied.insert, "no copied.insert");
|
|
14351
|
+
assert(logger$4g, typeof copied.insert === "string", "invalid copied.insert type");
|
|
14336
14352
|
copied.insert = copied.insert.substr(0, splitIndex);
|
|
14337
14353
|
op.insert = op.insert.substr(splitIndex);
|
|
14338
14354
|
if (copied.insert === "") {
|
|
14339
|
-
assert(logger$
|
|
14355
|
+
assert(logger$4g, false, "invalid copied.insert, is empty string");
|
|
14340
14356
|
}
|
|
14341
14357
|
if (op.insert === "") {
|
|
14342
|
-
assert(logger$
|
|
14358
|
+
assert(logger$4g, false, "invalid op.insert, is empty string");
|
|
14343
14359
|
}
|
|
14344
14360
|
const right = [
|
|
14345
14361
|
op,
|
|
@@ -14358,9 +14374,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14358
14374
|
throw new Error(`invalid split offset: ${offset}, ${JSON.stringify(ops)}`);
|
|
14359
14375
|
}
|
|
14360
14376
|
function splitToThree(text2, offset, length) {
|
|
14361
|
-
assert(logger$
|
|
14362
|
-
assert(logger$
|
|
14363
|
-
assert(logger$
|
|
14377
|
+
assert(logger$4g, offset >= 0, "invalid offset, < 0");
|
|
14378
|
+
assert(logger$4g, length > 0, "invalid length, <= 0");
|
|
14379
|
+
assert(logger$4g, offset + length <= getTextLength(text2), "invalid offset + length < text length");
|
|
14364
14380
|
const { left: temp, right } = splitText(text2, offset + length);
|
|
14365
14381
|
const { left, right: middle } = splitText(temp, offset);
|
|
14366
14382
|
return { left, middle, right };
|
|
@@ -14583,9 +14599,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14583
14599
|
}
|
|
14584
14600
|
return [color, backgroundColor];
|
|
14585
14601
|
}
|
|
14586
|
-
const logger$
|
|
14602
|
+
const logger$4f = getLogger("text-block-content");
|
|
14587
14603
|
function updateBlockContentCore(editor, blockPath, content, blockText, insertions) {
|
|
14588
|
-
assert(logger$
|
|
14604
|
+
assert(logger$4f, blockText, "no text for block");
|
|
14589
14605
|
if (blockText.length === 0 && (!insertions || insertions.size === 0)) {
|
|
14590
14606
|
content.innerHTML = "<span><br></span>";
|
|
14591
14607
|
return;
|
|
@@ -14617,9 +14633,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14617
14633
|
for (let i2 = 0; i2 < text2.length; i2++) {
|
|
14618
14634
|
const op = text2[i2];
|
|
14619
14635
|
if (isBoxOp(op)) {
|
|
14620
|
-
assert(logger$
|
|
14636
|
+
assert(logger$4f, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
|
|
14621
14637
|
const span2 = editor.editorBoxes.createBox(content, op.attributes);
|
|
14622
|
-
assert(logger$
|
|
14638
|
+
assert(logger$4f, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
|
|
14623
14639
|
const ret = editor.editorBlockRenders.renderBox(blockPath, op.attributes);
|
|
14624
14640
|
if (ret.classes) {
|
|
14625
14641
|
addClass(span2, ...ret.classes);
|
|
@@ -14637,7 +14653,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14637
14653
|
fragment.appendChild(span2);
|
|
14638
14654
|
continue;
|
|
14639
14655
|
}
|
|
14640
|
-
assert(logger$
|
|
14656
|
+
assert(logger$4f, op.insert, `no insert in op: ${JSON.stringify(op)}`);
|
|
14641
14657
|
const span = createElement("span", ["text"], fragment, op.insert);
|
|
14642
14658
|
if (op.attributes) {
|
|
14643
14659
|
const ret = editor.editorBlockRenders.renderText(blockPath, op.attributes);
|
|
@@ -14668,7 +14684,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14668
14684
|
const compositionText = editor.compositingText;
|
|
14669
14685
|
if (compositionText) {
|
|
14670
14686
|
const pos = editor.selection.range.start;
|
|
14671
|
-
assert(logger$
|
|
14687
|
+
assert(logger$4f, pos.isSimple(), "not an simple position while compositing");
|
|
14672
14688
|
if (pos.blockId === blockId) {
|
|
14673
14689
|
const attributes = getAttributesAt(text2, 0);
|
|
14674
14690
|
insertions.set(pos.offset, [{
|
|
@@ -14684,11 +14700,11 @@ var __publicField = (obj, key, value) => {
|
|
|
14684
14700
|
function clearAllTempCompositionText(editor) {
|
|
14685
14701
|
const children = editor.rootContainer.querySelectorAll('span[data-type="editor-insertion"].inputting-insertion');
|
|
14686
14702
|
if (children.length) {
|
|
14687
|
-
logger$
|
|
14703
|
+
logger$4f.debug(`remove ${children.length} temp composition span`);
|
|
14688
14704
|
}
|
|
14689
14705
|
Array.from(children).forEach((c) => c.remove());
|
|
14690
14706
|
}
|
|
14691
|
-
const logger$
|
|
14707
|
+
const logger$4e = getLogger("client-rects");
|
|
14692
14708
|
function getChildrenOffsets(block) {
|
|
14693
14709
|
const children = getTextBlockContentChildren(block);
|
|
14694
14710
|
let start = 0;
|
|
@@ -14706,15 +14722,15 @@ var __publicField = (obj, key, value) => {
|
|
|
14706
14722
|
return ret;
|
|
14707
14723
|
}
|
|
14708
14724
|
function getChildrenInRange(editor, block, from, to) {
|
|
14709
|
-
assert(logger$
|
|
14725
|
+
assert(logger$4e, from < to, `invalid from & to: ${from}, ${to}`);
|
|
14710
14726
|
const blockLength = getBlockTextLength$6(editor, block);
|
|
14711
|
-
assert(logger$
|
|
14727
|
+
assert(logger$4e, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
|
|
14712
14728
|
const offsets = getChildrenOffsets(block);
|
|
14713
14729
|
const startIndex = offsets.findIndex((c) => c.startBlockOffset <= from && from < c.endBlockOffset);
|
|
14714
14730
|
const endIndex = offsets.findIndex((c) => c.startBlockOffset < to && to <= c.endBlockOffset);
|
|
14715
|
-
assert(logger$
|
|
14716
|
-
assert(logger$
|
|
14717
|
-
assert(logger$
|
|
14731
|
+
assert(logger$4e, startIndex !== -1, "failed to find start child");
|
|
14732
|
+
assert(logger$4e, endIndex !== -1, "failed to find end child");
|
|
14733
|
+
assert(logger$4e, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
|
|
14718
14734
|
if (startIndex === endIndex) {
|
|
14719
14735
|
const child = offsets[startIndex];
|
|
14720
14736
|
return [{
|
|
@@ -14796,16 +14812,16 @@ var __publicField = (obj, key, value) => {
|
|
|
14796
14812
|
return rects;
|
|
14797
14813
|
}
|
|
14798
14814
|
function getRangeClientRects(editor, block, range) {
|
|
14799
|
-
assert(logger$
|
|
14815
|
+
assert(logger$4e, range instanceof EditorSimpleSelectionRange, "invalid range");
|
|
14800
14816
|
const start = range.start;
|
|
14801
14817
|
const end = range.end;
|
|
14802
|
-
assert(logger$
|
|
14803
|
-
assert(logger$
|
|
14804
|
-
assert(logger$
|
|
14805
|
-
assert(logger$
|
|
14818
|
+
assert(logger$4e, start.isSimple(), "text block only allow simple position");
|
|
14819
|
+
assert(logger$4e, end.isSimple(), "text block only allow simple position");
|
|
14820
|
+
assert(logger$4e, start.blockId === end.blockId, "only allow update one text block selection");
|
|
14821
|
+
assert(logger$4e, start.blockId === getBlockId(block), "only allow update one text block selection");
|
|
14806
14822
|
return getClientRects$2(editor, block, start, end);
|
|
14807
14823
|
}
|
|
14808
|
-
const logger$
|
|
14824
|
+
const logger$4d = getLogger("selection-background");
|
|
14809
14825
|
function getLineHeight(elem) {
|
|
14810
14826
|
const style2 = window.getComputedStyle(elem);
|
|
14811
14827
|
const lineHeightStyle = style2.getPropertyValue("line-height");
|
|
@@ -14825,9 +14841,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14825
14841
|
return lineHeight;
|
|
14826
14842
|
}
|
|
14827
14843
|
function updateSelection$4(editor, block, start, end) {
|
|
14828
|
-
assert(logger$
|
|
14829
|
-
assert(logger$
|
|
14830
|
-
assert(logger$
|
|
14844
|
+
assert(logger$4d, start.isSimple(), "text block only allow simple position");
|
|
14845
|
+
assert(logger$4d, end.isSimple(), "text block only allow simple position");
|
|
14846
|
+
assert(logger$4d, start.blockId === end.blockId, "only allow update one text block selection");
|
|
14831
14847
|
const from = start.offset;
|
|
14832
14848
|
const to = end.offset;
|
|
14833
14849
|
if (from === to) {
|
|
@@ -14886,7 +14902,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14886
14902
|
}
|
|
14887
14903
|
});
|
|
14888
14904
|
}
|
|
14889
|
-
const logger$
|
|
14905
|
+
const logger$4c = getLogger("line-breaker");
|
|
14890
14906
|
function mergeTextRects(rects) {
|
|
14891
14907
|
const result = [];
|
|
14892
14908
|
let lastRect = null;
|
|
@@ -15013,7 +15029,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15013
15029
|
}
|
|
15014
15030
|
const textChild = child;
|
|
15015
15031
|
const rects = mergeTextRects(textChild.getClientRects());
|
|
15016
|
-
assert(logger$
|
|
15032
|
+
assert(logger$4c, rects.length > 0, "invalid text child dom");
|
|
15017
15033
|
if (rects.length === 1) {
|
|
15018
15034
|
const nextChild = children[i + 1];
|
|
15019
15035
|
if (!nextChild) {
|
|
@@ -15038,10 +15054,10 @@ var __publicField = (obj, key, value) => {
|
|
|
15038
15054
|
continue;
|
|
15039
15055
|
}
|
|
15040
15056
|
const textNode = textChild.firstChild;
|
|
15041
|
-
assert(logger$
|
|
15042
|
-
assert(logger$
|
|
15057
|
+
assert(logger$4c, textNode, "invalid text child, no text node");
|
|
15058
|
+
assert(logger$4c, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
|
|
15043
15059
|
const textChildLength = getTextBlockContentChildTextLength(textChild);
|
|
15044
|
-
assert(logger$
|
|
15060
|
+
assert(logger$4c, textNode.data.length === textChildLength, "text node data length not equal child text length");
|
|
15045
15061
|
const textRects = getTextRects(textNode);
|
|
15046
15062
|
for (let rIndex = 0; rIndex < textRects.length - 1; rIndex++) {
|
|
15047
15063
|
const rect = textRects[rIndex];
|
|
@@ -15083,7 +15099,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15083
15099
|
}
|
|
15084
15100
|
}
|
|
15085
15101
|
}
|
|
15086
|
-
assert(logger$
|
|
15102
|
+
assert(logger$4c, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
|
|
15087
15103
|
return {
|
|
15088
15104
|
lineIndex: lineBreaks.length,
|
|
15089
15105
|
lineBreaks
|
|
@@ -23856,7 +23872,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23856
23872
|
const Graphemer_1 = __importDefault(Graphemer$1);
|
|
23857
23873
|
var _default = lib$1.default = Graphemer_1.default;
|
|
23858
23874
|
const splitter = new _default();
|
|
23859
|
-
const logger$
|
|
23875
|
+
const logger$4b = getLogger("text-offset");
|
|
23860
23876
|
function getChildOffset(block, child) {
|
|
23861
23877
|
const children = getTextBlockContentChildren(block);
|
|
23862
23878
|
let start = 0;
|
|
@@ -23872,26 +23888,26 @@ var __publicField = (obj, key, value) => {
|
|
|
23872
23888
|
}
|
|
23873
23889
|
start += testLength;
|
|
23874
23890
|
}
|
|
23875
|
-
assert(logger$
|
|
23891
|
+
assert(logger$4b, false, "can not find child in children");
|
|
23876
23892
|
}
|
|
23877
23893
|
function isValidOffset(block, blockOffset) {
|
|
23878
|
-
assert(logger$
|
|
23894
|
+
assert(logger$4b, blockOffset >= 0, `invalid offset: ${blockOffset}`);
|
|
23879
23895
|
const childInfo = getTextBlockChild(block, blockOffset);
|
|
23880
23896
|
const { prev, next: next2, offset } = childInfo;
|
|
23881
23897
|
if (!prev && !next2) {
|
|
23882
|
-
assert(logger$
|
|
23898
|
+
assert(logger$4b, false, "invalid offset, no prev & next child at offset");
|
|
23883
23899
|
}
|
|
23884
23900
|
if (prev !== next2) {
|
|
23885
23901
|
return true;
|
|
23886
23902
|
}
|
|
23887
23903
|
const child = prev;
|
|
23888
|
-
assert(logger$
|
|
23904
|
+
assert(logger$4b, child, "no child");
|
|
23889
23905
|
if (isTextBlockContentBoxChild(child)) {
|
|
23890
|
-
assert(logger$
|
|
23906
|
+
assert(logger$4b, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
|
|
23891
23907
|
return true;
|
|
23892
23908
|
}
|
|
23893
23909
|
const text2 = child.textContent;
|
|
23894
|
-
assert(logger$
|
|
23910
|
+
assert(logger$4b, text2, "no content for text child");
|
|
23895
23911
|
const chars = splitter.splitGraphemes(text2);
|
|
23896
23912
|
const validOffsets = /* @__PURE__ */ new Set();
|
|
23897
23913
|
let start = 0;
|
|
@@ -23921,7 +23937,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23921
23937
|
}
|
|
23922
23938
|
function getNextValidOffset(block, blockOffset) {
|
|
23923
23939
|
const length = getTextBlockLength(block);
|
|
23924
|
-
assert(logger$
|
|
23940
|
+
assert(logger$4b, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
|
|
23925
23941
|
if (blockOffset === length) {
|
|
23926
23942
|
return length;
|
|
23927
23943
|
}
|
|
@@ -23935,7 +23951,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23935
23951
|
}
|
|
23936
23952
|
return ret;
|
|
23937
23953
|
}
|
|
23938
|
-
const logger$
|
|
23954
|
+
const logger$4a = getLogger("line-offset");
|
|
23939
23955
|
function getLineOffsets(block) {
|
|
23940
23956
|
const lineBreaks = getLineBreaks(block);
|
|
23941
23957
|
const ret = [];
|
|
@@ -23956,7 +23972,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23956
23972
|
}
|
|
23957
23973
|
function getLineOffset(block, lineIndex) {
|
|
23958
23974
|
const lines = getLineOffsets(block);
|
|
23959
|
-
assert(logger$
|
|
23975
|
+
assert(logger$4a, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
|
|
23960
23976
|
return lines[lineIndex];
|
|
23961
23977
|
}
|
|
23962
23978
|
function getLineOffsetByPos(block, pos) {
|
|
@@ -24013,7 +24029,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24013
24029
|
function getLineCount(block) {
|
|
24014
24030
|
return getLineOffsets(block).length;
|
|
24015
24031
|
}
|
|
24016
|
-
const logger$
|
|
24032
|
+
const logger$49 = getLogger("find-text-position");
|
|
24017
24033
|
function isWrappedLine(block, lineIndex) {
|
|
24018
24034
|
const { start, end } = getLineOffset(block, lineIndex);
|
|
24019
24035
|
const blockId = getBlockId(block);
|
|
@@ -24024,13 +24040,13 @@ var __publicField = (obj, key, value) => {
|
|
|
24024
24040
|
return false;
|
|
24025
24041
|
}
|
|
24026
24042
|
const childInfo = getTextBlockChild(block, start);
|
|
24027
|
-
assert(logger$
|
|
24028
|
-
assert(logger$
|
|
24043
|
+
assert(logger$49, childInfo.next, "no next child at offset");
|
|
24044
|
+
assert(logger$49, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
|
|
24029
24045
|
return true;
|
|
24030
24046
|
}
|
|
24031
24047
|
function getWrappedLineOffsets(block, lineIndex) {
|
|
24032
24048
|
const blockId = getBlockId(block);
|
|
24033
|
-
assert(logger$
|
|
24049
|
+
assert(logger$49, isWrappedLine(block, lineIndex), "line is not wrapped");
|
|
24034
24050
|
const { start, end } = getLineOffset(block, lineIndex);
|
|
24035
24051
|
const homePos = createSimpleBlockPosition(blockId, start, "home");
|
|
24036
24052
|
for (let offset = start + 1; offset <= end; offset += 1) {
|
|
@@ -24045,11 +24061,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24045
24061
|
return offset - 1;
|
|
24046
24062
|
}
|
|
24047
24063
|
}
|
|
24048
|
-
assert(logger$
|
|
24064
|
+
assert(logger$49, false, "failed to find wrapped offset");
|
|
24049
24065
|
return 0;
|
|
24050
24066
|
}
|
|
24051
24067
|
function findTextPositionInLine(editor, block, lineIndex, sourceBlock, pos, findDirection, suggestedX) {
|
|
24052
|
-
assert(logger$
|
|
24068
|
+
assert(logger$49, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
|
|
24053
24069
|
const { start, end } = getLineOffset(block, lineIndex);
|
|
24054
24070
|
let from = start;
|
|
24055
24071
|
const blockId = getBlockId(block);
|
|
@@ -24091,11 +24107,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24091
24107
|
return retPos;
|
|
24092
24108
|
}
|
|
24093
24109
|
function findPrevTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
|
|
24094
|
-
assert(logger$
|
|
24110
|
+
assert(logger$49, isTextKindBlock(editor, block), "not a text block");
|
|
24095
24111
|
return findTextPositionInLine(editor, block, getLineCount(block) - 1, sourceBlock, pos, "up", suggestedX);
|
|
24096
24112
|
}
|
|
24097
24113
|
function findNextTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
|
|
24098
|
-
assert(logger$
|
|
24114
|
+
assert(logger$49, isTextKindBlock(editor, block), "not a text block");
|
|
24099
24115
|
return findTextPositionInLine(editor, block, 0, sourceBlock, pos, "down", suggestedX);
|
|
24100
24116
|
}
|
|
24101
24117
|
function moveDown(editor, block, position, suggestedX) {
|
|
@@ -24203,7 +24219,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24203
24219
|
}
|
|
24204
24220
|
return pos;
|
|
24205
24221
|
}
|
|
24206
|
-
const logger$
|
|
24222
|
+
const logger$48 = getLogger("move-caret");
|
|
24207
24223
|
function moveTextCaret(editor, block, position, direction) {
|
|
24208
24224
|
if (direction === "ArrowLeft") {
|
|
24209
24225
|
const ret = moveLeft(block, position);
|
|
@@ -24233,9 +24249,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24233
24249
|
}
|
|
24234
24250
|
return createSimpleBlockPosition(getBlockId(block), ret.offset, ret.type);
|
|
24235
24251
|
}
|
|
24236
|
-
assert(logger$
|
|
24252
|
+
assert(logger$48, false, `invalid navigation direction: ${direction}`);
|
|
24237
24253
|
}
|
|
24238
|
-
const logger$
|
|
24254
|
+
const logger$47 = getLogger("text-range");
|
|
24239
24255
|
function getBlockRects(block) {
|
|
24240
24256
|
const ret = [];
|
|
24241
24257
|
const children = getTextBlockContentChildren(block);
|
|
@@ -24293,9 +24309,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24293
24309
|
return null;
|
|
24294
24310
|
}
|
|
24295
24311
|
const children = getTextBlockContentChildren(block);
|
|
24296
|
-
assert(logger$
|
|
24312
|
+
assert(logger$47, children.indexOf(child) !== -1, "failed to find child in children");
|
|
24297
24313
|
const offsetInfo = getChildOffset(block, child);
|
|
24298
|
-
assert(logger$
|
|
24314
|
+
assert(logger$47, offsetInfo, "failed to get child offset");
|
|
24299
24315
|
const { start } = offsetInfo;
|
|
24300
24316
|
let offset;
|
|
24301
24317
|
let length;
|
|
@@ -24311,7 +24327,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24311
24327
|
}
|
|
24312
24328
|
length = 0;
|
|
24313
24329
|
} else {
|
|
24314
|
-
assert(logger$
|
|
24330
|
+
assert(logger$47, child.firstChild instanceof Text, "child is not text");
|
|
24315
24331
|
offset = start + textNodeOffsetFromPoint(child.firstChild, x, y);
|
|
24316
24332
|
length = 0;
|
|
24317
24333
|
}
|
|
@@ -24335,9 +24351,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24335
24351
|
}
|
|
24336
24352
|
return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
|
|
24337
24353
|
}
|
|
24338
|
-
const logger$
|
|
24354
|
+
const logger$46 = getLogger("create-text-op");
|
|
24339
24355
|
function createTextOp(text2, attributes) {
|
|
24340
|
-
assert(logger$
|
|
24356
|
+
assert(logger$46, text2, "text is empty");
|
|
24341
24357
|
const ret = {
|
|
24342
24358
|
insert: text2
|
|
24343
24359
|
};
|
|
@@ -24360,7 +24376,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24360
24376
|
}
|
|
24361
24377
|
return result;
|
|
24362
24378
|
}
|
|
24363
|
-
const logger$
|
|
24379
|
+
const logger$45 = getLogger("merge-ops");
|
|
24364
24380
|
function mergeOps(text2) {
|
|
24365
24381
|
if (text2.length <= 1) {
|
|
24366
24382
|
return text2;
|
|
@@ -24382,10 +24398,10 @@ var __publicField = (obj, key, value) => {
|
|
|
24382
24398
|
return false;
|
|
24383
24399
|
}
|
|
24384
24400
|
if (op1.attributes === void 0) {
|
|
24385
|
-
assert(logger$
|
|
24401
|
+
assert(logger$45, op2.attributes === void 0, "op2.attributes is not undefined");
|
|
24386
24402
|
return true;
|
|
24387
24403
|
}
|
|
24388
|
-
assert(logger$
|
|
24404
|
+
assert(logger$45, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
|
|
24389
24405
|
return isEqual__default.default(op1.attributes, op2.attributes);
|
|
24390
24406
|
};
|
|
24391
24407
|
const newOps = [];
|
|
@@ -24394,8 +24410,8 @@ var __publicField = (obj, key, value) => {
|
|
|
24394
24410
|
for (let i = 1; i < text2.length; i += 1) {
|
|
24395
24411
|
const op = text2[i];
|
|
24396
24412
|
if (isSameTypeOp(before, op)) {
|
|
24397
|
-
assert(logger$
|
|
24398
|
-
assert(logger$
|
|
24413
|
+
assert(logger$45, typeof before.insert === "string", "before.insert is not string");
|
|
24414
|
+
assert(logger$45, typeof op.insert === "string", "op.insert is not string");
|
|
24399
24415
|
before.insert += op.insert;
|
|
24400
24416
|
} else {
|
|
24401
24417
|
newOps.push(op);
|
|
@@ -24423,15 +24439,15 @@ var __publicField = (obj, key, value) => {
|
|
|
24423
24439
|
}
|
|
24424
24440
|
return text2.slice(0, i + 1);
|
|
24425
24441
|
}
|
|
24426
|
-
const logger$
|
|
24442
|
+
const logger$44 = getLogger("delete-text");
|
|
24427
24443
|
function deleteText(richText2, offset, count) {
|
|
24428
24444
|
const { left, right } = splitToThree(richText2, offset, count);
|
|
24429
24445
|
const result = [...left, ...right];
|
|
24430
24446
|
return mergeOps(result);
|
|
24431
24447
|
}
|
|
24432
24448
|
function createDeleteOps(offset, count) {
|
|
24433
|
-
assert(logger$
|
|
24434
|
-
assert(logger$
|
|
24449
|
+
assert(logger$44, offset >= 0, `invalid offset: ${offset}`);
|
|
24450
|
+
assert(logger$44, count >= 1, `invalid delete count: ${count}`);
|
|
24435
24451
|
const ops = [];
|
|
24436
24452
|
if (offset !== 0) {
|
|
24437
24453
|
ops.push({
|
|
@@ -24443,7 +24459,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24443
24459
|
});
|
|
24444
24460
|
return ops;
|
|
24445
24461
|
}
|
|
24446
|
-
const logger$
|
|
24462
|
+
const logger$43 = getLogger("delta");
|
|
24447
24463
|
function diffRichText(oldText, newText) {
|
|
24448
24464
|
const delta1D = new Delta__default.default(oldText);
|
|
24449
24465
|
const delta2D = new Delta__default.default(newText);
|
|
@@ -24453,7 +24469,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24453
24469
|
return new Delta__default.default(ops).transformPosition(cursor, !isLocalOp);
|
|
24454
24470
|
}
|
|
24455
24471
|
function isValidDocText(text2) {
|
|
24456
|
-
assert(logger$
|
|
24472
|
+
assert(logger$43, text2, "ops is null or undefined");
|
|
24457
24473
|
for (let i = 0; i < text2.length; i++) {
|
|
24458
24474
|
const op = text2[i];
|
|
24459
24475
|
if (op.insert === null || op.insert === void 0) {
|
|
@@ -24473,7 +24489,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24473
24489
|
}
|
|
24474
24490
|
class RichText {
|
|
24475
24491
|
static ensureValidText(text2) {
|
|
24476
|
-
assert(logger$
|
|
24492
|
+
assert(logger$43, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
|
|
24477
24493
|
}
|
|
24478
24494
|
static diff(oldText, newText) {
|
|
24479
24495
|
this.ensureValidText(oldText);
|
|
@@ -24495,9 +24511,9 @@ var __publicField = (obj, key, value) => {
|
|
|
24495
24511
|
return resultText;
|
|
24496
24512
|
}
|
|
24497
24513
|
}
|
|
24498
|
-
const logger$
|
|
24514
|
+
const logger$42 = getLogger("insert-text");
|
|
24499
24515
|
function insertText(richText2, offset, text2, attributes) {
|
|
24500
|
-
assert(logger$
|
|
24516
|
+
assert(logger$42, text2, `invalid text to insert: ${text2}`);
|
|
24501
24517
|
const { left, right } = splitText(richText2, offset);
|
|
24502
24518
|
const insertedText = typeof text2 === "string" ? [createTextOp(text2, attributes)] : text2;
|
|
24503
24519
|
const result = [...left, ...insertedText, ...right];
|
|
@@ -24510,7 +24526,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24510
24526
|
};
|
|
24511
24527
|
}
|
|
24512
24528
|
function createInsertOps(offset, text2, attributes) {
|
|
24513
|
-
assert(logger$
|
|
24529
|
+
assert(logger$42, offset >= 0, `invalid offset: ${offset}`);
|
|
24514
24530
|
if (text2.length === 0) {
|
|
24515
24531
|
return [];
|
|
24516
24532
|
}
|
|
@@ -24540,7 +24556,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24540
24556
|
function cloneText(text2) {
|
|
24541
24557
|
return cloneDeep__default.default(text2);
|
|
24542
24558
|
}
|
|
24543
|
-
const logger$
|
|
24559
|
+
const logger$41 = getLogger("update-op-attribute");
|
|
24544
24560
|
function updateOpAttributes(orgOps, key, value, newAttributes) {
|
|
24545
24561
|
const ops = cloneText(orgOps);
|
|
24546
24562
|
const index2 = ops.findIndex((op2) => {
|
|
@@ -24548,7 +24564,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24548
24564
|
return false;
|
|
24549
24565
|
return op2.attributes[key] === value;
|
|
24550
24566
|
});
|
|
24551
|
-
assert(logger$
|
|
24567
|
+
assert(logger$41, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
|
|
24552
24568
|
const op = ops[index2];
|
|
24553
24569
|
op.attributes = {
|
|
24554
24570
|
...op.attributes,
|
|
@@ -24630,11 +24646,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24630
24646
|
]);
|
|
24631
24647
|
}
|
|
24632
24648
|
const FILL_CHAR = "\u200B";
|
|
24633
|
-
const logger$
|
|
24649
|
+
const logger$40 = getLogger("to-plain-text");
|
|
24634
24650
|
function toPlainText(ops, options) {
|
|
24635
24651
|
let text2 = "";
|
|
24636
24652
|
ops.forEach((op) => {
|
|
24637
|
-
assert(logger$
|
|
24653
|
+
assert(logger$40, typeof op.insert === "string", "invalid op");
|
|
24638
24654
|
if (op.attributes && op.attributes.box === true) {
|
|
24639
24655
|
if (options == null ? void 0 : options.boxReplacement) {
|
|
24640
24656
|
text2 += options.boxReplacement;
|
|
@@ -24689,11 +24705,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24689
24705
|
focus: pos
|
|
24690
24706
|
};
|
|
24691
24707
|
}
|
|
24692
|
-
const logger$
|
|
24708
|
+
const logger$3$ = getLogger("block-to-text");
|
|
24693
24709
|
function textBlockToText$1(editor, ops, doc2) {
|
|
24694
24710
|
let text2 = "";
|
|
24695
24711
|
ops.forEach((op) => {
|
|
24696
|
-
assert(logger$
|
|
24712
|
+
assert(logger$3$, typeof op.insert === "string", "invalid op");
|
|
24697
24713
|
if (op.attributes && op.attributes.box === true) {
|
|
24698
24714
|
const box = op.attributes;
|
|
24699
24715
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -24711,11 +24727,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24711
24727
|
});
|
|
24712
24728
|
return text2;
|
|
24713
24729
|
}
|
|
24714
|
-
const logger$
|
|
24730
|
+
const logger$3_ = getLogger("block-to-text");
|
|
24715
24731
|
function textToMarkdownText(editor, ops, doc2) {
|
|
24716
24732
|
let text2 = "";
|
|
24717
24733
|
ops.forEach((op) => {
|
|
24718
|
-
assert(logger$
|
|
24734
|
+
assert(logger$3_, typeof op.insert === "string", "invalid op");
|
|
24719
24735
|
if (op.attributes && op.attributes.box === true) {
|
|
24720
24736
|
const box = op.attributes;
|
|
24721
24737
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -24838,12 +24854,12 @@ var __publicField = (obj, key, value) => {
|
|
|
24838
24854
|
return void 0;
|
|
24839
24855
|
}
|
|
24840
24856
|
}
|
|
24841
|
-
const logger$
|
|
24857
|
+
const logger$3Z = getLogger("block-to-text");
|
|
24842
24858
|
function textBlockToHtml(editor, blockData, doc2) {
|
|
24843
24859
|
let html = "";
|
|
24844
24860
|
const ops = blockData.text || [];
|
|
24845
24861
|
ops.forEach((op) => {
|
|
24846
|
-
assert(logger$
|
|
24862
|
+
assert(logger$3Z, typeof op.insert === "string", "invalid op");
|
|
24847
24863
|
if (op.attributes && op.attributes.box === true) {
|
|
24848
24864
|
const box = op.attributes;
|
|
24849
24865
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -24919,16 +24935,16 @@ var __publicField = (obj, key, value) => {
|
|
|
24919
24935
|
}
|
|
24920
24936
|
return `<p>${html}</p>`;
|
|
24921
24937
|
}
|
|
24922
|
-
const logger$
|
|
24938
|
+
const logger$3Y = getLogger("text-block");
|
|
24923
24939
|
function createBlockContent$5(editor, path, container, blockElement, blockData) {
|
|
24924
24940
|
const { text: text2 } = blockData;
|
|
24925
|
-
assert(logger$
|
|
24941
|
+
assert(logger$3Y, text2, "no text for text block");
|
|
24926
24942
|
const content = createBlockContentElement(blockElement, "div");
|
|
24927
24943
|
updateBlockContent$1(editor, path, blockData.id, content, text2);
|
|
24928
24944
|
return content;
|
|
24929
24945
|
}
|
|
24930
24946
|
function updateBlockText$1(editor, block, text2) {
|
|
24931
|
-
assert(logger$
|
|
24947
|
+
assert(logger$3Y, text2, "no text to update");
|
|
24932
24948
|
const newContent = createBlockContentElement(null, "div");
|
|
24933
24949
|
updateBlockContent$1(editor, getBlockPath(block), getBlockId(block), newContent, text2);
|
|
24934
24950
|
const oldContent = getBlockContent(block);
|
|
@@ -24938,7 +24954,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24938
24954
|
return getRangeClientRects(editor, block, range);
|
|
24939
24955
|
}
|
|
24940
24956
|
function convertTo$k(editor, blockData, doc2, type) {
|
|
24941
|
-
assert(logger$
|
|
24957
|
+
assert(logger$3Y, blockData.text, "no text for text block");
|
|
24942
24958
|
if (type === "text") {
|
|
24943
24959
|
return textBlockToText$1(editor, blockData.text, doc2);
|
|
24944
24960
|
}
|
|
@@ -24952,7 +24968,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24952
24968
|
blockData.id = genId();
|
|
24953
24969
|
info == null ? void 0 : info.blockIdMap.set(srcBlockData.id, blockData.id);
|
|
24954
24970
|
const { text: text2 } = blockData;
|
|
24955
|
-
assert(logger$
|
|
24971
|
+
assert(logger$3Y, text2, "no text for text block");
|
|
24956
24972
|
text2.forEach((op) => {
|
|
24957
24973
|
if (op.insert && op.attributes && op.attributes.box === true) {
|
|
24958
24974
|
const boxId = genId();
|
|
@@ -24984,7 +25000,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24984
25000
|
blockToDoc: blockToDoc$1
|
|
24985
25001
|
};
|
|
24986
25002
|
const updateTextBlockContent = updateBlockContent$1;
|
|
24987
|
-
const logger$
|
|
25003
|
+
const logger$3X = getLogger("action-helper");
|
|
24988
25004
|
function editorGetBlockData(editor, block) {
|
|
24989
25005
|
const container = getParentContainer(block);
|
|
24990
25006
|
const containerId = getContainerId(container);
|
|
@@ -24992,10 +25008,10 @@ var __publicField = (obj, key, value) => {
|
|
|
24992
25008
|
return editor.doc.getBlockData(containerId, blockIndex);
|
|
24993
25009
|
}
|
|
24994
25010
|
function editorGetBlockText(editor, block) {
|
|
24995
|
-
assert(logger$
|
|
25011
|
+
assert(logger$3X, isTextKindBlock(editor, block), "not a text kind block");
|
|
24996
25012
|
const data2 = editorGetBlockData(editor, block);
|
|
24997
25013
|
const text2 = data2.text;
|
|
24998
|
-
assert(logger$
|
|
25014
|
+
assert(logger$3X, text2, "no text in block");
|
|
24999
25015
|
return text2;
|
|
25000
25016
|
}
|
|
25001
25017
|
function editorGetBlockTextEx(editor, block, length) {
|
|
@@ -25003,7 +25019,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25003
25019
|
}
|
|
25004
25020
|
function editorGetBoxData(editor, box) {
|
|
25005
25021
|
const block = getParentBlock(box);
|
|
25006
|
-
assert(logger$
|
|
25022
|
+
assert(logger$3X, block, "no parent block");
|
|
25007
25023
|
const text2 = editorGetBlockText(editor, block);
|
|
25008
25024
|
const id = getBoxId(box);
|
|
25009
25025
|
const op = text2.find((op2) => {
|
|
@@ -25013,60 +25029,60 @@ var __publicField = (obj, key, value) => {
|
|
|
25013
25029
|
}
|
|
25014
25030
|
return false;
|
|
25015
25031
|
});
|
|
25016
|
-
assert(logger$
|
|
25032
|
+
assert(logger$3X, op, "failed to find box");
|
|
25017
25033
|
return op.attributes;
|
|
25018
25034
|
}
|
|
25019
|
-
const logger$
|
|
25035
|
+
const logger$3W = getLogger("block-text");
|
|
25020
25036
|
function getTextAfterOffset(editor, block, offset) {
|
|
25021
|
-
assert(logger$
|
|
25022
|
-
assert(logger$
|
|
25023
|
-
assert(logger$
|
|
25037
|
+
assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
|
|
25038
|
+
assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
|
|
25039
|
+
assert(logger$3W, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25024
25040
|
const newOffset = getNextValidOffset(block, offset);
|
|
25025
25041
|
const length = newOffset - offset;
|
|
25026
25042
|
if (length === 0) {
|
|
25027
|
-
assert(logger$
|
|
25043
|
+
assert(logger$3W, false, `no text after offset: ${offset}`);
|
|
25028
25044
|
}
|
|
25029
25045
|
const text2 = editorGetBlockText(editor, block);
|
|
25030
25046
|
const { middle } = splitToThree(text2, offset, length);
|
|
25031
|
-
assert(logger$
|
|
25047
|
+
assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
|
|
25032
25048
|
const op = middle[0];
|
|
25033
25049
|
if (isBoxOp(op)) {
|
|
25034
25050
|
return " ";
|
|
25035
25051
|
}
|
|
25036
|
-
assert(logger$
|
|
25052
|
+
assert(logger$3W, op.insert.length === 1 || op.insert.length === 2, "invalid op");
|
|
25037
25053
|
return op.insert;
|
|
25038
25054
|
}
|
|
25039
25055
|
function getTextBeforeOffset(editor, block, offset) {
|
|
25040
|
-
assert(logger$
|
|
25041
|
-
assert(logger$
|
|
25042
|
-
assert(logger$
|
|
25056
|
+
assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
|
|
25057
|
+
assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
|
|
25058
|
+
assert(logger$3W, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25043
25059
|
const newOffset = getPrevValidOffset(block, offset);
|
|
25044
25060
|
const length = offset - newOffset;
|
|
25045
25061
|
if (length === 0) {
|
|
25046
|
-
assert(logger$
|
|
25062
|
+
assert(logger$3W, false, `no text before offset: ${offset}`);
|
|
25047
25063
|
}
|
|
25048
25064
|
const text2 = editorGetBlockText(editor, block);
|
|
25049
25065
|
const { middle } = splitToThree(text2, newOffset, length);
|
|
25050
|
-
assert(logger$
|
|
25066
|
+
assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
|
|
25051
25067
|
const op = middle[0];
|
|
25052
25068
|
if (isBoxOp(op)) {
|
|
25053
25069
|
return " ";
|
|
25054
25070
|
}
|
|
25055
|
-
assert(logger$
|
|
25071
|
+
assert(logger$3W, op.insert.length === 1 || op.insert.length === 2, "invalid op");
|
|
25056
25072
|
return op.insert;
|
|
25057
25073
|
}
|
|
25058
25074
|
function getOffsetInfoBefore(editor, block, offset) {
|
|
25059
|
-
assert(logger$
|
|
25060
|
-
assert(logger$
|
|
25061
|
-
assert(logger$
|
|
25075
|
+
assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
|
|
25076
|
+
assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
|
|
25077
|
+
assert(logger$3W, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25062
25078
|
const newOffset = getPrevValidOffset(block, offset);
|
|
25063
25079
|
const length = offset - newOffset;
|
|
25064
25080
|
if (length === 0) {
|
|
25065
|
-
assert(logger$
|
|
25081
|
+
assert(logger$3W, false, `no text before offset: ${offset}`);
|
|
25066
25082
|
}
|
|
25067
25083
|
const text2 = editorGetBlockText(editor, block);
|
|
25068
25084
|
const { middle } = splitToThree(text2, newOffset, length);
|
|
25069
|
-
assert(logger$
|
|
25085
|
+
assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
|
|
25070
25086
|
const op = middle[0];
|
|
25071
25087
|
if (isBoxOp(op)) {
|
|
25072
25088
|
return {
|
|
@@ -25076,25 +25092,33 @@ var __publicField = (obj, key, value) => {
|
|
|
25076
25092
|
length: 1
|
|
25077
25093
|
};
|
|
25078
25094
|
}
|
|
25095
|
+
let charType = "text";
|
|
25096
|
+
if (isSpace(op.insert)) {
|
|
25097
|
+
charType = "space";
|
|
25098
|
+
} else if (isCJKPunctuation(op.insert)) {
|
|
25099
|
+
charType = "cjk_punctuation";
|
|
25100
|
+
} else if (isCJK(op.insert)) {
|
|
25101
|
+
charType = "cjk";
|
|
25102
|
+
}
|
|
25079
25103
|
return {
|
|
25080
25104
|
op,
|
|
25081
|
-
charType
|
|
25105
|
+
charType,
|
|
25082
25106
|
offset: newOffset,
|
|
25083
25107
|
length: op.insert.length
|
|
25084
25108
|
};
|
|
25085
25109
|
}
|
|
25086
25110
|
function getOffsetInfoAfter(editor, block, offset) {
|
|
25087
|
-
assert(logger$
|
|
25088
|
-
assert(logger$
|
|
25089
|
-
assert(logger$
|
|
25111
|
+
assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
|
|
25112
|
+
assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
|
|
25113
|
+
assert(logger$3W, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
25090
25114
|
const newOffset = getNextValidOffset(block, offset);
|
|
25091
25115
|
const length = newOffset - offset;
|
|
25092
25116
|
if (length === 0) {
|
|
25093
|
-
assert(logger$
|
|
25117
|
+
assert(logger$3W, false, `no text after offset: ${offset}`);
|
|
25094
25118
|
}
|
|
25095
25119
|
const text2 = editorGetBlockText(editor, block);
|
|
25096
25120
|
const { middle } = splitToThree(text2, offset, length);
|
|
25097
|
-
assert(logger$
|
|
25121
|
+
assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
|
|
25098
25122
|
const op = middle[0];
|
|
25099
25123
|
if (isBoxOp(op)) {
|
|
25100
25124
|
return {
|
|
@@ -25104,9 +25128,17 @@ var __publicField = (obj, key, value) => {
|
|
|
25104
25128
|
length: 1
|
|
25105
25129
|
};
|
|
25106
25130
|
}
|
|
25131
|
+
let charType = "text";
|
|
25132
|
+
if (isSpace(op.insert)) {
|
|
25133
|
+
charType = "space";
|
|
25134
|
+
} else if (isCJKPunctuation(op.insert)) {
|
|
25135
|
+
charType = "cjk_punctuation";
|
|
25136
|
+
} else if (isCJK(op.insert)) {
|
|
25137
|
+
charType = "cjk";
|
|
25138
|
+
}
|
|
25107
25139
|
return {
|
|
25108
25140
|
op,
|
|
25109
|
-
charType
|
|
25141
|
+
charType,
|
|
25110
25142
|
offset,
|
|
25111
25143
|
length: op.insert.length
|
|
25112
25144
|
};
|
|
@@ -25158,7 +25190,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25158
25190
|
return null;
|
|
25159
25191
|
}
|
|
25160
25192
|
function findWordLeft(editor, block, offset) {
|
|
25161
|
-
assert(logger$
|
|
25193
|
+
assert(logger$3W, isTextKindBlock(editor, block), "invalid blok type");
|
|
25162
25194
|
if (isEmptyTextBlock(editor, block)) {
|
|
25163
25195
|
return 0;
|
|
25164
25196
|
}
|
|
@@ -25167,6 +25199,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25167
25199
|
return offset - 1;
|
|
25168
25200
|
}
|
|
25169
25201
|
let start = offset;
|
|
25202
|
+
let find = offsetInfo.charType;
|
|
25170
25203
|
if (offsetInfo.charType === "space") {
|
|
25171
25204
|
const startInfo2 = findPrevOffsetNotType(editor, block, start, "space");
|
|
25172
25205
|
if (!startInfo2) {
|
|
@@ -25179,14 +25212,15 @@ var __publicField = (obj, key, value) => {
|
|
|
25179
25212
|
return startInfo2.offset;
|
|
25180
25213
|
}
|
|
25181
25214
|
start = startInfo2.offset;
|
|
25215
|
+
find = getOffsetInfoBefore(editor, block, start).charType;
|
|
25182
25216
|
}
|
|
25183
|
-
const startInfo = findPrevOffsetNotType(editor, block, start,
|
|
25217
|
+
const startInfo = findPrevOffsetNotType(editor, block, start, find);
|
|
25184
25218
|
if (!startInfo)
|
|
25185
25219
|
return 0;
|
|
25186
25220
|
return startInfo.offset + startInfo.length;
|
|
25187
25221
|
}
|
|
25188
25222
|
function findWordEnd(editor, block, offset) {
|
|
25189
|
-
assert(logger$
|
|
25223
|
+
assert(logger$3W, isTextKindBlock(editor, block), "invalid blok type");
|
|
25190
25224
|
if (isEmptyTextBlock(editor, block)) {
|
|
25191
25225
|
return 0;
|
|
25192
25226
|
}
|
|
@@ -25195,6 +25229,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25195
25229
|
return offset + 1;
|
|
25196
25230
|
}
|
|
25197
25231
|
let start = offset;
|
|
25232
|
+
let find = offsetInfo.charType;
|
|
25198
25233
|
if (offsetInfo.charType === "space") {
|
|
25199
25234
|
const startInfo2 = findAfterOffsetNotType(editor, block, start, "space");
|
|
25200
25235
|
if (!startInfo2) {
|
|
@@ -25207,16 +25242,17 @@ var __publicField = (obj, key, value) => {
|
|
|
25207
25242
|
return startInfo2.offset;
|
|
25208
25243
|
}
|
|
25209
25244
|
start = startInfo2.offset;
|
|
25245
|
+
find = getOffsetInfoAfter(editor, block, start).charType;
|
|
25210
25246
|
}
|
|
25211
|
-
const startInfo = findAfterOffsetNotType(editor, block, start,
|
|
25247
|
+
const startInfo = findAfterOffsetNotType(editor, block, start, find);
|
|
25212
25248
|
if (!startInfo)
|
|
25213
25249
|
return getBlockTextLength$6(editor, block);
|
|
25214
25250
|
return startInfo.offset;
|
|
25215
25251
|
}
|
|
25216
|
-
const logger$
|
|
25252
|
+
const logger$3V = getLogger("text-box");
|
|
25217
25253
|
function updateBoxContent$8(editor, boxElement, boxContent, boxData) {
|
|
25218
|
-
assert(logger$
|
|
25219
|
-
assert(logger$
|
|
25254
|
+
assert(logger$3V, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
|
|
25255
|
+
assert(logger$3V, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
|
|
25220
25256
|
createElement("span", [], boxContent, boxData.text);
|
|
25221
25257
|
}
|
|
25222
25258
|
function convertTo$j(editor, boxData, doc2, type) {
|
|
@@ -25250,7 +25286,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25250
25286
|
updateBoxContent: updateBoxContent$7,
|
|
25251
25287
|
convertTo: convertTo$i
|
|
25252
25288
|
};
|
|
25253
|
-
const logger$
|
|
25289
|
+
const logger$3U = getLogger("editor-boxes");
|
|
25254
25290
|
class EditorBoxes {
|
|
25255
25291
|
constructor(editor) {
|
|
25256
25292
|
__publicField(this, "boxes", /* @__PURE__ */ new Map());
|
|
@@ -25259,12 +25295,12 @@ var __publicField = (obj, key, value) => {
|
|
|
25259
25295
|
registerBoxClass(boxClass) {
|
|
25260
25296
|
const type = boxClass.boxType;
|
|
25261
25297
|
const exists = this.boxes.get(type);
|
|
25262
|
-
assert(logger$
|
|
25298
|
+
assert(logger$3U, !exists, `duplicated box type: ${type}`);
|
|
25263
25299
|
this.boxes.set(type, boxClass);
|
|
25264
25300
|
}
|
|
25265
25301
|
getBoxClass(type) {
|
|
25266
25302
|
const exists = this.boxes.get(type);
|
|
25267
|
-
assert(logger$
|
|
25303
|
+
assert(logger$3U, exists, `unknown box type: ${type}`);
|
|
25268
25304
|
return exists;
|
|
25269
25305
|
}
|
|
25270
25306
|
createBox(blockContent, box) {
|
|
@@ -25621,15 +25657,12 @@ var __publicField = (obj, key, value) => {
|
|
|
25621
25657
|
if (key === "inline-style-background-color") {
|
|
25622
25658
|
newStyles.backgroundColor = value;
|
|
25623
25659
|
}
|
|
25624
|
-
if (key === "inline-style-font-size") {
|
|
25625
|
-
newStyles.fontSize = value;
|
|
25626
|
-
}
|
|
25627
25660
|
}
|
|
25628
25661
|
});
|
|
25629
25662
|
return { classes, attributes: newAttributes, styles: newStyles };
|
|
25630
25663
|
}
|
|
25631
25664
|
}
|
|
25632
|
-
const logger$
|
|
25665
|
+
const logger$3T = getLogger("editor-insertion");
|
|
25633
25666
|
class EditorInsertions {
|
|
25634
25667
|
constructor(editor) {
|
|
25635
25668
|
__publicField(this, "insertions", /* @__PURE__ */ new Map());
|
|
@@ -25638,12 +25671,12 @@ var __publicField = (obj, key, value) => {
|
|
|
25638
25671
|
registerInsertionClass(insertionClass) {
|
|
25639
25672
|
const type = insertionClass.insertionType;
|
|
25640
25673
|
const exists = this.insertions.get(type);
|
|
25641
|
-
assert(logger$
|
|
25674
|
+
assert(logger$3T, !exists, `duplicated insertion type: ${type}`);
|
|
25642
25675
|
this.insertions.set(type, insertionClass);
|
|
25643
25676
|
}
|
|
25644
25677
|
getInsertionClass(type) {
|
|
25645
25678
|
const exists = this.insertions.get(type);
|
|
25646
|
-
assert(logger$
|
|
25679
|
+
assert(logger$3T, exists, `unknown insertion type: ${type}`);
|
|
25647
25680
|
return exists;
|
|
25648
25681
|
}
|
|
25649
25682
|
createInsertionElement(type, id, attributes) {
|
|
@@ -25763,7 +25796,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25763
25796
|
};
|
|
25764
25797
|
}
|
|
25765
25798
|
}
|
|
25766
|
-
const logger$
|
|
25799
|
+
const logger$3S = getLogger("editor-input");
|
|
25767
25800
|
class EditorInput$1 {
|
|
25768
25801
|
constructor(editor, callbacks) {
|
|
25769
25802
|
__publicField(this, "editor");
|
|
@@ -25885,7 +25918,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25885
25918
|
return;
|
|
25886
25919
|
}
|
|
25887
25920
|
this.callbacks.onCut(event);
|
|
25888
|
-
logger$
|
|
25921
|
+
logger$3S.debug("on cut");
|
|
25889
25922
|
});
|
|
25890
25923
|
__publicField(this, "handlePaste", (event) => {
|
|
25891
25924
|
if (event.isTrusted) {
|
|
@@ -26000,11 +26033,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26000
26033
|
this.callbacks.removeHandler(handler);
|
|
26001
26034
|
}
|
|
26002
26035
|
defaultInsertText(editor, containerId, blockIndex, offset, text2) {
|
|
26003
|
-
assert(logger$
|
|
26036
|
+
assert(logger$3S, editor === this.editor, "invalid editor");
|
|
26004
26037
|
this.callbacks.defaultInsertText(editor, containerId, blockIndex, offset, text2);
|
|
26005
26038
|
}
|
|
26006
26039
|
defaultHandleKeydown(editor, event) {
|
|
26007
|
-
assert(logger$
|
|
26040
|
+
assert(logger$3S, editor === this.editor, "invalid editor");
|
|
26008
26041
|
return this.callbacks.defaultHandleKeydown(editor, event);
|
|
26009
26042
|
}
|
|
26010
26043
|
forEach(callback) {
|
|
@@ -26029,7 +26062,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26029
26062
|
input2.style.left = `${x / scale}px`;
|
|
26030
26063
|
input2.style.top = `${y / scale}px`;
|
|
26031
26064
|
}
|
|
26032
|
-
const logger$
|
|
26065
|
+
const logger$3R = getLogger("editor-caret");
|
|
26033
26066
|
function getFirefoxVersion() {
|
|
26034
26067
|
const userAgent = window.navigator.userAgent;
|
|
26035
26068
|
const match = userAgent.match(/Firefox\/(\d+)\./);
|
|
@@ -26092,11 +26125,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26092
26125
|
return;
|
|
26093
26126
|
}
|
|
26094
26127
|
const { range } = this.editor.selection;
|
|
26095
|
-
assert(logger$
|
|
26128
|
+
assert(logger$3R, range.isCollapsed, "range is not collapsed");
|
|
26096
26129
|
const pos = range.start;
|
|
26097
|
-
assert(logger$
|
|
26130
|
+
assert(logger$3R, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
|
|
26098
26131
|
const block = this.editor.getBlockById(pos.blockId);
|
|
26099
|
-
assert(logger$
|
|
26132
|
+
assert(logger$3R, isTextKindBlock(this.editor, block), "only text kind block can has caret");
|
|
26100
26133
|
let rect;
|
|
26101
26134
|
const compositionSpan = block.querySelector("span.inputting-insertion");
|
|
26102
26135
|
if (compositionSpan) {
|
|
@@ -26134,7 +26167,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26134
26167
|
clearAllSelection(editor);
|
|
26135
26168
|
editor.selection.range.getSelectedBlocks().forEach((s) => updateBlockSelection(editor, s.block, s.start, s.end));
|
|
26136
26169
|
}
|
|
26137
|
-
const logger$
|
|
26170
|
+
const logger$3Q = getLogger("editor-dom");
|
|
26138
26171
|
function editorGetClientHeight(editor) {
|
|
26139
26172
|
const scrollContainer = getScrollContainer$1(editor.rootContainer);
|
|
26140
26173
|
return scrollContainer.clientHeight;
|
|
@@ -26222,7 +26255,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26222
26255
|
}
|
|
26223
26256
|
function editorScrollIntoView(editor) {
|
|
26224
26257
|
if (!isElementVisible(editor.rootContainer)) {
|
|
26225
|
-
logger$
|
|
26258
|
+
logger$3Q.warn("editorScrollIntoView: editor is not visible");
|
|
26226
26259
|
return;
|
|
26227
26260
|
}
|
|
26228
26261
|
const rootClientRect = editor.rootContainer.getBoundingClientRect();
|
|
@@ -26287,7 +26320,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26287
26320
|
const { start, end } = range;
|
|
26288
26321
|
return start.blockId === getBlockId(firstChildBlock) && start.offset === 0 && end.blockId === getBlockId(lastChildBlock) && end.offset === getBlockTextLength$6(editor, lastChildBlock);
|
|
26289
26322
|
}
|
|
26290
|
-
const logger$
|
|
26323
|
+
const logger$3P = getLogger("range-in-block");
|
|
26291
26324
|
function rangeInBlock(block, range) {
|
|
26292
26325
|
const editor = range.getEditor();
|
|
26293
26326
|
const start = editor.getBlockById(range.start.blockId);
|
|
@@ -26308,16 +26341,16 @@ var __publicField = (obj, key, value) => {
|
|
|
26308
26341
|
while (prevBlock && !blocks.has(getBlockId(prevBlock))) {
|
|
26309
26342
|
prevBlock = getPrevVisibleBlock(prevBlock);
|
|
26310
26343
|
}
|
|
26311
|
-
assert(logger$
|
|
26344
|
+
assert(logger$3P, prevBlock, "no prev block while deleting a block");
|
|
26312
26345
|
newRange = createBlockSimpleRange(editor, prevBlock, getBlockTextLength$6(editor, prevBlock));
|
|
26313
26346
|
} else {
|
|
26314
26347
|
const nextBlock = getNextVisibleBlock(block);
|
|
26315
|
-
assert(logger$
|
|
26348
|
+
assert(logger$3P, nextBlock, "no prev and next block while deleting a block");
|
|
26316
26349
|
newRange = createBlockSimpleRange(editor, nextBlock, 0);
|
|
26317
26350
|
}
|
|
26318
26351
|
return newRange;
|
|
26319
26352
|
}
|
|
26320
|
-
const logger$
|
|
26353
|
+
const logger$3O = getLogger("block-to-html");
|
|
26321
26354
|
function blockToHtml(editor, blockData, doc2, path) {
|
|
26322
26355
|
const blockClass = getBlockClassByType(editor, blockData.type);
|
|
26323
26356
|
if (blockClass.convertTo) {
|
|
@@ -26326,15 +26359,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26326
26359
|
if (blockClass.blockKind !== "text") {
|
|
26327
26360
|
return `[${blockData.type}]`;
|
|
26328
26361
|
}
|
|
26329
|
-
assert(logger$
|
|
26362
|
+
assert(logger$3O, blockData.text, "no text");
|
|
26330
26363
|
const plainText = toPlainText(blockData.text);
|
|
26331
26364
|
return `<div>${escapeHtmlText(plainText)}</div>`;
|
|
26332
26365
|
}
|
|
26333
|
-
const logger$
|
|
26366
|
+
const logger$3N = getLogger("block-to-text");
|
|
26334
26367
|
function textBlockToText(editor, ops, doc2) {
|
|
26335
26368
|
let text2 = "";
|
|
26336
26369
|
ops.forEach((op) => {
|
|
26337
|
-
assert(logger$
|
|
26370
|
+
assert(logger$3N, typeof op.insert === "string", "invalid op");
|
|
26338
26371
|
if (op.attributes && op.attributes.box === true) {
|
|
26339
26372
|
const box = op.attributes;
|
|
26340
26373
|
const boxClass = editor.editorBoxes.getBoxClass(box.type);
|
|
@@ -26360,7 +26393,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26360
26393
|
if (blockClass.blockKind !== "text") {
|
|
26361
26394
|
return `[${blockData.type}]`;
|
|
26362
26395
|
}
|
|
26363
|
-
assert(logger$
|
|
26396
|
+
assert(logger$3N, blockData.text, "no text");
|
|
26364
26397
|
const plainText = textBlockToText(editor, blockData.text, doc2);
|
|
26365
26398
|
return plainText;
|
|
26366
26399
|
}
|
|
@@ -26393,11 +26426,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26393
26426
|
const markdown = lines.join("\n");
|
|
26394
26427
|
return markdown;
|
|
26395
26428
|
}
|
|
26396
|
-
const logger$
|
|
26429
|
+
const logger$3M = getLogger("get-text-position");
|
|
26397
26430
|
function editorGetTextPosition(editor, insertPos) {
|
|
26398
26431
|
const pos = insertPos != null ? insertPos : editor.selection.range.start;
|
|
26399
26432
|
if (!(pos instanceof EditorSimpleBlockPosition)) {
|
|
26400
|
-
assert(logger$
|
|
26433
|
+
assert(logger$3M, false, `invalid insert pos type: ${typeof pos}`);
|
|
26401
26434
|
}
|
|
26402
26435
|
const { blockId } = pos;
|
|
26403
26436
|
const block = editor.getBlockById(blockId);
|
|
@@ -26485,14 +26518,14 @@ var __publicField = (obj, key, value) => {
|
|
|
26485
26518
|
return attributes;
|
|
26486
26519
|
}
|
|
26487
26520
|
}
|
|
26488
|
-
const logger$
|
|
26521
|
+
const logger$3L = getLogger("insert-text");
|
|
26489
26522
|
function getTextAttributes(editor, containerId, blockIndex, offset) {
|
|
26490
26523
|
var _a, _b;
|
|
26491
26524
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26492
|
-
assert(logger$
|
|
26493
|
-
assert(logger$
|
|
26525
|
+
assert(logger$3L, blockData, "no block data");
|
|
26526
|
+
assert(logger$3L, blockData.text, "no block text");
|
|
26494
26527
|
if (getTextLength(blockData.text) === 0) {
|
|
26495
|
-
assert(logger$
|
|
26528
|
+
assert(logger$3L, offset === 0, "invalid text offset");
|
|
26496
26529
|
return BlockAttributesHandler.get(editor).getEmptyBlockTextAttributes(blockData.id);
|
|
26497
26530
|
}
|
|
26498
26531
|
if (offset === 0) {
|
|
@@ -26539,7 +26572,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26539
26572
|
}
|
|
26540
26573
|
for (let i = 0; i < text2.length; i++) {
|
|
26541
26574
|
const op = text2[i];
|
|
26542
|
-
assert(logger$
|
|
26575
|
+
assert(logger$3L, typeof op.insert === "string", "invalid text op, no insert");
|
|
26543
26576
|
const endPos = pos + getOpLength(op);
|
|
26544
26577
|
if (endPos === start) {
|
|
26545
26578
|
return false;
|
|
@@ -26553,8 +26586,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26553
26586
|
}
|
|
26554
26587
|
function editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset) {
|
|
26555
26588
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26556
|
-
assert(logger$
|
|
26557
|
-
assert(logger$
|
|
26589
|
+
assert(logger$3L, blockData, "no block data");
|
|
26590
|
+
assert(logger$3L, blockData.text, "no block text");
|
|
26558
26591
|
const attributes = getTextAttributes(editor, containerId, blockIndex, offset);
|
|
26559
26592
|
if (attributes && Object.keys(attributes).includes("link")) {
|
|
26560
26593
|
const inOp = checkRangeInOp(blockData.text, offset);
|
|
@@ -26573,21 +26606,21 @@ var __publicField = (obj, key, value) => {
|
|
|
26573
26606
|
const { containerId, blockIndex, offset } = editorGetTextPosition(editor);
|
|
26574
26607
|
editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset);
|
|
26575
26608
|
}
|
|
26576
|
-
const logger$
|
|
26609
|
+
const logger$3K = getLogger("update-composition-text");
|
|
26577
26610
|
function editorUpdateCompositionText(editor) {
|
|
26578
26611
|
const pos = editor.selection.range.start;
|
|
26579
26612
|
if (!(pos instanceof EditorSimpleBlockPosition)) {
|
|
26580
|
-
assert(logger$
|
|
26613
|
+
assert(logger$3K, false, `invalid insert pos type: ${typeof pos}`);
|
|
26581
26614
|
}
|
|
26582
26615
|
const { blockId } = pos;
|
|
26583
26616
|
const block = editor.getBlockById(blockId);
|
|
26584
|
-
assert(logger$
|
|
26617
|
+
assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
|
|
26585
26618
|
const container = getParentContainer(block);
|
|
26586
26619
|
const containerId = getContainerId(container);
|
|
26587
26620
|
const blockIndex = getBlockIndex(block);
|
|
26588
26621
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26589
|
-
assert(logger$
|
|
26590
|
-
assert(logger$
|
|
26622
|
+
assert(logger$3K, blockData, "no block data in doc");
|
|
26623
|
+
assert(logger$3K, blockData.text, "no text data in text block");
|
|
26591
26624
|
const blockContent = getBlockContent(block);
|
|
26592
26625
|
updateBlockContent$1(editor, getBlockPath(block), blockId, blockContent, blockData.text);
|
|
26593
26626
|
}
|
|
@@ -26599,25 +26632,25 @@ var __publicField = (obj, key, value) => {
|
|
|
26599
26632
|
const block = editor.getBlockById(blockData.id);
|
|
26600
26633
|
return block;
|
|
26601
26634
|
}
|
|
26602
|
-
const logger$
|
|
26635
|
+
const logger$3J = getLogger("delete-block-text");
|
|
26603
26636
|
function editorDeleteBlockText(editor, block, offset, count, options) {
|
|
26604
26637
|
if (!editor.isBlockWritable(block)) {
|
|
26605
|
-
logger$
|
|
26638
|
+
logger$3J.error("block is not writable");
|
|
26606
26639
|
return 0;
|
|
26607
26640
|
}
|
|
26608
|
-
assert(logger$
|
|
26641
|
+
assert(logger$3J, isTextKindBlock(editor, block), "block is not a text kind block");
|
|
26609
26642
|
const container = getParentContainer(block);
|
|
26610
26643
|
const containerId = getContainerId(container);
|
|
26611
26644
|
const blockIndex = getBlockIndex(block);
|
|
26612
26645
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26613
|
-
assert(logger$
|
|
26614
|
-
assert(logger$
|
|
26646
|
+
assert(logger$3J, blockData, "no block data in doc");
|
|
26647
|
+
assert(logger$3J, blockData.text, "no text data in text block");
|
|
26615
26648
|
let from = offset;
|
|
26616
26649
|
if (!isValidOffset(block, offset)) {
|
|
26617
26650
|
from = getPrevValidOffset(block, from);
|
|
26618
26651
|
}
|
|
26619
26652
|
let to = offset + count;
|
|
26620
|
-
assert(logger$
|
|
26653
|
+
assert(logger$3J, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
|
|
26621
26654
|
if (!isValidOffset(block, to)) {
|
|
26622
26655
|
to = getNextValidOffset(block, to);
|
|
26623
26656
|
}
|
|
@@ -26626,7 +26659,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26626
26659
|
editor.doc.localUpdateBlockText(containerId, blockIndex, actions2, options);
|
|
26627
26660
|
return deleteCount;
|
|
26628
26661
|
}
|
|
26629
|
-
const logger$
|
|
26662
|
+
const logger$3I = getLogger("break-text-block");
|
|
26630
26663
|
function copyBlockAttributes(editor, block) {
|
|
26631
26664
|
const blockData = editor.getBlockData(block);
|
|
26632
26665
|
const quoted = blockData.quoted;
|
|
@@ -26638,8 +26671,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26638
26671
|
return {};
|
|
26639
26672
|
}
|
|
26640
26673
|
function editorBreakTextBlock(editor, block, offset, options) {
|
|
26641
|
-
assert(logger$
|
|
26642
|
-
assert(logger$
|
|
26674
|
+
assert(logger$3I, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
|
|
26675
|
+
assert(logger$3I, offset >= 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
|
|
26643
26676
|
const container = getParentContainer(block);
|
|
26644
26677
|
const containerId = getContainerId(container);
|
|
26645
26678
|
const blockIndex = getBlockIndex(block);
|
|
@@ -26669,7 +26702,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26669
26702
|
};
|
|
26670
26703
|
}
|
|
26671
26704
|
}
|
|
26672
|
-
assert(logger$
|
|
26705
|
+
assert(logger$3I, isValidOffset(block, offset), "not a valid offset");
|
|
26673
26706
|
const text2 = editorGetBlockText(editor, block);
|
|
26674
26707
|
const { right } = splitText(text2, offset);
|
|
26675
26708
|
const rightLength = getTextLength(right);
|
|
@@ -26695,12 +26728,12 @@ var __publicField = (obj, key, value) => {
|
|
|
26695
26728
|
newBlock
|
|
26696
26729
|
};
|
|
26697
26730
|
}
|
|
26698
|
-
const logger$
|
|
26731
|
+
const logger$3H = getLogger("prepare-insert-new-block");
|
|
26699
26732
|
function editorPrepareInsertNewBlock(editor, containerId, blockIndex) {
|
|
26700
26733
|
if (containerId && blockIndex !== void 0 && blockIndex !== null) {
|
|
26701
26734
|
const container = editor.getContainerById(containerId);
|
|
26702
26735
|
const blocks = getChildBlocks(container);
|
|
26703
|
-
assert(logger$
|
|
26736
|
+
assert(logger$3H, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
|
|
26704
26737
|
return {
|
|
26705
26738
|
containerId,
|
|
26706
26739
|
blockIndex
|
|
@@ -26734,15 +26767,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26734
26767
|
blockIndex: getBlockIndex(newBlock)
|
|
26735
26768
|
};
|
|
26736
26769
|
}
|
|
26737
|
-
const logger$
|
|
26770
|
+
const logger$3G = getLogger("auto-insert-block");
|
|
26738
26771
|
function editorAutoInsertBlock(editor, blockData, containerId, blockIndex, newRange, insertBlockOptions) {
|
|
26739
26772
|
const result = editorPrepareInsertNewBlock(editor, containerId, blockIndex);
|
|
26740
|
-
assert(logger$
|
|
26773
|
+
assert(logger$3G, result, `not an valid insert position: ${editor.selection.range}`);
|
|
26741
26774
|
const defaultPos = { blockId: blockData.id, offset: 0 };
|
|
26742
26775
|
const defaultRange = { anchor: defaultPos, focus: defaultPos };
|
|
26743
26776
|
return editorInsertBlock(editor, result.containerId, result.blockIndex, blockData, newRange != null ? newRange : defaultRange, insertBlockOptions);
|
|
26744
26777
|
}
|
|
26745
|
-
const logger$
|
|
26778
|
+
const logger$3F = getLogger("delete-block");
|
|
26746
26779
|
function getAllChildContainers(editor, blockData, containerIds) {
|
|
26747
26780
|
if (blockData.children) {
|
|
26748
26781
|
containerIds.push(...blockData.children);
|
|
@@ -26759,7 +26792,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26759
26792
|
const containerId = getContainerId(container);
|
|
26760
26793
|
const blockIndex = getBlockIndex(block);
|
|
26761
26794
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
26762
|
-
assert(logger$
|
|
26795
|
+
assert(logger$3F, blockData, "no block data in doc");
|
|
26763
26796
|
editor.doc.localDeleteBlock(containerId, blockIndex, createEditorSelectionRange(editor, { anchor: newRange.start, focus: newRange.end }));
|
|
26764
26797
|
return blockData;
|
|
26765
26798
|
}
|
|
@@ -26805,15 +26838,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26805
26838
|
});
|
|
26806
26839
|
editor.doc.localDeleteChildContainers(containerIds);
|
|
26807
26840
|
}
|
|
26808
|
-
const logger$
|
|
26841
|
+
const logger$3E = getLogger("merge-text-block");
|
|
26809
26842
|
function editorMergeTextBlock(editor, block1, block2) {
|
|
26810
|
-
assert(logger$
|
|
26811
|
-
assert(logger$
|
|
26843
|
+
assert(logger$3E, isTextKindBlock(editor, block1), "only text block can be merged");
|
|
26844
|
+
assert(logger$3E, isTextKindBlock(editor, block2), "only text block can be merged");
|
|
26812
26845
|
const data1 = editorGetBlockData(editor, block1);
|
|
26813
26846
|
const data2 = editorGetBlockData(editor, block2);
|
|
26814
26847
|
const text1 = data1.text;
|
|
26815
26848
|
const text2 = data2.text;
|
|
26816
|
-
assert(logger$
|
|
26849
|
+
assert(logger$3E, text1 && text2, "block data has no text");
|
|
26817
26850
|
const container = getParentContainer(block1);
|
|
26818
26851
|
const containerId = getContainerId(container);
|
|
26819
26852
|
const blockIndex = getBlockIndex(block1);
|
|
@@ -26823,15 +26856,15 @@ var __publicField = (obj, key, value) => {
|
|
|
26823
26856
|
editorDeleteBlock(editor, block2, newRange);
|
|
26824
26857
|
return block;
|
|
26825
26858
|
}
|
|
26826
|
-
const logger$
|
|
26859
|
+
const logger$3D = getLogger("clear-selected-contents");
|
|
26827
26860
|
function deleteTextBlockSelection(editor, selectedBlock) {
|
|
26828
|
-
assert(logger$
|
|
26861
|
+
assert(logger$3D, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
|
|
26829
26862
|
const { start, end } = selectedBlock;
|
|
26830
|
-
assert(logger$
|
|
26831
|
-
assert(logger$
|
|
26863
|
+
assert(logger$3D, start.isSimple(), "not a simple block position");
|
|
26864
|
+
assert(logger$3D, end.isSimple(), "not a simple block position");
|
|
26832
26865
|
const startOffset = start.offset;
|
|
26833
26866
|
const endOffset = end.offset;
|
|
26834
|
-
assert(logger$
|
|
26867
|
+
assert(logger$3D, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
|
|
26835
26868
|
if (startOffset === endOffset) {
|
|
26836
26869
|
return;
|
|
26837
26870
|
}
|
|
@@ -26856,7 +26889,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26856
26889
|
return;
|
|
26857
26890
|
}
|
|
26858
26891
|
if (isEmbedBlock(block) || start.isSimple()) {
|
|
26859
|
-
assert(logger$
|
|
26892
|
+
assert(logger$3D, end.isSimple(), "invalid range");
|
|
26860
26893
|
const container = getParentContainer(block);
|
|
26861
26894
|
const blockIndex = getBlockIndex(block);
|
|
26862
26895
|
const newBlock = editor.insertTextBlock("", getContainerId(container), blockIndex);
|
|
@@ -26864,8 +26897,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26864
26897
|
editor.deleteBlock(block);
|
|
26865
26898
|
return;
|
|
26866
26899
|
}
|
|
26867
|
-
assert(logger$
|
|
26868
|
-
assert(logger$
|
|
26900
|
+
assert(logger$3D, isComplexKindBlock(editor, block), "invalid block kind");
|
|
26901
|
+
assert(logger$3D, !start.isSimple() && !end.isSimple(), "invalid range");
|
|
26869
26902
|
complexBlockGetSelectedContainers(editor, block, start, end);
|
|
26870
26903
|
const containers = editor.selection.range.getSelectedContainers();
|
|
26871
26904
|
containers.forEach((container, index2) => {
|
|
@@ -26882,7 +26915,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26882
26915
|
return;
|
|
26883
26916
|
}
|
|
26884
26917
|
const selectedBlocks = range.getSelectedBlocks();
|
|
26885
|
-
assert(logger$
|
|
26918
|
+
assert(logger$3D, selectedBlocks.length > 0, "no selected block");
|
|
26886
26919
|
if (selectedBlocks.length === 1) {
|
|
26887
26920
|
clearOneBlock(editor, selectedBlocks[0]);
|
|
26888
26921
|
return;
|
|
@@ -26890,7 +26923,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26890
26923
|
const firstSelectedBlock = selectedBlocks[0];
|
|
26891
26924
|
const firstBlock = firstSelectedBlock.block;
|
|
26892
26925
|
const container = getParentContainer(firstBlock);
|
|
26893
|
-
assert(logger$
|
|
26926
|
+
assert(logger$3D, selectedBlocks.length > 1, "no selected block");
|
|
26894
26927
|
const lastSelectedBlock = selectedBlocks[selectedBlocks.length - 1];
|
|
26895
26928
|
const lastBlock2 = lastSelectedBlock.block;
|
|
26896
26929
|
if (isTextKindBlock(editor, firstBlock)) {
|
|
@@ -26920,7 +26953,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26920
26953
|
}
|
|
26921
26954
|
const prevBlock = getPrevBlock(firstBlock);
|
|
26922
26955
|
const nextBlock = getNextBlock(lastBlock2);
|
|
26923
|
-
assert(logger$
|
|
26956
|
+
assert(logger$3D, prevBlock || nextBlock, "no prev or next block");
|
|
26924
26957
|
selectedBlocks.forEach((selectedBlock) => editor.deleteBlock(selectedBlock.block));
|
|
26925
26958
|
}
|
|
26926
26959
|
function editorClearSelectedContents(editor, selectionRange) {
|
|
@@ -26939,7 +26972,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26939
26972
|
editor.emit("afterClearSelection", editor);
|
|
26940
26973
|
});
|
|
26941
26974
|
}
|
|
26942
|
-
const logger$
|
|
26975
|
+
const logger$3C = getLogger("core");
|
|
26943
26976
|
function editorUpdateBlockText(editor, block, ops, options) {
|
|
26944
26977
|
const container = getParentContainer(block);
|
|
26945
26978
|
const containerId = getContainerId(container);
|
|
@@ -26952,7 +26985,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26952
26985
|
}
|
|
26953
26986
|
function editorSetBlockText(editor, block, newText, options) {
|
|
26954
26987
|
if (!editor.isBlockWritable(block)) {
|
|
26955
|
-
logger$
|
|
26988
|
+
logger$3C.error("block is not writable");
|
|
26956
26989
|
return;
|
|
26957
26990
|
}
|
|
26958
26991
|
const oldText = editor.getBlockText(block);
|
|
@@ -26965,7 +26998,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26965
26998
|
const ops = RichText.diff(oldText, newText);
|
|
26966
26999
|
return editorUpdateBlockText(editor, block, ops);
|
|
26967
27000
|
}
|
|
26968
|
-
const logger$
|
|
27001
|
+
const logger$3B = getLogger("update-block-data");
|
|
26969
27002
|
function editorUpdateBlockData(editor, block, data2, newRange, options) {
|
|
26970
27003
|
const container = getParentContainer(block);
|
|
26971
27004
|
const containerId = getContainerId(container);
|
|
@@ -26982,17 +27015,17 @@ var __publicField = (obj, key, value) => {
|
|
|
26982
27015
|
if (oldKey === "id" || oldKey === "type" || oldKey === "text") {
|
|
26983
27016
|
return;
|
|
26984
27017
|
}
|
|
26985
|
-
logger$
|
|
27018
|
+
logger$3B.debug(`delete key: ${oldKey}`);
|
|
26986
27019
|
delta.delete.push(oldKey);
|
|
26987
27020
|
}
|
|
26988
27021
|
});
|
|
26989
27022
|
const entries = Object.entries(data2);
|
|
26990
27023
|
entries.forEach(([key, value]) => {
|
|
26991
|
-
assert(logger$
|
|
27024
|
+
assert(logger$3B, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
|
|
26992
27025
|
const oldValue = oldData[key];
|
|
26993
27026
|
if (value === null || value === void 0) {
|
|
26994
27027
|
if (oldValue !== null && oldValue !== void 0) {
|
|
26995
|
-
logger$
|
|
27028
|
+
logger$3B.debug(`delete key: ${key}`);
|
|
26996
27029
|
delta.delete.push(key);
|
|
26997
27030
|
}
|
|
26998
27031
|
return;
|
|
@@ -27010,10 +27043,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27010
27043
|
}
|
|
27011
27044
|
}
|
|
27012
27045
|
if (oldKeys.has(key)) {
|
|
27013
|
-
logger$
|
|
27046
|
+
logger$3B.debug(`replace key: ${key}`);
|
|
27014
27047
|
delta.delete.push(key);
|
|
27015
27048
|
} else {
|
|
27016
|
-
logger$
|
|
27049
|
+
logger$3B.debug(`insert key: ${key}`);
|
|
27017
27050
|
}
|
|
27018
27051
|
delta.insert[key] = value;
|
|
27019
27052
|
});
|
|
@@ -27058,13 +27091,13 @@ var __publicField = (obj, key, value) => {
|
|
|
27058
27091
|
comments: {}
|
|
27059
27092
|
};
|
|
27060
27093
|
}
|
|
27061
|
-
const logger$
|
|
27094
|
+
const logger$3A = getLogger("clone-block");
|
|
27062
27095
|
function cloneBlock(editorBlocks, oldDoc, data2, info) {
|
|
27063
27096
|
var _a;
|
|
27064
27097
|
const blockClass = editorBlocks.getBlockClass(data2.type);
|
|
27065
27098
|
if (blockClass.blockToDoc) {
|
|
27066
27099
|
return blockClass.blockToDoc(oldDoc, data2, (oldDoc2, childBlock) => {
|
|
27067
|
-
assert(logger$
|
|
27100
|
+
assert(logger$3A, data2 !== childBlock, "invalid child block");
|
|
27068
27101
|
return cloneBlock(editorBlocks, oldDoc2, data2, info);
|
|
27069
27102
|
}, info);
|
|
27070
27103
|
}
|
|
@@ -27077,7 +27110,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27077
27110
|
}
|
|
27078
27111
|
const newChildContainerId = genId();
|
|
27079
27112
|
const childBlocks = oldDoc.blocks[oldChildContainerId];
|
|
27080
|
-
assert(logger$
|
|
27113
|
+
assert(logger$3A, Array.isArray(childBlocks), "invalid child blocks");
|
|
27081
27114
|
const newDocs = childBlocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
|
|
27082
27115
|
const newDoc = mergeDocs(newDocs);
|
|
27083
27116
|
const { root: root2, ...childContainersData } = newDoc.blocks;
|
|
@@ -27106,7 +27139,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27106
27139
|
if (key.startsWith(prefix1)) {
|
|
27107
27140
|
const keyContent = key.substring(prefix1.length);
|
|
27108
27141
|
const newKey = `${newContainerId}/${keyContent}`;
|
|
27109
|
-
logger$
|
|
27142
|
+
logger$3A.debug(`replace key: ${key} -> ${newKey}`);
|
|
27110
27143
|
return newKey;
|
|
27111
27144
|
}
|
|
27112
27145
|
}
|
|
@@ -27115,7 +27148,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27115
27148
|
if (key.startsWith(prefix2)) {
|
|
27116
27149
|
const keyContent = key.substring(prefix2.length);
|
|
27117
27150
|
const newKey = `${newContainerId}_${keyContent}`;
|
|
27118
|
-
logger$
|
|
27151
|
+
logger$3A.debug(`replace key: ${key} -> ${newKey}`);
|
|
27119
27152
|
return newKey;
|
|
27120
27153
|
}
|
|
27121
27154
|
}
|
|
@@ -27145,7 +27178,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27145
27178
|
}
|
|
27146
27179
|
function cloneChildContainer(editorBlocks, oldDoc, containerId, info) {
|
|
27147
27180
|
const blocks = oldDoc.blocks[containerId];
|
|
27148
|
-
assert(logger$
|
|
27181
|
+
assert(logger$3A, Array.isArray(blocks), "invalid child blocks");
|
|
27149
27182
|
const newDocs = blocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
|
|
27150
27183
|
const newDoc = mergeDocs(newDocs);
|
|
27151
27184
|
return newDoc;
|
|
@@ -27154,19 +27187,24 @@ var __publicField = (obj, key, value) => {
|
|
|
27154
27187
|
const docs = doc2.blocks.root.map((b) => cloneBlock(editor.editorBlocks, doc2, b, info));
|
|
27155
27188
|
return cloneDeep__default.default(mergeDocs(docs));
|
|
27156
27189
|
}
|
|
27157
|
-
const logger$
|
|
27190
|
+
const logger$3z = getLogger("insert-doc");
|
|
27158
27191
|
function editorInsertDoc(editor, block, offset, insertedDoc, cloneDocResult) {
|
|
27192
|
+
var _a;
|
|
27159
27193
|
if (isComplexKindBlock(editor, block)) {
|
|
27160
|
-
logger$
|
|
27194
|
+
logger$3z.warn("failed to insert doc into a complex block");
|
|
27161
27195
|
return;
|
|
27162
27196
|
}
|
|
27163
27197
|
const doc2 = cloneDoc(editor, insertedDoc, cloneDocResult);
|
|
27164
27198
|
const container = getParentContainer(block);
|
|
27165
27199
|
const blockIndex = getBlockIndex(block);
|
|
27166
27200
|
const containerId = getContainerId(container);
|
|
27201
|
+
if (doc2.blocks.root.length === 1 && isTextKindBlockType(editor, doc2.blocks.root[0].type)) {
|
|
27202
|
+
editor.insertTextToBlock(block, offset, (_a = doc2.blocks.root[0].text) != null ? _a : []);
|
|
27203
|
+
return;
|
|
27204
|
+
}
|
|
27167
27205
|
editor.doc.beginBatchUpdate();
|
|
27168
27206
|
editor.undoManager.runInGroup(() => {
|
|
27169
|
-
var
|
|
27207
|
+
var _a2, _b, _c;
|
|
27170
27208
|
const childContainers = [];
|
|
27171
27209
|
Object.entries(doc2.blocks).forEach(([containerId2, blocks2]) => {
|
|
27172
27210
|
if (containerId2 === "root")
|
|
@@ -27191,7 +27229,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27191
27229
|
}
|
|
27192
27230
|
return;
|
|
27193
27231
|
}
|
|
27194
|
-
assert(logger$
|
|
27232
|
+
assert(logger$3z, isTextKindBlock(editor, block), "not a text block");
|
|
27195
27233
|
if (isEmptyTextBlock(editor, block)) {
|
|
27196
27234
|
const blockIndex2 = getBlockIndex(block);
|
|
27197
27235
|
let lastBlock22;
|
|
@@ -27231,7 +27269,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27231
27269
|
if (blocks.length === 1) {
|
|
27232
27270
|
const newBlock2 = blocks[0];
|
|
27233
27271
|
if (isTextKindBlockType(editor, newBlock2.type)) {
|
|
27234
|
-
editor.insertTextToBlock(block, offset, (
|
|
27272
|
+
editor.insertTextToBlock(block, offset, (_a2 = newBlock2.text) != null ? _a2 : []);
|
|
27235
27273
|
return;
|
|
27236
27274
|
}
|
|
27237
27275
|
editor.breakTextBlock(block, offset);
|
|
@@ -27323,11 +27361,11 @@ var __publicField = (obj, key, value) => {
|
|
|
27323
27361
|
editor.deleteBlock(block);
|
|
27324
27362
|
}
|
|
27325
27363
|
}
|
|
27326
|
-
const logger$
|
|
27364
|
+
const logger$3y = getLogger("add-text-attribute");
|
|
27327
27365
|
function editorRemoveTextAttribute(editor, block, range, attributeName) {
|
|
27328
27366
|
const { start, end } = range;
|
|
27329
|
-
assert(logger$
|
|
27330
|
-
assert(logger$
|
|
27367
|
+
assert(logger$3y, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
27368
|
+
assert(logger$3y, attributeName, "invalid attribute name");
|
|
27331
27369
|
const oldText = editor.getBlockText(block);
|
|
27332
27370
|
const newText = rangeRemoveAttribute(start.offset, end.offset - start.offset, oldText, attributeName, void 0, { ignoreValue: true });
|
|
27333
27371
|
editor.setBlockText(block, newText);
|
|
@@ -27335,8 +27373,8 @@ var __publicField = (obj, key, value) => {
|
|
|
27335
27373
|
}
|
|
27336
27374
|
function editorAddTextAttribute(editor, block, range, attributeName, value) {
|
|
27337
27375
|
const { start, end } = range;
|
|
27338
|
-
assert(logger$
|
|
27339
|
-
assert(logger$
|
|
27376
|
+
assert(logger$3y, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
27377
|
+
assert(logger$3y, attributeName, "invalid attribute name");
|
|
27340
27378
|
const oldText = editor.getBlockText(block);
|
|
27341
27379
|
const newText = rangeAddAttribute(start.offset, end.offset - start.offset, oldText, attributeName, value);
|
|
27342
27380
|
editor.setBlockText(block, newText);
|
|
@@ -27344,7 +27382,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27344
27382
|
}
|
|
27345
27383
|
function editorSetTextColor(editor, block, range, type, value) {
|
|
27346
27384
|
const { start, end } = range;
|
|
27347
|
-
assert(logger$
|
|
27385
|
+
assert(logger$3y, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
27348
27386
|
const oldText = editor.getBlockText(block);
|
|
27349
27387
|
const newText = rangeSetTextColor(start.offset, end.offset - start.offset, oldText, type, value);
|
|
27350
27388
|
editor.setBlockText(block, newText);
|
|
@@ -27433,10 +27471,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27433
27471
|
});
|
|
27434
27472
|
return [color, backgroundColor];
|
|
27435
27473
|
}
|
|
27436
|
-
const logger$
|
|
27474
|
+
const logger$3x = getLogger("move-complex-block-position");
|
|
27437
27475
|
function moveComplexBlockPosition(editor, old, type) {
|
|
27438
27476
|
const block = editor.getBlockById(old.blockId);
|
|
27439
|
-
assert(logger$
|
|
27477
|
+
assert(logger$3x, isComplexKindBlock(editor, block), "is not a complex block");
|
|
27440
27478
|
const blockClass = getComplexBlockClass(editor, block);
|
|
27441
27479
|
const focusedContainer = editor.getContainerById(old.childContainerId);
|
|
27442
27480
|
const nextContainer = blockClass.getNextContainer(editor, block, focusedContainer, type, { noWrap: true });
|
|
@@ -27445,24 +27483,24 @@ var __publicField = (obj, key, value) => {
|
|
|
27445
27483
|
}
|
|
27446
27484
|
return createComplexBlockPosition(block, getContainerId(nextContainer));
|
|
27447
27485
|
}
|
|
27448
|
-
const logger$
|
|
27486
|
+
const logger$3w = getLogger("move-simple-block-position");
|
|
27449
27487
|
function getFirstChildBlockInComplexBlock(editor, complexBlock) {
|
|
27450
27488
|
const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
|
|
27451
27489
|
if (containers.length === 0) {
|
|
27452
|
-
logger$
|
|
27490
|
+
logger$3w.warn("complex block has not any child container, not loaded?");
|
|
27453
27491
|
return null;
|
|
27454
27492
|
}
|
|
27455
|
-
assert(logger$
|
|
27493
|
+
assert(logger$3w, containers.length > 0, "complex block has not any child container");
|
|
27456
27494
|
const container = containers[0];
|
|
27457
27495
|
return getFirstChildBlock(container);
|
|
27458
27496
|
}
|
|
27459
27497
|
function getLastChildBlockInComplexBlock(editor, complexBlock) {
|
|
27460
27498
|
const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
|
|
27461
27499
|
if (containers.length === 0) {
|
|
27462
|
-
logger$
|
|
27500
|
+
logger$3w.warn("complex block has not any child container, not loaded?");
|
|
27463
27501
|
return null;
|
|
27464
27502
|
}
|
|
27465
|
-
assert(logger$
|
|
27503
|
+
assert(logger$3w, containers.length > 0, "complex block has not any child container");
|
|
27466
27504
|
const container = containers[containers.length - 1];
|
|
27467
27505
|
return getLastChildBlock(container);
|
|
27468
27506
|
}
|
|
@@ -27507,8 +27545,8 @@ var __publicField = (obj, key, value) => {
|
|
|
27507
27545
|
return null;
|
|
27508
27546
|
}
|
|
27509
27547
|
const parentComplexBlock = getParentBlock(container);
|
|
27510
|
-
assert(logger$
|
|
27511
|
-
assert(logger$
|
|
27548
|
+
assert(logger$3w, parentComplexBlock, "child container has not parent block");
|
|
27549
|
+
assert(logger$3w, isComplexKindBlock(editor, parentComplexBlock), "is not a complex block");
|
|
27512
27550
|
const nextContainer = getComplexBlockClass(editor, parentComplexBlock).getNextContainer(editor, parentComplexBlock, container, type);
|
|
27513
27551
|
if (nextContainer) {
|
|
27514
27552
|
if (isFindPrev(type)) {
|
|
@@ -27530,7 +27568,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27530
27568
|
return null;
|
|
27531
27569
|
}
|
|
27532
27570
|
const parentBlock = getParentBlock(container);
|
|
27533
|
-
assert(logger$
|
|
27571
|
+
assert(logger$3w, parentBlock, "child container has not parent block");
|
|
27534
27572
|
if (isFindPrev(type)) {
|
|
27535
27573
|
const prev = getPrevBlock(parentBlock);
|
|
27536
27574
|
if (prev) {
|
|
@@ -27585,7 +27623,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27585
27623
|
}
|
|
27586
27624
|
if (!targetBlock) {
|
|
27587
27625
|
if (isComplexKindBlock(editor, block) && complexBlockGetAllChildContainers(editor, block).length === 0) {
|
|
27588
|
-
logger$
|
|
27626
|
+
logger$3w.warn("complex block has not any child container, not loaded?");
|
|
27589
27627
|
targetBlock = direction === "ArrowDown" || direction === "ArrowRight" ? getNextVisibleBlock(block) : getPrevVisibleBlock(block);
|
|
27590
27628
|
}
|
|
27591
27629
|
}
|
|
@@ -27732,10 +27770,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27732
27770
|
editorAdjustSelection(editor, "ArrowUp", "select");
|
|
27733
27771
|
return true;
|
|
27734
27772
|
}
|
|
27735
|
-
const logger$
|
|
27773
|
+
const logger$3v = getLogger("word-offset");
|
|
27736
27774
|
function editorGetWordLeftPos(editor, type) {
|
|
27737
27775
|
const old = editor.selection.range.focus;
|
|
27738
|
-
assert(logger$
|
|
27776
|
+
assert(logger$3v, old.isSimple(), "invalid range type");
|
|
27739
27777
|
const block = editor.getBlockById(old.blockId);
|
|
27740
27778
|
if (isEmptyTextBlock(editor, block)) {
|
|
27741
27779
|
return createSimpleBlockPosition(block, 0, "home");
|
|
@@ -27760,7 +27798,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27760
27798
|
}
|
|
27761
27799
|
function editorGetWordRightPos(editor, type) {
|
|
27762
27800
|
const old = editor.selection.range.focus;
|
|
27763
|
-
assert(logger$
|
|
27801
|
+
assert(logger$3v, old.isSimple(), "invalid range type");
|
|
27764
27802
|
const block = editor.getBlockById(old.blockId);
|
|
27765
27803
|
if (isEmptyTextBlock(editor, block)) {
|
|
27766
27804
|
return createSimpleBlockPosition(block, 0, "end");
|
|
@@ -27872,10 +27910,10 @@ var __publicField = (obj, key, value) => {
|
|
|
27872
27910
|
editor.selection.setSelection(editor.selection.getAnchorPos(), pos);
|
|
27873
27911
|
return true;
|
|
27874
27912
|
}
|
|
27875
|
-
const logger$
|
|
27913
|
+
const logger$3u = getLogger("line-offset");
|
|
27876
27914
|
function editorGetLineHomePos(editor) {
|
|
27877
27915
|
const old = editor.selection.range.focus;
|
|
27878
|
-
assert(logger$
|
|
27916
|
+
assert(logger$3u, old.isSimple(), "invalid range type");
|
|
27879
27917
|
const block = editor.getBlockById(old.blockId);
|
|
27880
27918
|
if (old.offset === 0 || !isTextKindBlock(editor, block)) {
|
|
27881
27919
|
const newPos2 = createSimpleBlockPosition(block, 0, "home");
|
|
@@ -27892,7 +27930,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27892
27930
|
}
|
|
27893
27931
|
function editorGetLineEndPos(editor) {
|
|
27894
27932
|
const old = editor.selection.range.focus;
|
|
27895
|
-
assert(logger$
|
|
27933
|
+
assert(logger$3u, old.isSimple(), "invalid range type");
|
|
27896
27934
|
const block = editor.getBlockById(old.blockId);
|
|
27897
27935
|
if (old.offset === getBlockTextLength$6(editor, block) || !isTextKindBlock(editor, block)) {
|
|
27898
27936
|
const newPos2 = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
|
|
@@ -27992,7 +28030,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27992
28030
|
editorPageDownScroll(editor);
|
|
27993
28031
|
return true;
|
|
27994
28032
|
}
|
|
27995
|
-
const logger$
|
|
28033
|
+
const logger$3t = getLogger("table-scroll");
|
|
27996
28034
|
class DomEventHandler {
|
|
27997
28035
|
constructor(editor, dom, name, handler, data2, options) {
|
|
27998
28036
|
__publicField(this, "handleEvent", (event) => {
|
|
@@ -28024,7 +28062,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28024
28062
|
const existsHandlers = this.handlers.get(element);
|
|
28025
28063
|
if (existsHandlers) {
|
|
28026
28064
|
if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
|
|
28027
|
-
logger$
|
|
28065
|
+
logger$3t.warn(`event has already registered: ${eventName}`);
|
|
28028
28066
|
return;
|
|
28029
28067
|
}
|
|
28030
28068
|
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
|
|
@@ -28134,7 +28172,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28134
28172
|
});
|
|
28135
28173
|
return true;
|
|
28136
28174
|
}
|
|
28137
|
-
const logger$
|
|
28175
|
+
const logger$3s = getLogger("select-all");
|
|
28138
28176
|
function isContainerSelectedAllChildBlocks(container, range) {
|
|
28139
28177
|
const firstBlock = getFirstChildBlock(container);
|
|
28140
28178
|
const lastBlock2 = getLastChildBlock(container);
|
|
@@ -28149,8 +28187,8 @@ var __publicField = (obj, key, value) => {
|
|
|
28149
28187
|
return range.start.blockId === blockId && range.start.childContainerId === getContainerId(first) && range.end.blockId === blockId && range.end.childContainerId === getContainerId(last);
|
|
28150
28188
|
}
|
|
28151
28189
|
function selectComplexBlock(editor, block) {
|
|
28152
|
-
assert(logger$
|
|
28153
|
-
assert(logger$
|
|
28190
|
+
assert(logger$3s, block, "no parent block");
|
|
28191
|
+
assert(logger$3s, isComplexKindBlock(editor, block), "not a complex block");
|
|
28154
28192
|
const containers = getComplexBlockClass(editor, block).getChildContainers(editor, block);
|
|
28155
28193
|
const first = containers[0];
|
|
28156
28194
|
const last = containers[containers.length - 1];
|
|
@@ -28186,13 +28224,13 @@ var __publicField = (obj, key, value) => {
|
|
|
28186
28224
|
selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
|
|
28187
28225
|
return false;
|
|
28188
28226
|
}
|
|
28189
|
-
assert(logger$
|
|
28227
|
+
assert(logger$3s, !range.isSimple(), "invalid range type");
|
|
28190
28228
|
if (isComplexBlockSelectedAllChildContainer(focusedBlock, range)) {
|
|
28191
28229
|
selectParentContainer(editor, focusedBlock);
|
|
28192
28230
|
return false;
|
|
28193
28231
|
}
|
|
28194
|
-
assert(logger$
|
|
28195
|
-
assert(logger$
|
|
28232
|
+
assert(logger$3s, focusedBlock, "no parent block");
|
|
28233
|
+
assert(logger$3s, isComplexKindBlock(editor, focusedBlock), "not a complex block");
|
|
28196
28234
|
selectComplexBlock(editor, focusedBlock);
|
|
28197
28235
|
return true;
|
|
28198
28236
|
}
|
|
@@ -28228,6 +28266,30 @@ var __publicField = (obj, key, value) => {
|
|
|
28228
28266
|
}
|
|
28229
28267
|
editor.selection.setSelection(newStartPos, newEndPos);
|
|
28230
28268
|
}
|
|
28269
|
+
function editorMoveBlockStart(editor) {
|
|
28270
|
+
const focus = editor.selection.range.focus;
|
|
28271
|
+
const block = editor.getBlockById(focus.blockId);
|
|
28272
|
+
if (!block)
|
|
28273
|
+
return false;
|
|
28274
|
+
if (!isSimpleBlock(editor, block))
|
|
28275
|
+
return false;
|
|
28276
|
+
const newPos = createSimpleBlockPosition(block, 0, "home");
|
|
28277
|
+
editor.selection.setSelection(newPos);
|
|
28278
|
+
editor.selection.updateLastCaretRect();
|
|
28279
|
+
return true;
|
|
28280
|
+
}
|
|
28281
|
+
function editorMoveBlockEnd(editor) {
|
|
28282
|
+
const focus = editor.selection.range.focus;
|
|
28283
|
+
const block = editor.getBlockById(focus.blockId);
|
|
28284
|
+
if (!block)
|
|
28285
|
+
return false;
|
|
28286
|
+
if (!isSimpleBlock(editor, block))
|
|
28287
|
+
return false;
|
|
28288
|
+
const newPos = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
|
|
28289
|
+
editor.selection.setSelection(newPos);
|
|
28290
|
+
editor.selection.updateLastCaretRect();
|
|
28291
|
+
return true;
|
|
28292
|
+
}
|
|
28231
28293
|
function editorFocusToEnd(editor) {
|
|
28232
28294
|
editorSelectEnd(editor);
|
|
28233
28295
|
editor.focus();
|
|
@@ -28307,7 +28369,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28307
28369
|
}
|
|
28308
28370
|
return cloned;
|
|
28309
28371
|
}
|
|
28310
|
-
const logger$
|
|
28372
|
+
const logger$3r = getLogger("selected-block-to-doc");
|
|
28311
28373
|
function appendBlockChildren(editor, data2, doc2) {
|
|
28312
28374
|
if (!data2.children)
|
|
28313
28375
|
return;
|
|
@@ -28328,7 +28390,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28328
28390
|
if (isTextKindBlock(editor, selectedBlock.block)) {
|
|
28329
28391
|
const start = selectedBlock.start;
|
|
28330
28392
|
const end = selectedBlock.end;
|
|
28331
|
-
assert(logger$
|
|
28393
|
+
assert(logger$3r, data2.text, "no block text");
|
|
28332
28394
|
if (start.offset === end.offset) {
|
|
28333
28395
|
return {
|
|
28334
28396
|
blocks: {
|
|
@@ -28362,8 +28424,8 @@ var __publicField = (obj, key, value) => {
|
|
|
28362
28424
|
comments: {}
|
|
28363
28425
|
};
|
|
28364
28426
|
}
|
|
28365
|
-
assert(logger$
|
|
28366
|
-
assert(logger$
|
|
28427
|
+
assert(logger$3r, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
|
|
28428
|
+
assert(logger$3r, data2.children, "no children");
|
|
28367
28429
|
const ret = {
|
|
28368
28430
|
blocks: {
|
|
28369
28431
|
root: [
|
|
@@ -28381,9 +28443,9 @@ var __publicField = (obj, key, value) => {
|
|
|
28381
28443
|
const end = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
|
|
28382
28444
|
return selectedBlockToDoc(editor, { block, start, end });
|
|
28383
28445
|
}
|
|
28384
|
-
const logger$
|
|
28446
|
+
const logger$3q = getLogger("block-to-doc");
|
|
28385
28447
|
function blocksToDoc(editor, blocks) {
|
|
28386
|
-
assert(logger$
|
|
28448
|
+
assert(logger$3q, blocks.length > 0, "invalid params, no blocks");
|
|
28387
28449
|
const docs = blocks.map((b) => blockToDoc(editor, b));
|
|
28388
28450
|
return mergeDocs(docs);
|
|
28389
28451
|
}
|
|
@@ -28403,7 +28465,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28403
28465
|
const newDocs = selectedBlocks.map((s) => selectedBlockToDoc(editor, s));
|
|
28404
28466
|
return mergeDocs(newDocs);
|
|
28405
28467
|
}
|
|
28406
|
-
const logger$
|
|
28468
|
+
const logger$3p = getLogger("ensure-block-visible");
|
|
28407
28469
|
function ensureBlockVisible(editor, block) {
|
|
28408
28470
|
var _a;
|
|
28409
28471
|
while (block) {
|
|
@@ -28413,16 +28475,16 @@ var __publicField = (obj, key, value) => {
|
|
|
28413
28475
|
return;
|
|
28414
28476
|
}
|
|
28415
28477
|
const parentComplexBlock = getParentBlock(container);
|
|
28416
|
-
assert(logger$
|
|
28478
|
+
assert(logger$3p, parentComplexBlock, "no parent block");
|
|
28417
28479
|
const parentComplexBlockClass = getBlockClass(editor, parentComplexBlock);
|
|
28418
28480
|
if (parentComplexBlockClass.isChildContainerVisible && !((_a = parentComplexBlockClass.isChildContainerVisible) == null ? void 0 : _a.call(parentComplexBlockClass, editor, parentComplexBlock, container))) {
|
|
28419
|
-
assert(logger$
|
|
28481
|
+
assert(logger$3p, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
|
|
28420
28482
|
parentComplexBlockClass.showChildContainer(editor, parentComplexBlock, container);
|
|
28421
28483
|
}
|
|
28422
28484
|
block = parentComplexBlock;
|
|
28423
28485
|
}
|
|
28424
28486
|
}
|
|
28425
|
-
const logger$
|
|
28487
|
+
const logger$3o = getLogger("editor-selection");
|
|
28426
28488
|
class EditorSelection {
|
|
28427
28489
|
constructor(editor) {
|
|
28428
28490
|
__publicField(this, "editor");
|
|
@@ -28435,7 +28497,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28435
28497
|
}
|
|
28436
28498
|
const range = this.range;
|
|
28437
28499
|
if (rangeInBlock(deletedBlock, range)) {
|
|
28438
|
-
logger$
|
|
28500
|
+
logger$3o.debug("adjust selection because remote deleted current block");
|
|
28439
28501
|
const newRange = moveSelectionBeforeDeleteBlock(editor, deletedBlock);
|
|
28440
28502
|
this.setRange(newRange, { noScroll: true });
|
|
28441
28503
|
}
|
|
@@ -28560,14 +28622,14 @@ var __publicField = (obj, key, value) => {
|
|
|
28560
28622
|
if (pos.isSimple()) {
|
|
28561
28623
|
const ok = pos.offset >= 0 && pos.offset <= getBlockTextLength$6(this.editor, block);
|
|
28562
28624
|
if (!ok) {
|
|
28563
|
-
assert(logger$
|
|
28625
|
+
assert(logger$3o, false, "invalid block position, out of range");
|
|
28564
28626
|
}
|
|
28565
28627
|
} else {
|
|
28566
28628
|
const childContainerId = pos.childContainerId;
|
|
28567
28629
|
const container = this.editor.getContainerById(childContainerId);
|
|
28568
28630
|
const ok = !!container;
|
|
28569
28631
|
if (!ok) {
|
|
28570
|
-
assert(logger$
|
|
28632
|
+
assert(logger$3o, false, "invalid complex block position, no container found");
|
|
28571
28633
|
}
|
|
28572
28634
|
}
|
|
28573
28635
|
}
|
|
@@ -28628,7 +28690,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28628
28690
|
let container = getParentContainer(block);
|
|
28629
28691
|
while (isChildContainer(container)) {
|
|
28630
28692
|
const parentBlock = getParentBlock(container);
|
|
28631
|
-
assert(logger$
|
|
28693
|
+
assert(logger$3o, parentBlock, "parent block not found");
|
|
28632
28694
|
addClass(parentBlock, "child-focused");
|
|
28633
28695
|
container = getParentContainer(parentBlock);
|
|
28634
28696
|
}
|
|
@@ -28738,15 +28800,15 @@ var __publicField = (obj, key, value) => {
|
|
|
28738
28800
|
editor.undoManager.redo();
|
|
28739
28801
|
return true;
|
|
28740
28802
|
}
|
|
28741
|
-
const logger$
|
|
28803
|
+
const logger$3n = getLogger("delete-text");
|
|
28742
28804
|
function editorDeleteText(editor, type, count, insertPos) {
|
|
28743
28805
|
const pos = insertPos != null ? insertPos : editor.selection.range.start;
|
|
28744
28806
|
if (!(pos instanceof EditorSimpleBlockPosition)) {
|
|
28745
|
-
assert(logger$
|
|
28807
|
+
assert(logger$3n, false, `invalid insert pos type: ${typeof pos}`);
|
|
28746
28808
|
}
|
|
28747
28809
|
const { blockId } = pos;
|
|
28748
28810
|
const block = editor.getBlockById(blockId);
|
|
28749
|
-
assert(logger$
|
|
28811
|
+
assert(logger$3n, isTextKindBlock(editor, block), "block is not a text kind block");
|
|
28750
28812
|
let { offset } = pos;
|
|
28751
28813
|
if (type === "backward") {
|
|
28752
28814
|
if (offset - count < 0) {
|
|
@@ -28776,7 +28838,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28776
28838
|
}
|
|
28777
28839
|
return false;
|
|
28778
28840
|
}
|
|
28779
|
-
const logger$
|
|
28841
|
+
const logger$3m = getLogger("handle-backspace");
|
|
28780
28842
|
function tryDeleteEmptyBlock(editor, block) {
|
|
28781
28843
|
if (!isEmptyTextBlock(editor, block)) {
|
|
28782
28844
|
return;
|
|
@@ -28816,7 +28878,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28816
28878
|
}
|
|
28817
28879
|
} else {
|
|
28818
28880
|
tryDeleteEmptyBlock(editor, block);
|
|
28819
|
-
assert(logger$
|
|
28881
|
+
assert(logger$3m, isEmbedBlock(prevBlock), "prev block is not embed block");
|
|
28820
28882
|
editor.selection.selectBlock(prevBlock, 1);
|
|
28821
28883
|
}
|
|
28822
28884
|
} else {
|
|
@@ -28843,6 +28905,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28843
28905
|
editor.deleteBlock(block);
|
|
28844
28906
|
}
|
|
28845
28907
|
}
|
|
28908
|
+
const logger$3l = getLogger("word-offset");
|
|
28846
28909
|
function handleEditorDelete(editor, event) {
|
|
28847
28910
|
if (!editor.selection.range.isCollapsed()) {
|
|
28848
28911
|
editor.clearSelectedContents();
|
|
@@ -28877,6 +28940,130 @@ var __publicField = (obj, key, value) => {
|
|
|
28877
28940
|
editor.deleteBlock(block);
|
|
28878
28941
|
}
|
|
28879
28942
|
}
|
|
28943
|
+
function handleEditorDeleteLeftWord(editor, event) {
|
|
28944
|
+
const old = editor.selection.range.focus;
|
|
28945
|
+
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
28946
|
+
const block = editor.getBlockById(old.blockId);
|
|
28947
|
+
if (!isTextKindBlock(editor, block)) {
|
|
28948
|
+
editor.deleteBlock(block);
|
|
28949
|
+
return true;
|
|
28950
|
+
}
|
|
28951
|
+
if (old.offset === 0) {
|
|
28952
|
+
const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
|
|
28953
|
+
if (!isTextKindBlock(editor, block2))
|
|
28954
|
+
return true;
|
|
28955
|
+
return !isEmptyTextBlock(editor, block2);
|
|
28956
|
+
};
|
|
28957
|
+
const prevBlock = getPrevVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
|
|
28958
|
+
if (!prevBlock)
|
|
28959
|
+
return false;
|
|
28960
|
+
const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
|
|
28961
|
+
const emptyTextBlocks = getBlocksBetween(prevBlock, block, matchEmptyTextBlock);
|
|
28962
|
+
emptyTextBlocks.forEach((b) => {
|
|
28963
|
+
editor.deleteBlock(b);
|
|
28964
|
+
});
|
|
28965
|
+
if (!isTextKindBlock(editor, prevBlock)) {
|
|
28966
|
+
editor.deleteBlock(prevBlock);
|
|
28967
|
+
return true;
|
|
28968
|
+
}
|
|
28969
|
+
const textBlockLen = getBlockTextLength$6(editor, prevBlock);
|
|
28970
|
+
const newOffset2 = findWordLeft(editor, prevBlock, textBlockLen);
|
|
28971
|
+
editor.deleteTextFromBlock(prevBlock, newOffset2, textBlockLen - newOffset2);
|
|
28972
|
+
const currentBlockText = editor.getBlockText(block);
|
|
28973
|
+
editor.insertTextToBlock(prevBlock, newOffset2, currentBlockText);
|
|
28974
|
+
editor.deleteBlock(block);
|
|
28975
|
+
const pos = createSimpleBlockPosition(prevBlock, newOffset2, "normal");
|
|
28976
|
+
editor.selection.setSelection(pos);
|
|
28977
|
+
editor.selection.updateLastCaretRect();
|
|
28978
|
+
return true;
|
|
28979
|
+
}
|
|
28980
|
+
const newOffset = findWordLeft(editor, block, old.offset);
|
|
28981
|
+
const deletedCount = old.offset - newOffset;
|
|
28982
|
+
editor.deleteTextFromBlock(block, newOffset, deletedCount);
|
|
28983
|
+
return true;
|
|
28984
|
+
}
|
|
28985
|
+
function handleEditorDeleteRightWord(editor, event) {
|
|
28986
|
+
const old = editor.selection.range.focus;
|
|
28987
|
+
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
28988
|
+
const block = editor.getBlockById(old.blockId);
|
|
28989
|
+
if (!isTextKindBlock(editor, block)) {
|
|
28990
|
+
editor.deleteBlock(block);
|
|
28991
|
+
return true;
|
|
28992
|
+
}
|
|
28993
|
+
if (old.offset === getTextBlockLength(block)) {
|
|
28994
|
+
const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
|
|
28995
|
+
if (!isTextKindBlock(editor, block2))
|
|
28996
|
+
return true;
|
|
28997
|
+
return !isEmptyTextBlock(editor, block2);
|
|
28998
|
+
};
|
|
28999
|
+
const nextBlock = getNextVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
|
|
29000
|
+
if (!nextBlock)
|
|
29001
|
+
return false;
|
|
29002
|
+
const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
|
|
29003
|
+
const emptyTextBlocks = getBlocksBetween(block, nextBlock, matchEmptyTextBlock);
|
|
29004
|
+
emptyTextBlocks.forEach((b) => {
|
|
29005
|
+
editor.deleteBlock(b);
|
|
29006
|
+
});
|
|
29007
|
+
if (!isTextKindBlock(editor, nextBlock)) {
|
|
29008
|
+
editor.deleteBlock(nextBlock);
|
|
29009
|
+
return true;
|
|
29010
|
+
}
|
|
29011
|
+
const newOffset = findWordEnd(editor, nextBlock, 0);
|
|
29012
|
+
editor.deleteTextFromBlock(nextBlock, 0, newOffset);
|
|
29013
|
+
const nextBlockText = editor.getBlockText(nextBlock);
|
|
29014
|
+
editor.insertTextToBlock(block, old.offset, nextBlockText);
|
|
29015
|
+
editor.deleteBlock(nextBlock);
|
|
29016
|
+
const pos = createSimpleBlockPosition(block, old.offset, "normal");
|
|
29017
|
+
editor.selection.setSelection(pos);
|
|
29018
|
+
editor.selection.updateLastCaretRect();
|
|
29019
|
+
return true;
|
|
29020
|
+
}
|
|
29021
|
+
const endOffset = findWordEnd(editor, block, old.offset);
|
|
29022
|
+
const deletedCount = endOffset - old.offset;
|
|
29023
|
+
editor.deleteTextFromBlock(block, old.offset, deletedCount);
|
|
29024
|
+
return true;
|
|
29025
|
+
}
|
|
29026
|
+
function handleEditorDeleteAfterWords(editor) {
|
|
29027
|
+
const old = editor.selection.range.focus;
|
|
29028
|
+
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
29029
|
+
const block = editor.getBlockById(old.blockId);
|
|
29030
|
+
if (!isTextKindBlock(editor, block)) {
|
|
29031
|
+
editor.deleteBlock(block);
|
|
29032
|
+
return;
|
|
29033
|
+
}
|
|
29034
|
+
const needDeleteCount = getTextBlockLength(block) - old.offset;
|
|
29035
|
+
if (needDeleteCount === 0)
|
|
29036
|
+
return;
|
|
29037
|
+
editor.deleteTextFromBlock(block, old.offset, needDeleteCount);
|
|
29038
|
+
}
|
|
29039
|
+
function handleEditorDeleteRightChar(editor) {
|
|
29040
|
+
const old = editor.selection.range.focus;
|
|
29041
|
+
assert(logger$3l, old.isSimple(), "invalid range type");
|
|
29042
|
+
const block = editor.getBlockById(old.blockId);
|
|
29043
|
+
if (!isTextKindBlock(editor, block)) {
|
|
29044
|
+
editor.deleteBlock(block);
|
|
29045
|
+
return;
|
|
29046
|
+
}
|
|
29047
|
+
if (old.offset === getBlockTextLength$6(editor, block)) {
|
|
29048
|
+
const nextVisibleBlock = getNextVisibleBlock(block);
|
|
29049
|
+
if (!nextVisibleBlock)
|
|
29050
|
+
return;
|
|
29051
|
+
if (!isTextKindBlock(editor, nextVisibleBlock))
|
|
29052
|
+
return;
|
|
29053
|
+
if (isEmptyTextBlock(editor, nextVisibleBlock)) {
|
|
29054
|
+
editor.deleteBlock(nextVisibleBlock);
|
|
29055
|
+
return;
|
|
29056
|
+
}
|
|
29057
|
+
const nextBlockText = editor.getBlockText(nextVisibleBlock);
|
|
29058
|
+
editor.deleteBlock(nextVisibleBlock);
|
|
29059
|
+
editor.insertTextToBlock(block, old.offset, nextBlockText);
|
|
29060
|
+
const pos = createSimpleBlockPosition(block, old.offset, "normal");
|
|
29061
|
+
editor.selection.setSelection(pos);
|
|
29062
|
+
editor.selection.updateLastCaretRect();
|
|
29063
|
+
return;
|
|
29064
|
+
}
|
|
29065
|
+
editorDeleteText(editor, "forward", 1, null);
|
|
29066
|
+
}
|
|
28880
29067
|
function handleEditorEnterEvent$1(editor, event) {
|
|
28881
29068
|
if (isFullSelectedOneComplexBlock(editor)) {
|
|
28882
29069
|
const focusedBlock2 = editor.getFocusedBlock();
|
|
@@ -29098,6 +29285,42 @@ var __publicField = (obj, key, value) => {
|
|
|
29098
29285
|
return true;
|
|
29099
29286
|
});
|
|
29100
29287
|
}
|
|
29288
|
+
function editorHandleDeleteLeftWord(editor, event) {
|
|
29289
|
+
if (editor.readonly || !editor.isWritable()) {
|
|
29290
|
+
return false;
|
|
29291
|
+
}
|
|
29292
|
+
return editor.undoManager.runInGroup(() => {
|
|
29293
|
+
handleEditorDeleteLeftWord(editor);
|
|
29294
|
+
return true;
|
|
29295
|
+
});
|
|
29296
|
+
}
|
|
29297
|
+
function editorHandleDeleteRightWord(editor, event) {
|
|
29298
|
+
if (editor.readonly || !editor.isWritable()) {
|
|
29299
|
+
return false;
|
|
29300
|
+
}
|
|
29301
|
+
return editor.undoManager.runInGroup(() => {
|
|
29302
|
+
handleEditorDeleteRightWord(editor);
|
|
29303
|
+
return true;
|
|
29304
|
+
});
|
|
29305
|
+
}
|
|
29306
|
+
function editorHandleDeleteAfterWords(editor, event) {
|
|
29307
|
+
if (editor.readonly || !editor.isWritable()) {
|
|
29308
|
+
return false;
|
|
29309
|
+
}
|
|
29310
|
+
return editor.undoManager.runInGroup(() => {
|
|
29311
|
+
handleEditorDeleteAfterWords(editor);
|
|
29312
|
+
return true;
|
|
29313
|
+
});
|
|
29314
|
+
}
|
|
29315
|
+
function editorHandleDeleteRightChar(editor, event) {
|
|
29316
|
+
if (editor.readonly || !editor.isWritable()) {
|
|
29317
|
+
return false;
|
|
29318
|
+
}
|
|
29319
|
+
return editor.undoManager.runInGroup(() => {
|
|
29320
|
+
handleEditorDeleteRightChar(editor);
|
|
29321
|
+
return true;
|
|
29322
|
+
});
|
|
29323
|
+
}
|
|
29101
29324
|
function editorHandleBackspace(editor, event) {
|
|
29102
29325
|
if (editor.readonly || !editor.isWritable()) {
|
|
29103
29326
|
return false;
|
|
@@ -29191,6 +29414,10 @@ ${codeText}
|
|
|
29191
29414
|
__proto__: null,
|
|
29192
29415
|
editorHandleEnter,
|
|
29193
29416
|
editorHandleDelete,
|
|
29417
|
+
editorHandleDeleteLeftWord,
|
|
29418
|
+
editorHandleDeleteRightWord,
|
|
29419
|
+
editorHandleDeleteAfterWords,
|
|
29420
|
+
editorHandleDeleteRightChar,
|
|
29194
29421
|
editorHandleBackspace,
|
|
29195
29422
|
editorHandleInsertBr,
|
|
29196
29423
|
editorHandlePastePlainText,
|
|
@@ -29198,6 +29425,41 @@ ${codeText}
|
|
|
29198
29425
|
getSelectedCodeBlockMarkdown,
|
|
29199
29426
|
editorHandleCopyMarkdown
|
|
29200
29427
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
29428
|
+
const MacShortcuts = {
|
|
29429
|
+
"Cmd+ArrowLeft": editorMoveLineHome,
|
|
29430
|
+
"Cmd+ArrowRight": editorMoveLineEnd,
|
|
29431
|
+
"Option+ArrowLeft": editorMoveWordLeft,
|
|
29432
|
+
"Option+ArrowRight": editorMoveWordEnd,
|
|
29433
|
+
"Option+Shift+ArrowLeft": editorSelectWordLeft,
|
|
29434
|
+
"Option+Shift+ArrowRight": editorSelectWordEnd,
|
|
29435
|
+
"Cmd+Shift+ArrowLeft": editorSelectLineHome,
|
|
29436
|
+
"Cmd+Shift+ArrowRight": editorSelectLineEnd,
|
|
29437
|
+
"Ctrl+A": editorMoveBlockStart,
|
|
29438
|
+
"Ctrl+E": editorMoveBlockEnd,
|
|
29439
|
+
"Option+Delete": editorHandleDeleteRightWord,
|
|
29440
|
+
"Option+Backspace": editorHandleDeleteLeftWord,
|
|
29441
|
+
"Ctrl+B": editorMoveLeft,
|
|
29442
|
+
"Ctrl+F": editorMoveRight,
|
|
29443
|
+
"Ctrl+N": editorMoveDown,
|
|
29444
|
+
"Ctrl+P": editorMoveUp,
|
|
29445
|
+
"Ctrl+K": editorHandleDeleteAfterWords,
|
|
29446
|
+
"Ctrl+H": editorHandleBackspace,
|
|
29447
|
+
"Ctrl+D": editorHandleDeleteRightChar
|
|
29448
|
+
};
|
|
29449
|
+
const WinLinuxShortcuts = {
|
|
29450
|
+
"Home": editorMoveLineHome,
|
|
29451
|
+
"End": editorMoveLineEnd,
|
|
29452
|
+
"Shift+Home": editorSelectLineHome,
|
|
29453
|
+
"Shift+End": editorSelectLineEnd,
|
|
29454
|
+
"Ctrl+Delete": editorHandleDeleteRightWord,
|
|
29455
|
+
"Ctrl+Backspace": editorHandleDeleteLeftWord,
|
|
29456
|
+
"Ctrl+ArrowLeft": editorMoveWordLeft,
|
|
29457
|
+
"Ctrl+ArrowRight": editorMoveWordEnd,
|
|
29458
|
+
"Ctrl+Shift+ArrowLeft": editorSelectWordLeft,
|
|
29459
|
+
"Ctrl+Shift+ArrowRight": editorSelectWordEnd
|
|
29460
|
+
};
|
|
29461
|
+
const isMac = clientType.isMac;
|
|
29462
|
+
const CustomShortcuts = isMac ? MacShortcuts : WinLinuxShortcuts;
|
|
29201
29463
|
const DefaultShortcuts = {
|
|
29202
29464
|
"ArrowDown": editorMoveDown,
|
|
29203
29465
|
"ArrowUp": editorMoveUp,
|
|
@@ -29207,19 +29469,11 @@ ${codeText}
|
|
|
29207
29469
|
"Shift+ArrowUp": editorSelectUp,
|
|
29208
29470
|
"Shift+ArrowLeft": editorSelectLeft,
|
|
29209
29471
|
"Shift+ArrowRight": editorSelectRight,
|
|
29210
|
-
"CtrlOrCmd+ArrowLeft": editorMoveWordLeft,
|
|
29211
|
-
"CtrlOrCmd+ArrowRight": editorMoveWordEnd,
|
|
29212
|
-
"CtrlOrCmd+Shift+ArrowLeft": editorSelectWordLeft,
|
|
29213
|
-
"CtrlOrCmd+Shift+ArrowRight": editorSelectWordEnd,
|
|
29214
29472
|
"CtrlOrCmd+ArrowUp": editorMoveHome,
|
|
29215
29473
|
"CtrlOrCmd+ArrowDown": editorMoveEnd,
|
|
29216
29474
|
"CtrlOrCmd+Shift+ArrowUp": editorSelectHome,
|
|
29217
29475
|
"CtrlOrCmd+Shift+ArrowDown": editorSelectEnd,
|
|
29218
29476
|
"CtrlOrCmd+A": editorSelectAll,
|
|
29219
|
-
"Home": editorMoveLineHome,
|
|
29220
|
-
"End": editorMoveLineEnd,
|
|
29221
|
-
"Shift+Home": editorSelectLineHome,
|
|
29222
|
-
"Shift+End": editorSelectLineEnd,
|
|
29223
29477
|
"PageUp": editorMovePageUp,
|
|
29224
29478
|
"PageDown": editorMovePageDown,
|
|
29225
29479
|
"Shift+PageUp": editorSelectPageUp,
|
|
@@ -29231,7 +29485,8 @@ ${codeText}
|
|
|
29231
29485
|
"Backspace": editorHandleBackspace,
|
|
29232
29486
|
"Shift+Enter": editorHandleInsertBr,
|
|
29233
29487
|
"CtrlOrCmd+Shift+V": editorHandlePastePlainText,
|
|
29234
|
-
"CtrlOrCmd+Shift+C": editorHandleCopyMarkdown
|
|
29488
|
+
"CtrlOrCmd+Shift+C": editorHandleCopyMarkdown,
|
|
29489
|
+
...CustomShortcuts
|
|
29235
29490
|
};
|
|
29236
29491
|
function editorHandleKeyboardEvent(editor, event) {
|
|
29237
29492
|
const result = editor.shortcuts.handleKeyboardEvents(editor, event);
|
|
@@ -42458,6 +42713,7 @@ ${codeText}
|
|
|
42458
42713
|
this.options.onClickItem(this, item);
|
|
42459
42714
|
}, 300, { leading: true, trailing: false }));
|
|
42460
42715
|
__publicField(this, "handleShow", (menu) => {
|
|
42716
|
+
this.menu.content.classList.add("auto-suggest-menu");
|
|
42461
42717
|
});
|
|
42462
42718
|
__publicField(this, "handleShown", () => {
|
|
42463
42719
|
var _a, _b;
|
|
@@ -43009,8 +43265,21 @@ ${codeText}
|
|
|
43009
43265
|
const textColorItem = "";
|
|
43010
43266
|
const DEFAULT_BG_COLOR = 2;
|
|
43011
43267
|
const NULLABLE_COLOR = -1;
|
|
43268
|
+
const STORAGE_NAME = "color-item";
|
|
43269
|
+
function getColorsFromLocalStorage(editor) {
|
|
43270
|
+
const colors = [null, null];
|
|
43271
|
+
const color = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-color`) || "", 10);
|
|
43272
|
+
const backgroundColor = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-backgroundColor`) || `${DEFAULT_BG_COLOR}`, 10);
|
|
43273
|
+
if (!Number.isNaN(color)) {
|
|
43274
|
+
colors[0] = color;
|
|
43275
|
+
}
|
|
43276
|
+
if (!Number.isNaN(backgroundColor)) {
|
|
43277
|
+
colors[1] = backgroundColor;
|
|
43278
|
+
}
|
|
43279
|
+
return colors;
|
|
43280
|
+
}
|
|
43012
43281
|
class TextColorItem extends tinyTypedEmitter.TypedEmitter {
|
|
43013
|
-
constructor(editor, storageName =
|
|
43282
|
+
constructor(editor, storageName = STORAGE_NAME) {
|
|
43014
43283
|
super();
|
|
43015
43284
|
__publicField(this, "id", "text-color-item");
|
|
43016
43285
|
__publicField(this, "name", i18n$1.t("colorPalette.name"));
|
|
@@ -43501,6 +43770,32 @@ ${codeText}
|
|
|
43501
43770
|
}
|
|
43502
43771
|
return this.menu.handleKeydown(event);
|
|
43503
43772
|
}
|
|
43773
|
+
async handleBeforePasteDoc(editor, doc2) {
|
|
43774
|
+
var _a;
|
|
43775
|
+
if (!((_a = this.menu) == null ? void 0 : _a.isVisible)) {
|
|
43776
|
+
return false;
|
|
43777
|
+
}
|
|
43778
|
+
const shouldCancelAutoSuggest = () => {
|
|
43779
|
+
var _a2;
|
|
43780
|
+
const blocks = doc2.blocks.root;
|
|
43781
|
+
if (blocks.length !== 1) {
|
|
43782
|
+
return true;
|
|
43783
|
+
}
|
|
43784
|
+
const block = blocks[0];
|
|
43785
|
+
if (((_a2 = editor.editorBlocks.getBlockClass(block.type)) == null ? void 0 : _a2.blockKind) !== "text") {
|
|
43786
|
+
return true;
|
|
43787
|
+
}
|
|
43788
|
+
const text2 = toPlainText(block.text || []);
|
|
43789
|
+
if (text2.length > 50) {
|
|
43790
|
+
return true;
|
|
43791
|
+
}
|
|
43792
|
+
return false;
|
|
43793
|
+
};
|
|
43794
|
+
if (shouldCancelAutoSuggest()) {
|
|
43795
|
+
this.menu.close();
|
|
43796
|
+
}
|
|
43797
|
+
return false;
|
|
43798
|
+
}
|
|
43504
43799
|
popup(block, offset, leftText, trigger) {
|
|
43505
43800
|
this.anchor = {
|
|
43506
43801
|
blockId: getBlockId(block),
|
|
@@ -43556,6 +43851,13 @@ ${codeText}
|
|
|
43556
43851
|
}
|
|
43557
43852
|
return this.triggerPopup(editor, containerId, blockIndex, insertOffset, text2);
|
|
43558
43853
|
}
|
|
43854
|
+
async handleAfterPasteDoc(editor, doc2, cloneDocResult) {
|
|
43855
|
+
var _a;
|
|
43856
|
+
if ((_a = this.menu) == null ? void 0 : _a.isVisible) {
|
|
43857
|
+
this.resetItems();
|
|
43858
|
+
}
|
|
43859
|
+
return false;
|
|
43860
|
+
}
|
|
43559
43861
|
handleUpdateCompositionText(editor, containerId, blockIndex, offset, end) {
|
|
43560
43862
|
var _a;
|
|
43561
43863
|
const start = editor.selection.range.start;
|
|
@@ -50705,7 +51007,7 @@ ${codeText}
|
|
|
50705
51007
|
}
|
|
50706
51008
|
return handleDragList(editor, draggedBlock, targetBlock, insertPos);
|
|
50707
51009
|
}
|
|
50708
|
-
function executeShortcut$
|
|
51010
|
+
function executeShortcut$3(editor, type) {
|
|
50709
51011
|
if (!editor.isWritable()) {
|
|
50710
51012
|
return false;
|
|
50711
51013
|
}
|
|
@@ -50719,8 +51021,8 @@ ${codeText}
|
|
|
50719
51021
|
return true;
|
|
50720
51022
|
}
|
|
50721
51023
|
const ListBlockShortcuts = {
|
|
50722
|
-
"Shift+CtrlOrCmd+L": (editor) => executeShortcut$
|
|
50723
|
-
"Shift+CtrlOrCmd+U": (editor) => executeShortcut$
|
|
51024
|
+
"Shift+CtrlOrCmd+L": (editor) => executeShortcut$3(editor, "ordered-list"),
|
|
51025
|
+
"Shift+CtrlOrCmd+U": (editor) => executeShortcut$3(editor, "unordered-list")
|
|
50724
51026
|
};
|
|
50725
51027
|
function getBlockPadding$1(block) {
|
|
50726
51028
|
const padding = block.getAttribute("block-padding-level");
|
|
@@ -61230,6 +61532,31 @@ $$${mathData.mathjaxText}$$
|
|
|
61230
61532
|
return editor.addCustom("overflow-tooltip-helper", () => new OverflowTooltipHelper(editor));
|
|
61231
61533
|
}
|
|
61232
61534
|
}
|
|
61535
|
+
function executeShortcut$2(editor, style2) {
|
|
61536
|
+
if (!editor.isWritable()) {
|
|
61537
|
+
return false;
|
|
61538
|
+
}
|
|
61539
|
+
const range = editor.selection.range;
|
|
61540
|
+
const allCommands = editor.editorCommandProviders.getCommands(range);
|
|
61541
|
+
const alignCommands = allCommands.flatMap((command2) => {
|
|
61542
|
+
if (command2.id === "align") {
|
|
61543
|
+
return command2.children;
|
|
61544
|
+
}
|
|
61545
|
+
return [];
|
|
61546
|
+
});
|
|
61547
|
+
const command = alignCommands.find((c) => c.id === `align-${style2}`);
|
|
61548
|
+
if (!command) {
|
|
61549
|
+
return false;
|
|
61550
|
+
}
|
|
61551
|
+
editor.editorCommandProviders.executeCommand(range, command, {});
|
|
61552
|
+
OnesEditorToolbar.get(editor).update("selectionChange");
|
|
61553
|
+
return true;
|
|
61554
|
+
}
|
|
61555
|
+
const AlignShortcuts = {
|
|
61556
|
+
"CtrlOrCmd+Shift+E": (editor) => executeShortcut$2(editor, "center"),
|
|
61557
|
+
"CtrlOrCmd+Shift+O": (editor) => executeShortcut$2(editor, "left"),
|
|
61558
|
+
"CtrlOrCmd+Shift+R": (editor) => executeShortcut$2(editor, "right")
|
|
61559
|
+
};
|
|
61233
61560
|
const TextCommands = {
|
|
61234
61561
|
"text/style-bold": "bold",
|
|
61235
61562
|
"text/style-italic": "italic",
|
|
@@ -61238,14 +61565,15 @@ $$${mathData.mathjaxText}$$
|
|
|
61238
61565
|
"text/style-code": "code",
|
|
61239
61566
|
"text/style-sub": "subscript",
|
|
61240
61567
|
"text/style-super": "superscript",
|
|
61241
|
-
link: "link"
|
|
61568
|
+
link: "link",
|
|
61569
|
+
"insert-link": "link"
|
|
61242
61570
|
};
|
|
61243
61571
|
function getTextCommands(editor, blockCommands) {
|
|
61244
61572
|
const styleCommandsSet = new Set(Object.keys(TextCommands));
|
|
61245
61573
|
const styleCommands = blockCommands.filter((command) => styleCommandsSet.has(command.id));
|
|
61246
61574
|
return styleCommands;
|
|
61247
61575
|
}
|
|
61248
|
-
function executeShortcut(editor, style2) {
|
|
61576
|
+
function executeShortcut$1(editor, style2) {
|
|
61249
61577
|
if (!editor.isWritable()) {
|
|
61250
61578
|
return false;
|
|
61251
61579
|
}
|
|
@@ -61255,7 +61583,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61255
61583
|
const range = editor.selection.range;
|
|
61256
61584
|
const allCommands = editor.editorCommandProviders.getCommands(range);
|
|
61257
61585
|
const textCommands = getTextCommands(editor, allCommands);
|
|
61258
|
-
const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link");
|
|
61586
|
+
const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link" || c.id === "insert-link");
|
|
61259
61587
|
if (!command) {
|
|
61260
61588
|
return false;
|
|
61261
61589
|
}
|
|
@@ -61290,13 +61618,37 @@ $$${mathData.mathjaxText}$$
|
|
|
61290
61618
|
return shortcuts2;
|
|
61291
61619
|
};
|
|
61292
61620
|
const TextStyleShortcuts = {
|
|
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"),
|
|
61621
|
+
"CtrlOrCmd+B": (editor) => executeShortcut$1(editor, "style-bold"),
|
|
61622
|
+
"CtrlOrCmd+I": (editor) => executeShortcut$1(editor, "style-italic"),
|
|
61623
|
+
"CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "style-underline"),
|
|
61624
|
+
"CtrlOrCmd+D": (editor) => executeShortcut$1(editor, "style-strikethrough"),
|
|
61625
|
+
"CtrlOrCmd+K": (editor) => executeShortcut$1(editor, "insert-link"),
|
|
61298
61626
|
...headingShortcut()
|
|
61299
61627
|
};
|
|
61628
|
+
function executeShortcut(editor) {
|
|
61629
|
+
if (!editor.isWritable()) {
|
|
61630
|
+
return false;
|
|
61631
|
+
}
|
|
61632
|
+
const range = editor.selection.range;
|
|
61633
|
+
if (range.isCollapsed()) {
|
|
61634
|
+
return false;
|
|
61635
|
+
}
|
|
61636
|
+
editor.undoManager.runInGroup(() => {
|
|
61637
|
+
const colors = getColorsFromLocalStorage(editor);
|
|
61638
|
+
colors.forEach((color, idx) => {
|
|
61639
|
+
if (color === null) {
|
|
61640
|
+
return;
|
|
61641
|
+
}
|
|
61642
|
+
const type = idx === 0 ? "color" : "backgroundColor";
|
|
61643
|
+
editorRangeSetColor(editor, type, color, () => {
|
|
61644
|
+
});
|
|
61645
|
+
});
|
|
61646
|
+
});
|
|
61647
|
+
return true;
|
|
61648
|
+
}
|
|
61649
|
+
const TextColorShortcuts = {
|
|
61650
|
+
"CtrlOrCmd+Alt+KeyH": (editor) => executeShortcut(editor)
|
|
61651
|
+
};
|
|
61300
61652
|
const zhCN$p = {
|
|
61301
61653
|
quickMenu: {
|
|
61302
61654
|
basic: {
|
|
@@ -62055,7 +62407,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62055
62407
|
__publicField(this, "updateButtonColor", (range) => {
|
|
62056
62408
|
const currentTextColor = editorRangeGetColor(this.editor, range, this.getEmptyTextBlockColor);
|
|
62057
62409
|
this.colorItem.setCurrentTextColors(currentTextColor);
|
|
62058
|
-
const lastButtonColor = this.
|
|
62410
|
+
const lastButtonColor = getColorsFromLocalStorage(this.editor);
|
|
62059
62411
|
this.colorItem.setCurrentButtonColor(lastButtonColor);
|
|
62060
62412
|
});
|
|
62061
62413
|
__publicField(this, "setActiveAttribute", (type, value) => {
|
|
@@ -73442,6 +73794,16 @@ ${codeText}
|
|
|
73442
73794
|
return false;
|
|
73443
73795
|
}
|
|
73444
73796
|
}
|
|
73797
|
+
const existsAutoSuggest = document.querySelector(".auto-suggest-menu");
|
|
73798
|
+
if (existsAutoSuggest) {
|
|
73799
|
+
const root2 = existsAutoSuggest.closest("[data-tippy-root]");
|
|
73800
|
+
if (root2) {
|
|
73801
|
+
const visibility = window.getComputedStyle(root2).visibility;
|
|
73802
|
+
if (visibility === "visible") {
|
|
73803
|
+
return false;
|
|
73804
|
+
}
|
|
73805
|
+
}
|
|
73806
|
+
}
|
|
73445
73807
|
this.button.clearCheckedState();
|
|
73446
73808
|
this.button.show(docs);
|
|
73447
73809
|
this.event = event;
|
|
@@ -85195,6 +85557,9 @@ ${data2.flowchartText}
|
|
|
85195
85557
|
async function plantumlUrlToResourceId(editor, url) {
|
|
85196
85558
|
try {
|
|
85197
85559
|
const plantumlImgFile = await downloadObjectToFile(editor, url);
|
|
85560
|
+
if (!plantumlImgFile) {
|
|
85561
|
+
return await Promise.resolve(url);
|
|
85562
|
+
}
|
|
85198
85563
|
const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile);
|
|
85199
85564
|
return uploadResourceResult.resourceId;
|
|
85200
85565
|
} catch (error2) {
|
|
@@ -90503,9 +90868,6 @@ ${data2.plantumlText}
|
|
|
90503
90868
|
return void 0;
|
|
90504
90869
|
}
|
|
90505
90870
|
function hasBorder(block) {
|
|
90506
|
-
if (block.type === "embed" && block.embedType && embedTypeHasImage(block.embedType) && block.embedData && block.embedData.src) {
|
|
90507
|
-
return true;
|
|
90508
|
-
}
|
|
90509
90871
|
return false;
|
|
90510
90872
|
}
|
|
90511
90873
|
async function getBlockObject(block, md5Func, textsByBox) {
|
|
@@ -90518,7 +90880,7 @@ ${data2.plantumlText}
|
|
|
90518
90880
|
texts: await getBlockTextObjects(block, textsByBox),
|
|
90519
90881
|
list: getBlockListObject(block),
|
|
90520
90882
|
images: getBlockImageObject(block, md5Func),
|
|
90521
|
-
border: hasBorder(
|
|
90883
|
+
border: hasBorder()
|
|
90522
90884
|
};
|
|
90523
90885
|
}
|
|
90524
90886
|
async function getCodeObject(block, data2, md5Func, textsByBox) {
|
|
@@ -91960,9 +92322,11 @@ ${data2.plantumlText}
|
|
|
91960
92322
|
FindReplaceShortcuts,
|
|
91961
92323
|
BlockPaddingShortcuts,
|
|
91962
92324
|
TextStyleShortcuts,
|
|
92325
|
+
AlignShortcuts,
|
|
91963
92326
|
AutoLinkShortcuts,
|
|
91964
92327
|
DefaultShortcuts,
|
|
91965
92328
|
ListBlockShortcuts,
|
|
92329
|
+
TextColorShortcuts,
|
|
91966
92330
|
...options.shortcuts || []
|
|
91967
92331
|
],
|
|
91968
92332
|
colors: [
|
|
@@ -92171,7 +92535,7 @@ ${data2.plantumlText}
|
|
|
92171
92535
|
}
|
|
92172
92536
|
}
|
|
92173
92537
|
});
|
|
92174
|
-
editor.version = "2.5.1-beta.
|
|
92538
|
+
editor.version = "2.5.1-beta.16";
|
|
92175
92539
|
return editor;
|
|
92176
92540
|
}
|
|
92177
92541
|
function isDoc(doc2) {
|
|
@@ -92284,7 +92648,7 @@ ${data2.plantumlText}
|
|
|
92284
92648
|
}
|
|
92285
92649
|
});
|
|
92286
92650
|
OnesEditorToolbar.register(editor);
|
|
92287
|
-
editor.version = "2.5.1-beta.
|
|
92651
|
+
editor.version = "2.5.1-beta.16";
|
|
92288
92652
|
return editor;
|
|
92289
92653
|
}
|
|
92290
92654
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -138070,6 +138434,7 @@ ${data2.plantumlText}
|
|
|
138070
138434
|
exports2.AlignProvider = AlignProvider;
|
|
138071
138435
|
exports2.AlignRightIcon = AlignRightIcon;
|
|
138072
138436
|
exports2.AlignRightItem = AlignRightItem;
|
|
138437
|
+
exports2.AlignShortcuts = AlignShortcuts;
|
|
138073
138438
|
exports2.AnchorBox = AnchorBox;
|
|
138074
138439
|
exports2.ArrowDownIcon = ArrowDownIcon$1;
|
|
138075
138440
|
exports2.ArrowLeftIcon = arrowLeft;
|
|
@@ -138326,6 +138691,7 @@ ${data2.plantumlText}
|
|
|
138326
138691
|
exports2.TextBox = TextBox;
|
|
138327
138692
|
exports2.TextColorIcon = TextColorIcon;
|
|
138328
138693
|
exports2.TextColorItem = TextColorItem;
|
|
138694
|
+
exports2.TextColorShortcuts = TextColorShortcuts;
|
|
138329
138695
|
exports2.TextCommandProvider = TextCommandProvider;
|
|
138330
138696
|
exports2.TextGroupIcon = TextGroupIcon;
|
|
138331
138697
|
exports2.TextIcon = TextIcon;
|
|
@@ -138495,6 +138861,8 @@ ${data2.plantumlText}
|
|
|
138495
138861
|
exports2.editorInsertTextToBlock = editorInsertTextToBlock;
|
|
138496
138862
|
exports2.editorInsertTextToBlockEx = editorInsertTextToBlockEx;
|
|
138497
138863
|
exports2.editorMergeTextBlock = editorMergeTextBlock;
|
|
138864
|
+
exports2.editorMoveBlockEnd = editorMoveBlockEnd;
|
|
138865
|
+
exports2.editorMoveBlockStart = editorMoveBlockStart;
|
|
138498
138866
|
exports2.editorMoveDown = editorMoveDown;
|
|
138499
138867
|
exports2.editorMoveEnd = editorMoveEnd;
|
|
138500
138868
|
exports2.editorMoveHome = editorMoveHome;
|
|
@@ -138599,6 +138967,7 @@ ${data2.plantumlText}
|
|
|
138599
138967
|
exports2.getBlockTextLength = getBlockTextLength$6;
|
|
138600
138968
|
exports2.getBlockTools = getBlockTools;
|
|
138601
138969
|
exports2.getBlockType = getBlockType;
|
|
138970
|
+
exports2.getBlocksBetween = getBlocksBetween;
|
|
138602
138971
|
exports2.getBlocksWidth = getBlocksWidth;
|
|
138603
138972
|
exports2.getBoxContent = getBoxContent;
|
|
138604
138973
|
exports2.getBoxId = getBoxId;
|
|
@@ -138611,6 +138980,7 @@ ${data2.plantumlText}
|
|
|
138611
138980
|
exports2.getClosestContainerByCondition = getClosestContainerByCondition;
|
|
138612
138981
|
exports2.getColorFromAttributes = getColorFromAttributes;
|
|
138613
138982
|
exports2.getColorFromContent = getColorFromContent;
|
|
138983
|
+
exports2.getColorsFromLocalStorage = getColorsFromLocalStorage;
|
|
138614
138984
|
exports2.getComplexBlockClass = getComplexBlockClass;
|
|
138615
138985
|
exports2.getContainerBlockOverrideOptions = getContainerBlockOverrideOptions;
|
|
138616
138986
|
exports2.getContainerBlockPath = getContainerBlockPath;
|
|
@@ -138713,6 +139083,7 @@ ${data2.plantumlText}
|
|
|
138713
139083
|
exports2.isBox = isBox;
|
|
138714
139084
|
exports2.isBoxOp = isBoxOp;
|
|
138715
139085
|
exports2.isCJK = isCJK;
|
|
139086
|
+
exports2.isCJKPunctuation = isCJKPunctuation;
|
|
138716
139087
|
exports2.isChildContainer = isChildContainer;
|
|
138717
139088
|
exports2.isChildNode = isChildNode;
|
|
138718
139089
|
exports2.isClipboardEmpty = isClipboardEmpty$1;
|
|
@@ -138785,7 +139156,7 @@ ${data2.plantumlText}
|
|
|
138785
139156
|
exports2.loadJs = loadJs;
|
|
138786
139157
|
exports2.loadJsPromise = loadJsPromise;
|
|
138787
139158
|
exports2.lockers = lockers;
|
|
138788
|
-
exports2.logger = logger$
|
|
139159
|
+
exports2.logger = logger$4q;
|
|
138789
139160
|
exports2.markdownToDoc = markdownToDoc;
|
|
138790
139161
|
exports2.mergeCommands = mergeCommands;
|
|
138791
139162
|
exports2.mergeDocs = mergeDocs;
|