@ones-editor/editor 2.9.8-beta.4 → 2.9.8-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@ones-editor/cke-html/package.json +7 -0
- package/@ones-editor/cke-html/src/html/cke-html.d.ts +4 -0
- package/@ones-editor/cke-html/src/html/combine-html.d.ts +2 -0
- package/@ones-editor/cke-html/src/html/comment.d.ts +6 -0
- package/@ones-editor/cke-html/src/html/converter.d.ts +7 -0
- package/@ones-editor/cke-html/src/html/data-helper/link-data.d.ts +0 -0
- package/@ones-editor/cke-html/src/html/image.d.ts +4 -0
- package/@ones-editor/cke-html/src/html/link.d.ts +2 -0
- package/@ones-editor/cke-html/src/html/markdown.d.ts +2 -0
- package/@ones-editor/cke-html/src/html/mention.d.ts +4 -0
- package/@ones-editor/cke-html/src/index.d.ts +2 -0
- package/@ones-editor/core/src/core/doc/doc.d.ts +2 -1
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +1 -0
- package/@ones-editor/core/src/core/selection/actions/index.d.ts +2 -2
- package/@ones-editor/core/src/core/selection/actions/select-all.d.ts +1 -0
- package/@ones-editor/core/src/core/types.d.ts +2 -0
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
- package/@ones-editor/core/src/users/remote-users.d.ts +1 -1
- package/@ones-editor/graph-embed/src/helper/graph-dom/code-editor.d.ts +1 -0
- package/@ones-editor/list-block/src/index.d.ts +2 -0
- package/@ones-editor/main-toolbar/src/items/insert.d.ts +3 -0
- package/@ones-editor/server-tools/src/index.d.ts +4 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +2 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/providers/list.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +2 -1
- package/@ones-editor/ui-base/src/command-bar/fixed-toolbar.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +7 -3
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +6 -1
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +3 -1
- package/@ones-editor/versions/src/version-dialog/index.d.ts +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +733 -157
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1914,6 +1914,10 @@ div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar.menu .menu-ite
|
|
|
1914
1914
|
}.editor-command-bar.toolbar .command-item[data-dropdown=true][data-id=text-color-item] {
|
|
1915
1915
|
padding-left: 0;
|
|
1916
1916
|
padding-right: 0;
|
|
1917
|
+
}
|
|
1918
|
+
.command-item[data-button-id=text-color-item].disabled .color-button {
|
|
1919
|
+
cursor: not-allowed;
|
|
1920
|
+
opacity: 0.5;
|
|
1917
1921
|
}.editor-input-wrap .editor-input-label {
|
|
1918
1922
|
margin-top: 8px;
|
|
1919
1923
|
margin-bottom: 8px;
|
|
@@ -3190,11 +3194,9 @@ div.editor-root div.editor-content div[data-type=editor-block] div[data-type=blo
|
|
|
3190
3194
|
}
|
|
3191
3195
|
div.editor-root div.editor-content div[data-type=editor-block] div[data-type=block-content] > span.status-box .box-status-common {
|
|
3192
3196
|
max-width: 100%;
|
|
3193
|
-
line-height: 20px;
|
|
3194
3197
|
padding: 0px 5px;
|
|
3195
3198
|
border-radius: 3px;
|
|
3196
|
-
font-size:
|
|
3197
|
-
height: 20px;
|
|
3199
|
+
font-size: 0.8em;
|
|
3198
3200
|
cursor: pointer;
|
|
3199
3201
|
white-space: nowrap;
|
|
3200
3202
|
text-overflow: ellipsis;
|
|
@@ -8809,7 +8811,31 @@ div.editor-root div.editor-content div[data-type=editor-container].root.select-a
|
|
|
8809
8811
|
margin-left: 5px;
|
|
8810
8812
|
margin-right: 5px;
|
|
8811
8813
|
}div.editor-root.compact div.editor-content div[data-type=editor-container].root > .container-blocks > * + * {
|
|
8812
|
-
margin: 0.2em
|
|
8814
|
+
margin-top: 0.2em;
|
|
8815
|
+
}
|
|
8816
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-quoted] + div[data-type=editor-block][data-style-quoted] {
|
|
8817
|
+
margin-top: 0;
|
|
8818
|
+
}
|
|
8819
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block].layout-block .container-blocks > * + * {
|
|
8820
|
+
margin-top: 0.2em;
|
|
8821
|
+
}
|
|
8822
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="1"]:not(:first-child) {
|
|
8823
|
+
margin-top: 0.5em !important;
|
|
8824
|
+
}
|
|
8825
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="2"]:not(:first-child) {
|
|
8826
|
+
margin-top: 0.5em !important;
|
|
8827
|
+
}
|
|
8828
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="3"]:not(:first-child) {
|
|
8829
|
+
margin-top: 0.5em !important;
|
|
8830
|
+
}
|
|
8831
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="4"]:not(:first-child) {
|
|
8832
|
+
margin-top: 0.4em !important;
|
|
8833
|
+
}
|
|
8834
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="5"]:not(:first-child) {
|
|
8835
|
+
margin-top: 0.3em !important;
|
|
8836
|
+
}
|
|
8837
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="6"]:not(:first-child) {
|
|
8838
|
+
margin-top: 0.2em !important;
|
|
8813
8839
|
}
|
|
8814
8840
|
div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
|
|
8815
8841
|
padding-left: 10px;
|
|
@@ -9958,6 +9984,9 @@ var __publicField = (obj, key, value) => {
|
|
|
9958
9984
|
setDataset(elem, dataset);
|
|
9959
9985
|
}
|
|
9960
9986
|
}
|
|
9987
|
+
if (tagName === "button") {
|
|
9988
|
+
elem.type = "button";
|
|
9989
|
+
}
|
|
9961
9990
|
return elem;
|
|
9962
9991
|
}
|
|
9963
9992
|
function createIconButton(svg, classes, parent) {
|
|
@@ -24898,18 +24927,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24898
24927
|
};
|
|
24899
24928
|
}
|
|
24900
24929
|
function isEmptyDoc(doc2) {
|
|
24901
|
-
const
|
|
24902
|
-
|
|
24903
|
-
return
|
|
24904
|
-
}
|
|
24905
|
-
|
|
24906
|
-
if (!block.text) {
|
|
24907
|
-
return false;
|
|
24908
|
-
}
|
|
24909
|
-
if (getTextLength(block.text)) {
|
|
24910
|
-
return false;
|
|
24911
|
-
}
|
|
24912
|
-
return true;
|
|
24930
|
+
const blocks = doc2.blocks.root;
|
|
24931
|
+
const ret = blocks.every((block) => {
|
|
24932
|
+
return block.type === "text" && getTextLength(block.text || []) === 0;
|
|
24933
|
+
});
|
|
24934
|
+
return ret;
|
|
24913
24935
|
}
|
|
24914
24936
|
function createContainer$1(doc2, docsOrDocObject) {
|
|
24915
24937
|
const containerId = genId();
|
|
@@ -26413,6 +26435,10 @@ var __publicField = (obj, key, value) => {
|
|
|
26413
26435
|
if (isNodeRemoved(this.editor.rootElement)) {
|
|
26414
26436
|
return;
|
|
26415
26437
|
}
|
|
26438
|
+
const rootRect = this.editor.rootElement.getBoundingClientRect();
|
|
26439
|
+
if (rootRect.width === 0 || rootRect.height === 0) {
|
|
26440
|
+
return;
|
|
26441
|
+
}
|
|
26416
26442
|
const cursor = this.caretElem;
|
|
26417
26443
|
if (this.hasCaret()) {
|
|
26418
26444
|
cursor.style.display = "";
|
|
@@ -26421,42 +26447,46 @@ var __publicField = (obj, key, value) => {
|
|
|
26421
26447
|
moveInputToScreenCenter(this.editor);
|
|
26422
26448
|
return;
|
|
26423
26449
|
}
|
|
26424
|
-
|
|
26425
|
-
|
|
26426
|
-
|
|
26427
|
-
|
|
26428
|
-
|
|
26429
|
-
|
|
26430
|
-
|
|
26431
|
-
|
|
26432
|
-
|
|
26433
|
-
|
|
26434
|
-
|
|
26435
|
-
|
|
26436
|
-
|
|
26437
|
-
|
|
26438
|
-
|
|
26439
|
-
|
|
26440
|
-
|
|
26441
|
-
|
|
26442
|
-
|
|
26443
|
-
|
|
26444
|
-
|
|
26445
|
-
|
|
26446
|
-
|
|
26447
|
-
|
|
26448
|
-
|
|
26449
|
-
|
|
26450
|
-
|
|
26451
|
-
|
|
26452
|
-
|
|
26453
|
-
|
|
26454
|
-
|
|
26455
|
-
|
|
26456
|
-
|
|
26457
|
-
|
|
26458
|
-
|
|
26459
|
-
|
|
26450
|
+
try {
|
|
26451
|
+
const { range } = this.editor.selection;
|
|
26452
|
+
assert(logger$3S, range.isCollapsed, "range is not collapsed");
|
|
26453
|
+
const pos = range.start;
|
|
26454
|
+
assert(logger$3S, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
|
|
26455
|
+
const block = this.editor.getBlockById(pos.blockId);
|
|
26456
|
+
assert(logger$3S, isTextKindBlock(this.editor, block), "only text kind block can has caret");
|
|
26457
|
+
let rect;
|
|
26458
|
+
const compositionSpan = block.querySelector("span.inputting-insertion");
|
|
26459
|
+
if (compositionSpan) {
|
|
26460
|
+
rect = getLastClientRect(compositionSpan);
|
|
26461
|
+
rect = new DOMRect(rect.right, rect.top, 1, rect.height);
|
|
26462
|
+
} else {
|
|
26463
|
+
rect = getTextCaretRect(block, pos);
|
|
26464
|
+
}
|
|
26465
|
+
const editorRect = this.editor.contentElement.getBoundingClientRect();
|
|
26466
|
+
const x = rect.left - editorRect.left;
|
|
26467
|
+
const y = rect.top - editorRect.top;
|
|
26468
|
+
cursor.style.left = `${x}px`;
|
|
26469
|
+
cursor.style.top = `${y}px`;
|
|
26470
|
+
cursor.style.height = `${rect.height}px`;
|
|
26471
|
+
const input2 = this.editor.input.inputElement;
|
|
26472
|
+
input2.style.left = `${x}px`;
|
|
26473
|
+
input2.style.top = `${y + rect.height - 24}px`;
|
|
26474
|
+
if (clientType.isMobileSafari) {
|
|
26475
|
+
input2.style.left = `${x - 4}px`;
|
|
26476
|
+
input2.style.height = `${rect.height}px`;
|
|
26477
|
+
}
|
|
26478
|
+
const scrollContainer = getScrollContainer$1(block, { horizontal: true });
|
|
26479
|
+
const scrollRect = scrollContainer.getBoundingClientRect();
|
|
26480
|
+
const scrollLeft = scrollRect.left - editorRect.left;
|
|
26481
|
+
const scrollRight = scrollLeft + scrollRect.width;
|
|
26482
|
+
if (x < scrollLeft || x > scrollRight) {
|
|
26483
|
+
moveInputToScreenCenter(this.editor);
|
|
26484
|
+
cursor.style.display = "none";
|
|
26485
|
+
} else {
|
|
26486
|
+
cursor.style.display = "";
|
|
26487
|
+
}
|
|
26488
|
+
} catch (err) {
|
|
26489
|
+
logger$3S.error(err);
|
|
26460
26490
|
}
|
|
26461
26491
|
}
|
|
26462
26492
|
}
|
|
@@ -26641,13 +26671,14 @@ var __publicField = (obj, key, value) => {
|
|
|
26641
26671
|
while (prevBlock && !blocks.has(getBlockId(prevBlock))) {
|
|
26642
26672
|
prevBlock = getPrevVisibleBlock(prevBlock);
|
|
26643
26673
|
}
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
assert(logger$3Q, nextBlock, "no prev and next block while deleting a block");
|
|
26649
|
-
newRange = createBlockSimpleRange(editor, nextBlock, 0);
|
|
26674
|
+
if (prevBlock) {
|
|
26675
|
+
newRange = createBlockSimpleRange(editor, prevBlock, getBlockTextLength$6(editor, prevBlock));
|
|
26676
|
+
return newRange;
|
|
26677
|
+
}
|
|
26650
26678
|
}
|
|
26679
|
+
const nextBlock = getNextVisibleBlock(block);
|
|
26680
|
+
assert(logger$3Q, nextBlock, "no prev and next block while deleting a block");
|
|
26681
|
+
newRange = createBlockSimpleRange(editor, nextBlock, 0);
|
|
26651
26682
|
return newRange;
|
|
26652
26683
|
}
|
|
26653
26684
|
const logger$3P = getLogger("block-to-html");
|
|
@@ -28547,6 +28578,10 @@ var __publicField = (obj, key, value) => {
|
|
|
28547
28578
|
const end = createSimpleBlockPosition(lastBlock2, getBlockTextLength$6(editor, lastBlock2), "end");
|
|
28548
28579
|
editor.selection.setSelection(start, end, { noScroll: true });
|
|
28549
28580
|
}
|
|
28581
|
+
function editorSelectAllBlocks(editor) {
|
|
28582
|
+
addClass(editor.rootContainer, "select-all");
|
|
28583
|
+
selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
|
|
28584
|
+
}
|
|
28550
28585
|
function editorSelectWord(editor) {
|
|
28551
28586
|
const old = editor.selection.range.focus;
|
|
28552
28587
|
if (!old.isSimple())
|
|
@@ -28809,10 +28844,19 @@ var __publicField = (obj, key, value) => {
|
|
|
28809
28844
|
});
|
|
28810
28845
|
this.editor = editor;
|
|
28811
28846
|
const block = editor.getFirstBlock();
|
|
28812
|
-
const blockId = getBlockId(block);
|
|
28813
28847
|
this.caret = new EditorCaret(editor);
|
|
28814
|
-
|
|
28815
|
-
|
|
28848
|
+
if (isComplexKindBlock(editor, block)) {
|
|
28849
|
+
const simpleBlock = complexBlockGetFirstSimpleChild(editor, block, {
|
|
28850
|
+
visibleOnly: true
|
|
28851
|
+
}) || block;
|
|
28852
|
+
const blockId = getBlockId(simpleBlock);
|
|
28853
|
+
const pos = createSimpleBlockPosition(blockId, 0, "normal");
|
|
28854
|
+
this._range = createEditorSelectionRange(editor, { anchor: pos, focus: pos });
|
|
28855
|
+
} else {
|
|
28856
|
+
const blockId = getBlockId(block);
|
|
28857
|
+
const pos = createSimpleBlockPosition(blockId, 0, "normal");
|
|
28858
|
+
this._range = createEditorSelectionRange(editor, { anchor: pos, focus: pos });
|
|
28859
|
+
}
|
|
28816
28860
|
this.lastCaretRect = null;
|
|
28817
28861
|
this.editor.addListener("blockDeleted", this.handleBlockDelete);
|
|
28818
28862
|
setTimeout(() => {
|
|
@@ -29913,7 +29957,7 @@ ${codeText}
|
|
|
29913
29957
|
const remoteResourcesMap = /* @__PURE__ */ new Map();
|
|
29914
29958
|
Object.entries(resources).forEach(([resourceId, resourceUrl]) => {
|
|
29915
29959
|
if (localResourcesMap.get(resourceId) === void 0) {
|
|
29916
|
-
if (resourceId !== resourceUrl) {
|
|
29960
|
+
if (resourceId !== resourceUrl && resourceId.indexOf(":") === -1) {
|
|
29917
29961
|
remoteResourcesMap.set(resourceId, resourceUrl);
|
|
29918
29962
|
}
|
|
29919
29963
|
}
|
|
@@ -30571,6 +30615,10 @@ ${codeText}
|
|
|
30571
30615
|
endBatchUpdate() {
|
|
30572
30616
|
return this.externalDoc.endBatchUpdate();
|
|
30573
30617
|
}
|
|
30618
|
+
applyingOps() {
|
|
30619
|
+
var _a, _b;
|
|
30620
|
+
return ((_b = (_a = this.externalDoc).applyingOps) == null ? void 0 : _b.call(_a)) || false;
|
|
30621
|
+
}
|
|
30574
30622
|
registerLocalEvents(events2) {
|
|
30575
30623
|
this.localEvents.push(events2);
|
|
30576
30624
|
}
|
|
@@ -31796,11 +31844,16 @@ ${codeText}
|
|
|
31796
31844
|
return rangeResult;
|
|
31797
31845
|
}
|
|
31798
31846
|
}
|
|
31799
|
-
|
|
31800
|
-
|
|
31801
|
-
const
|
|
31802
|
-
|
|
31803
|
-
|
|
31847
|
+
editor.doc.beginBatchUpdate();
|
|
31848
|
+
try {
|
|
31849
|
+
const blocks = range.getSelectedBlocks();
|
|
31850
|
+
blocks.forEach((b) => {
|
|
31851
|
+
const childRange = createEditorSelectionRange(editor, { anchor: b.start, focus: b.end });
|
|
31852
|
+
this.executeBlockCommand(editor, b.block, childRange, command, params, rangeResult);
|
|
31853
|
+
});
|
|
31854
|
+
} finally {
|
|
31855
|
+
editor.doc.endBatchUpdate();
|
|
31856
|
+
}
|
|
31804
31857
|
if (!clientType.isMobile) {
|
|
31805
31858
|
editor.focus();
|
|
31806
31859
|
}
|
|
@@ -31957,6 +32010,7 @@ ${codeText}
|
|
|
31957
32010
|
__publicField(this, "settingsProvider");
|
|
31958
32011
|
__publicField(this, "_readonly", false);
|
|
31959
32012
|
__publicField(this, "_scrollable", true);
|
|
32013
|
+
__publicField(this, "_destroyed", false);
|
|
31960
32014
|
__publicField(this, "getColor", (index2) => {
|
|
31961
32015
|
const colors = this.options.colors;
|
|
31962
32016
|
if (colors.length === 0) {
|
|
@@ -32096,6 +32150,10 @@ ${codeText}
|
|
|
32096
32150
|
this.domEvents.destroy();
|
|
32097
32151
|
this.removeAllListeners();
|
|
32098
32152
|
this.inputHandlers.destroy();
|
|
32153
|
+
this._destroyed = true;
|
|
32154
|
+
}
|
|
32155
|
+
get destroyed() {
|
|
32156
|
+
return this._destroyed;
|
|
32099
32157
|
}
|
|
32100
32158
|
focus(options) {
|
|
32101
32159
|
this.input.focus(options);
|
|
@@ -32387,11 +32445,17 @@ ${codeText}
|
|
|
32387
32445
|
this.emit("change", Array.from(this.users.values()));
|
|
32388
32446
|
}, 300);
|
|
32389
32447
|
}
|
|
32390
|
-
getSimpleCursors(blockId) {
|
|
32448
|
+
getSimpleCursors(blockId, excludeUserId) {
|
|
32391
32449
|
const ret = /* @__PURE__ */ new Map();
|
|
32392
32450
|
Array.from(this.cursors.values()).filter((message) => {
|
|
32393
32451
|
const ret2 = message.range.anchor.blockId === blockId && isSimpleRange(message.range);
|
|
32394
|
-
|
|
32452
|
+
if (!ret2) {
|
|
32453
|
+
return false;
|
|
32454
|
+
}
|
|
32455
|
+
if (excludeUserId && excludeUserId === message.user.userId) {
|
|
32456
|
+
return false;
|
|
32457
|
+
}
|
|
32458
|
+
return true;
|
|
32395
32459
|
}).forEach((message) => {
|
|
32396
32460
|
const offset = message.range.focus.offset;
|
|
32397
32461
|
let users = ret.get(offset);
|
|
@@ -32472,6 +32536,9 @@ ${codeText}
|
|
|
32472
32536
|
rawData() {
|
|
32473
32537
|
return this.doc;
|
|
32474
32538
|
}
|
|
32539
|
+
applyingOps() {
|
|
32540
|
+
return false;
|
|
32541
|
+
}
|
|
32475
32542
|
getContainerBlocks(containerId) {
|
|
32476
32543
|
const blocks = this.doc.blocks[containerId];
|
|
32477
32544
|
return blocks;
|
|
@@ -39454,6 +39521,7 @@ ${codeText}
|
|
|
39454
39521
|
__publicField(this, "disableLogout");
|
|
39455
39522
|
__publicField(this, "destroyed", false);
|
|
39456
39523
|
__publicField(this, "editStatus");
|
|
39524
|
+
__publicField(this, "_applyingOps", false);
|
|
39457
39525
|
__publicField(this, "handleNothingPending", () => {
|
|
39458
39526
|
this.setStatus("clean");
|
|
39459
39527
|
});
|
|
@@ -39638,11 +39706,14 @@ ${codeText}
|
|
|
39638
39706
|
return;
|
|
39639
39707
|
}
|
|
39640
39708
|
try {
|
|
39709
|
+
this._applyingOps = true;
|
|
39641
39710
|
const local = !!source;
|
|
39642
39711
|
parseOps(ops, this, local);
|
|
39643
39712
|
} catch (err) {
|
|
39644
39713
|
logger$2T.error(err);
|
|
39645
39714
|
throw err;
|
|
39715
|
+
} finally {
|
|
39716
|
+
this._applyingOps = false;
|
|
39646
39717
|
}
|
|
39647
39718
|
});
|
|
39648
39719
|
this.options = options;
|
|
@@ -39667,6 +39738,9 @@ ${codeText}
|
|
|
39667
39738
|
}
|
|
39668
39739
|
return this.batching;
|
|
39669
39740
|
}
|
|
39741
|
+
applyingOps() {
|
|
39742
|
+
return this._applyingOps;
|
|
39743
|
+
}
|
|
39670
39744
|
static async load(options) {
|
|
39671
39745
|
try {
|
|
39672
39746
|
const client = new ShareDBClient(options.auth, options.serverUrl, options.renewTokenFunc);
|
|
@@ -40163,7 +40237,7 @@ ${codeText}
|
|
|
40163
40237
|
assert(logger$2S, typeof blockIndex === "number", "invalid path blockIndex");
|
|
40164
40238
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
40165
40239
|
const length = getTextLength(blockText);
|
|
40166
|
-
const cursorMessages = remoteUsers.getSimpleCursors(blockData.id);
|
|
40240
|
+
const cursorMessages = remoteUsers.getSimpleCursors(blockData.id, editor.doc.getUser().userId);
|
|
40167
40241
|
cursorMessages.forEach((messages, offset) => {
|
|
40168
40242
|
if (offset > length) {
|
|
40169
40243
|
offset = length;
|
|
@@ -41365,12 +41439,18 @@ ${codeText}
|
|
|
41365
41439
|
return true;
|
|
41366
41440
|
});
|
|
41367
41441
|
__publicField(this, "handleDocumentMouseDown", (event) => {
|
|
41368
|
-
var _a, _b;
|
|
41442
|
+
var _a, _b, _c;
|
|
41369
41443
|
if (event.target instanceof Element) {
|
|
41370
|
-
if ((_b = (_a = this.options).beforeClose) == null ? void 0 : _b.call(_a, event)) {
|
|
41371
|
-
return;
|
|
41372
|
-
}
|
|
41373
41444
|
if (!this.isInCommandBar(event.target)) {
|
|
41445
|
+
if ((_b = (_a = this.options).beforeClose) == null ? void 0 : _b.call(_a, event)) {
|
|
41446
|
+
return;
|
|
41447
|
+
}
|
|
41448
|
+
if (((_c = this.canClose) == null ? void 0 : _c.call(this)) === false) {
|
|
41449
|
+
return;
|
|
41450
|
+
}
|
|
41451
|
+
if (!this.isVisible) {
|
|
41452
|
+
return;
|
|
41453
|
+
}
|
|
41374
41454
|
const events2 = this.listeners("closing");
|
|
41375
41455
|
for (let i = 0; i < events2.length; i++) {
|
|
41376
41456
|
if (events2[i](this, event) === false) {
|
|
@@ -41535,7 +41615,7 @@ ${codeText}
|
|
|
41535
41615
|
this.closeable = closeable != null ? closeable : null;
|
|
41536
41616
|
this.content = this.createCommandBarContent(items);
|
|
41537
41617
|
}
|
|
41538
|
-
close(reason) {
|
|
41618
|
+
close(reason, e2) {
|
|
41539
41619
|
this.closeReason = reason;
|
|
41540
41620
|
if (this.subBar) {
|
|
41541
41621
|
this.subBar.close(reason);
|
|
@@ -41630,6 +41710,9 @@ ${codeText}
|
|
|
41630
41710
|
this.content.appendChild(child);
|
|
41631
41711
|
});
|
|
41632
41712
|
}
|
|
41713
|
+
canClose() {
|
|
41714
|
+
return true;
|
|
41715
|
+
}
|
|
41633
41716
|
get popper() {
|
|
41634
41717
|
return this.content.closest("[data-tippy-root]");
|
|
41635
41718
|
}
|
|
@@ -41962,16 +42045,48 @@ ${codeText}
|
|
|
41962
42045
|
__publicField(CommandBar, "commandBarCreators", /* @__PURE__ */ new Map());
|
|
41963
42046
|
getLogger("ui-command-bar");
|
|
41964
42047
|
class ManualCommandBar extends CommandBar {
|
|
41965
|
-
constructor() {
|
|
41966
|
-
super(
|
|
42048
|
+
constructor(items, closeable, manualCommandBarOptions) {
|
|
42049
|
+
super(items, closeable, {
|
|
42050
|
+
...manualCommandBarOptions,
|
|
42051
|
+
beforeClose: (e2) => {
|
|
42052
|
+
return this.handleBeforeClose(e2);
|
|
42053
|
+
}
|
|
42054
|
+
});
|
|
41967
42055
|
__publicField(this, "tippyInstance", null);
|
|
42056
|
+
__publicField(this, "_target", null);
|
|
42057
|
+
__publicField(this, "handleBeforeClose", (event) => {
|
|
42058
|
+
var _a;
|
|
42059
|
+
let ret = false;
|
|
42060
|
+
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42061
|
+
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
42062
|
+
}
|
|
42063
|
+
if (ret) {
|
|
42064
|
+
return ret;
|
|
42065
|
+
}
|
|
42066
|
+
if (!this._target) {
|
|
42067
|
+
return ret;
|
|
42068
|
+
}
|
|
42069
|
+
const target = this._target;
|
|
42070
|
+
setTimeout(() => {
|
|
42071
|
+
const parentEditor = target.closest(".editor-root");
|
|
42072
|
+
if (parentEditor) {
|
|
42073
|
+
const input2 = parentEditor.querySelector(".editor-input");
|
|
42074
|
+
if (input2) {
|
|
42075
|
+
input2.focus();
|
|
42076
|
+
}
|
|
42077
|
+
}
|
|
42078
|
+
}, 100);
|
|
42079
|
+
return ret;
|
|
42080
|
+
});
|
|
41968
42081
|
__publicField(this, "setProps", (props) => {
|
|
41969
42082
|
var _a;
|
|
41970
42083
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
41971
42084
|
});
|
|
42085
|
+
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
41972
42086
|
}
|
|
41973
42087
|
manualShow(target, options) {
|
|
41974
42088
|
var _a, _b, _c, _d;
|
|
42089
|
+
this._target = target;
|
|
41975
42090
|
if (this.isVisible) {
|
|
41976
42091
|
return;
|
|
41977
42092
|
}
|
|
@@ -41988,14 +42103,15 @@ ${codeText}
|
|
|
41988
42103
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
41989
42104
|
maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
|
|
41990
42105
|
arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
|
|
41991
|
-
appendTo: document.body,
|
|
42106
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
41992
42107
|
onShow: this.handleShow,
|
|
41993
42108
|
onHidden: this.handleHidden,
|
|
41994
42109
|
onShown: this.handleShown,
|
|
41995
42110
|
theme: options == null ? void 0 : options.theme,
|
|
41996
42111
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
41997
42112
|
offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
|
|
41998
|
-
popperOptions: this.createPopperOptions()
|
|
42113
|
+
popperOptions: this.createPopperOptions(),
|
|
42114
|
+
delay: 500
|
|
41999
42115
|
});
|
|
42000
42116
|
if (options == null ? void 0 : options.point) {
|
|
42001
42117
|
const { x, y } = options.point;
|
|
@@ -42016,11 +42132,15 @@ ${codeText}
|
|
|
42016
42132
|
addClass(this.popper, "mobile");
|
|
42017
42133
|
}
|
|
42018
42134
|
}
|
|
42019
|
-
close(reason) {
|
|
42020
|
-
var _a;
|
|
42135
|
+
close(reason, e2) {
|
|
42136
|
+
var _a, _b;
|
|
42021
42137
|
super.close(reason);
|
|
42022
42138
|
if (this.isVisible) {
|
|
42023
|
-
(
|
|
42139
|
+
if (e2) {
|
|
42140
|
+
(_a = this.tippyInstance) == null ? void 0 : _a.hideWithInteractivity(e2);
|
|
42141
|
+
} else {
|
|
42142
|
+
(_b = this.tippyInstance) == null ? void 0 : _b.hide();
|
|
42143
|
+
}
|
|
42024
42144
|
}
|
|
42025
42145
|
}
|
|
42026
42146
|
destroy() {
|
|
@@ -42554,7 +42674,7 @@ ${codeText}
|
|
|
42554
42674
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
42555
42675
|
maxWidth: 500,
|
|
42556
42676
|
arrow: this.options.tippyArrow,
|
|
42557
|
-
appendTo: document.body,
|
|
42677
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
42558
42678
|
onShow: this.handleShow,
|
|
42559
42679
|
onHidden: this.handleHidden,
|
|
42560
42680
|
delay: options == null ? void 0 : options.delay,
|
|
@@ -42656,6 +42776,12 @@ ${codeText}
|
|
|
42656
42776
|
initItemElement(item, elem) {
|
|
42657
42777
|
initToolbarItem(item, elem, this.options);
|
|
42658
42778
|
}
|
|
42779
|
+
canClose() {
|
|
42780
|
+
if (this.subBar) {
|
|
42781
|
+
return true;
|
|
42782
|
+
}
|
|
42783
|
+
return false;
|
|
42784
|
+
}
|
|
42659
42785
|
close() {
|
|
42660
42786
|
this.clearSelectedItem();
|
|
42661
42787
|
if (this.subBar) {
|
|
@@ -43164,7 +43290,7 @@ ${codeText}
|
|
|
43164
43290
|
placement: "bottom",
|
|
43165
43291
|
maxWidth: 1e3,
|
|
43166
43292
|
arrow: (_b = options == null ? void 0 : options.arrow) != null ? _b : this.options.tippyArrow,
|
|
43167
|
-
appendTo: document.body,
|
|
43293
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
43168
43294
|
onShow: this.handleShow,
|
|
43169
43295
|
onShown: this.handleShown,
|
|
43170
43296
|
onHidden: this.handleHidden,
|
|
@@ -43292,6 +43418,7 @@ ${codeText}
|
|
|
43292
43418
|
return this.currentText;
|
|
43293
43419
|
}
|
|
43294
43420
|
setItems(items) {
|
|
43421
|
+
var _a;
|
|
43295
43422
|
this.menu.updateItems(items);
|
|
43296
43423
|
if (items.length > 0) {
|
|
43297
43424
|
const selectable = (item) => {
|
|
@@ -43305,6 +43432,7 @@ ${codeText}
|
|
|
43305
43432
|
this.menu.selectItem(firstItem.id, "manual");
|
|
43306
43433
|
}
|
|
43307
43434
|
}
|
|
43435
|
+
(_a = this.menu.tippyInstance) == null ? void 0 : _a.setContent(this.menu.content);
|
|
43308
43436
|
}
|
|
43309
43437
|
async popup(anchor2, options) {
|
|
43310
43438
|
var _a, _b;
|
|
@@ -43825,6 +43953,9 @@ ${codeText}
|
|
|
43825
43953
|
__publicField(this, "handlePaletteClick", (type, value) => {
|
|
43826
43954
|
this.setLatestColors(type, value);
|
|
43827
43955
|
this.emit("onClick", type, value);
|
|
43956
|
+
setTimeout(() => {
|
|
43957
|
+
this.editor.emit("textColorChanged", this.editor, this);
|
|
43958
|
+
}, 100);
|
|
43828
43959
|
});
|
|
43829
43960
|
__publicField(this, "handleButtonClick", () => {
|
|
43830
43961
|
const [color, backgroundColor] = this.latestColors;
|
|
@@ -43850,6 +43981,9 @@ ${codeText}
|
|
|
43850
43981
|
this.emit("onClick", "backgroundColor", backgroundColor);
|
|
43851
43982
|
}
|
|
43852
43983
|
this.currentTextColors = [color, backgroundColor];
|
|
43984
|
+
setTimeout(() => {
|
|
43985
|
+
this.editor.emit("textColorChanged", this.editor, this);
|
|
43986
|
+
}, 100);
|
|
43853
43987
|
});
|
|
43854
43988
|
__publicField(this, "setLatestColors", (type, value) => {
|
|
43855
43989
|
var _a, _b;
|
|
@@ -43887,6 +44021,13 @@ ${codeText}
|
|
|
43887
44021
|
this.element.addEventListener("click", this.handleButtonClick);
|
|
43888
44022
|
this.bindColorButtonEvents();
|
|
43889
44023
|
this.element.setAttribute(`data-editor-tooltip-${editor.clientId}`, this.name);
|
|
44024
|
+
this.editor.addListener("textColorChanged", (e2, sender) => {
|
|
44025
|
+
if (sender !== this) {
|
|
44026
|
+
this.latestColors = this.getColorsFromLocalStorage();
|
|
44027
|
+
this.setCurrentButtonColor(this.latestColors);
|
|
44028
|
+
this.updatePaletteColor();
|
|
44029
|
+
}
|
|
44030
|
+
});
|
|
43890
44031
|
}
|
|
43891
44032
|
bindColorButtonEvents() {
|
|
43892
44033
|
if (clientType.isMobile) {
|
|
@@ -50454,10 +50595,10 @@ ${codeText}
|
|
|
50454
50595
|
const startBlock = editor.selection.startBlock;
|
|
50455
50596
|
return isTitleBlock$2(startBlock);
|
|
50456
50597
|
};
|
|
50457
|
-
function maxHeadingContainDocument() {
|
|
50598
|
+
function maxHeadingContainDocument(editor) {
|
|
50458
50599
|
let heading = 8;
|
|
50459
50600
|
while (heading > 0) {
|
|
50460
|
-
if (
|
|
50601
|
+
if (editor.rootElement.querySelector(`div[data-style-heading='${heading}']`)) {
|
|
50461
50602
|
break;
|
|
50462
50603
|
} else {
|
|
50463
50604
|
heading--;
|
|
@@ -50499,7 +50640,7 @@ ${codeText}
|
|
|
50499
50640
|
if ((_a = this.options) == null ? void 0 : _a.maxHeading) {
|
|
50500
50641
|
return this.options.maxHeading;
|
|
50501
50642
|
}
|
|
50502
|
-
let maxHeading = maxHeadingContainDocument();
|
|
50643
|
+
let maxHeading = maxHeadingContainDocument(this.editor);
|
|
50503
50644
|
if (maxHeading <= 4) {
|
|
50504
50645
|
maxHeading = 5;
|
|
50505
50646
|
} else if (maxHeading < 8) {
|
|
@@ -51476,23 +51617,28 @@ ${codeText}
|
|
|
51476
51617
|
}
|
|
51477
51618
|
function resetListStart(editor, brothers, start, options) {
|
|
51478
51619
|
var _a;
|
|
51479
|
-
|
|
51480
|
-
|
|
51481
|
-
const
|
|
51482
|
-
|
|
51483
|
-
const
|
|
51484
|
-
|
|
51485
|
-
|
|
51486
|
-
|
|
51487
|
-
|
|
51488
|
-
|
|
51620
|
+
editor.doc.beginBatchUpdate();
|
|
51621
|
+
try {
|
|
51622
|
+
const groupId = (_a = options == null ? void 0 : options.groupId) != null ? _a : genId();
|
|
51623
|
+
brothers.forEach((block) => {
|
|
51624
|
+
const oldData = editor.getBlockData(block);
|
|
51625
|
+
if (oldData.start !== start || (options == null ? void 0 : options.resetGroupId)) {
|
|
51626
|
+
const newData = {
|
|
51627
|
+
...oldData,
|
|
51628
|
+
start
|
|
51629
|
+
};
|
|
51630
|
+
if (options == null ? void 0 : options.resetGroupId) {
|
|
51631
|
+
newData.groupId = groupId;
|
|
51632
|
+
}
|
|
51633
|
+
editor.updateBlockData(block, newData);
|
|
51489
51634
|
}
|
|
51490
|
-
|
|
51491
|
-
|
|
51492
|
-
|
|
51493
|
-
|
|
51494
|
-
|
|
51495
|
-
|
|
51635
|
+
if (!oldData.textOnly) {
|
|
51636
|
+
start += 1;
|
|
51637
|
+
}
|
|
51638
|
+
});
|
|
51639
|
+
} finally {
|
|
51640
|
+
editor.doc.endBatchUpdate();
|
|
51641
|
+
}
|
|
51496
51642
|
}
|
|
51497
51643
|
function resetListStartByBrother(editor, listBrother, start, options) {
|
|
51498
51644
|
const allBrothers = getListAllBrothers(listBrother, { withSelf: true });
|
|
@@ -53111,7 +53257,11 @@ ${codeText}
|
|
|
53111
53257
|
handleDrop: handleListDrop,
|
|
53112
53258
|
notify,
|
|
53113
53259
|
handleDeleteBlock: (editor, block) => {
|
|
53260
|
+
var _a, _b;
|
|
53114
53261
|
if (isListBlock(block)) {
|
|
53262
|
+
if ((_b = (_a = editor.doc).applyingOps) == null ? void 0 : _b.call(_a)) {
|
|
53263
|
+
return;
|
|
53264
|
+
}
|
|
53115
53265
|
const fixStart = new FixStartByWillDeletedList(editor, block);
|
|
53116
53266
|
setTimeout(() => {
|
|
53117
53267
|
fixStart.fix();
|
|
@@ -53142,15 +53292,15 @@ ${codeText}
|
|
|
53142
53292
|
__publicField(this, "id", "ListProvider");
|
|
53143
53293
|
__publicField(this, "executeInsertCommand", (editor, containerId, blockIndex, command) => {
|
|
53144
53294
|
if (command.id === "unordered-list") {
|
|
53145
|
-
this.insertList(editor, containerId, blockIndex, "unordered");
|
|
53295
|
+
this.insertList(editor, containerId, blockIndex, "unordered", command);
|
|
53146
53296
|
return true;
|
|
53147
53297
|
}
|
|
53148
53298
|
if (command.id === "ordered-list") {
|
|
53149
|
-
this.insertList(editor, containerId, blockIndex, "ordered");
|
|
53299
|
+
this.insertList(editor, containerId, blockIndex, "ordered", command);
|
|
53150
53300
|
return true;
|
|
53151
53301
|
}
|
|
53152
53302
|
if (command.id === "check-list") {
|
|
53153
|
-
this.insertList(editor, containerId, blockIndex, "unchecked");
|
|
53303
|
+
this.insertList(editor, containerId, blockIndex, "unchecked", command);
|
|
53154
53304
|
return true;
|
|
53155
53305
|
}
|
|
53156
53306
|
return false;
|
|
@@ -53233,21 +53383,66 @@ ${codeText}
|
|
|
53233
53383
|
});
|
|
53234
53384
|
}
|
|
53235
53385
|
}
|
|
53236
|
-
insertList(editor, containerId, blockIndex, listType) {
|
|
53386
|
+
insertList(editor, containerId, blockIndex, listType, command) {
|
|
53237
53387
|
var _a;
|
|
53238
|
-
|
|
53239
|
-
|
|
53240
|
-
|
|
53388
|
+
editor.getChildContainerData(containerId);
|
|
53389
|
+
let sourceIndex = blockIndex;
|
|
53390
|
+
let insertBefore = true;
|
|
53391
|
+
if (((_a = command.source) == null ? void 0 : _a.indexOf("/insert-block-after")) !== -1) {
|
|
53392
|
+
insertBefore = false;
|
|
53393
|
+
if (blockIndex > 0) {
|
|
53394
|
+
sourceIndex = blockIndex - 1;
|
|
53395
|
+
}
|
|
53396
|
+
}
|
|
53397
|
+
const currentBlock = editor.findBlockByIndex(containerId, sourceIndex);
|
|
53398
|
+
if (!currentBlock) {
|
|
53399
|
+
return;
|
|
53400
|
+
}
|
|
53401
|
+
const convertResult = convertBlockFrom(editor, currentBlock, "list", {
|
|
53241
53402
|
offset: 0,
|
|
53242
53403
|
data: {
|
|
53243
53404
|
listType
|
|
53244
53405
|
}
|
|
53245
53406
|
});
|
|
53246
|
-
|
|
53247
|
-
|
|
53248
|
-
|
|
53249
|
-
});
|
|
53407
|
+
const newData = convertResult == null ? void 0 : convertResult.blockData;
|
|
53408
|
+
if (!newData) {
|
|
53409
|
+
return;
|
|
53250
53410
|
}
|
|
53411
|
+
const oldData = editor.getBlockData(currentBlock);
|
|
53412
|
+
const oldType = getListType(oldData);
|
|
53413
|
+
const newType = getListType(newData);
|
|
53414
|
+
if (oldType === newType) {
|
|
53415
|
+
if (typeof newData.start === "number") {
|
|
53416
|
+
if (typeof oldData.start === "number") {
|
|
53417
|
+
if (insertBefore) {
|
|
53418
|
+
newData.start = oldData.start - 1;
|
|
53419
|
+
} else {
|
|
53420
|
+
newData.start = oldData.start + 1;
|
|
53421
|
+
}
|
|
53422
|
+
} else {
|
|
53423
|
+
if (insertBefore) {
|
|
53424
|
+
newData.start -= 1;
|
|
53425
|
+
} else {
|
|
53426
|
+
newData.start += 1;
|
|
53427
|
+
}
|
|
53428
|
+
}
|
|
53429
|
+
}
|
|
53430
|
+
if (typeof newData.start === "number" && newData.start <= 0) {
|
|
53431
|
+
newData.start = 1;
|
|
53432
|
+
}
|
|
53433
|
+
newData.groupId = oldData.groupId;
|
|
53434
|
+
}
|
|
53435
|
+
newData.text = [];
|
|
53436
|
+
if (oldType === newType) {
|
|
53437
|
+
newData.heading = oldData.heading;
|
|
53438
|
+
} else {
|
|
53439
|
+
delete newData.heading;
|
|
53440
|
+
}
|
|
53441
|
+
editor.undoManager.runInGroup(() => {
|
|
53442
|
+
const newBlock = editor.insertBlock(containerId, blockIndex, newData);
|
|
53443
|
+
const fix = new FixStartByList(editor, newBlock);
|
|
53444
|
+
fix.fix();
|
|
53445
|
+
});
|
|
53251
53446
|
}
|
|
53252
53447
|
executeCommand(editor, block, range, command) {
|
|
53253
53448
|
if (!isTextKindBlock(editor, block)) {
|
|
@@ -54052,8 +54247,8 @@ ${codeText}
|
|
|
54052
54247
|
setTimeout(() => {
|
|
54053
54248
|
toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
|
|
54054
54249
|
}, 400);
|
|
54055
|
-
this.provider.executeCommand(editor, block, editor.selection.range, item, { child });
|
|
54056
54250
|
const { start, end } = getChildOffset(block, child);
|
|
54251
|
+
this.provider.executeCommand(editor, block, editor.selection.range, item, { child });
|
|
54057
54252
|
const range = createBlockSimpleRange(editor, block, start, end);
|
|
54058
54253
|
this.clipboardProvider.executeRangeCommand(editor, range, item);
|
|
54059
54254
|
});
|
|
@@ -54590,6 +54785,7 @@ ${codeText}
|
|
|
54590
54785
|
}, 50));
|
|
54591
54786
|
this.editor = editor;
|
|
54592
54787
|
const popover = editor.options.componentsOptions.popover;
|
|
54788
|
+
const objectToolbar = editor.options.componentsOptions.objectToolbar;
|
|
54593
54789
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
54594
54790
|
tooltipId: editor.clientId,
|
|
54595
54791
|
id: "editor-toolbar",
|
|
@@ -54597,7 +54793,8 @@ ${codeText}
|
|
|
54597
54793
|
refuseOverflow: true,
|
|
54598
54794
|
padding: 20,
|
|
54599
54795
|
showName: clientType.isMobile,
|
|
54600
|
-
autoClose: clientType.isMobile ? true : void 0
|
|
54796
|
+
autoClose: clientType.isMobile ? true : void 0,
|
|
54797
|
+
appendTo: (objectToolbar == null ? void 0 : objectToolbar.appendTo) || (popover == null ? void 0 : popover.appendTo)
|
|
54601
54798
|
});
|
|
54602
54799
|
this.toolbar.on("click", this.handleButtonClick);
|
|
54603
54800
|
this.toolbar.on("close", this.handleClose);
|
|
@@ -54774,14 +54971,14 @@ ${codeText}
|
|
|
54774
54971
|
const child = this.hoveringTextChild;
|
|
54775
54972
|
const { commands, element } = getObjectCommands(this.editor, block, child);
|
|
54776
54973
|
if (!commands.length || !element) {
|
|
54777
|
-
this.toolbar.close("fromHover");
|
|
54974
|
+
this.toolbar.close("fromHover", event);
|
|
54778
54975
|
return;
|
|
54779
54976
|
}
|
|
54780
54977
|
this.toolbarType = "object";
|
|
54781
54978
|
if (this.toolbar.isVisible) {
|
|
54782
54979
|
const currentElement = (_b = (_a = this.toolbar) == null ? void 0 : _a.tippyInstance) == null ? void 0 : _b.reference;
|
|
54783
54980
|
if (currentElement !== element) {
|
|
54784
|
-
this.toolbar.close("fromHover");
|
|
54981
|
+
this.toolbar.close("fromHover", event);
|
|
54785
54982
|
}
|
|
54786
54983
|
}
|
|
54787
54984
|
const getReferenceClientRectByCaret = () => {
|
|
@@ -64204,7 +64401,7 @@ $$${mathData.mathjaxText}$$
|
|
|
64204
64401
|
const failedLoad = !!block.querySelector(".images > .image-container.error, .images > .image-container.empty ");
|
|
64205
64402
|
const width = calImageBlockStyleWidth(editor, blockData, parentContainer, failedLoad);
|
|
64206
64403
|
const height = calBlockHeight(editor, blockData, parentContainer, failedLoad);
|
|
64207
|
-
if (width.startsWith("0")
|
|
64404
|
+
if (width.startsWith("0") || height.startsWith("0")) {
|
|
64208
64405
|
const image = block.querySelector("img");
|
|
64209
64406
|
if (image) {
|
|
64210
64407
|
image.onload = () => {
|
|
@@ -65117,7 +65314,6 @@ $$${mathData.mathjaxText}$$
|
|
|
65117
65314
|
if (insertPos === "before") {
|
|
65118
65315
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
65119
65316
|
if (!beforeBlock) {
|
|
65120
|
-
assert(logger$1z, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
65121
65317
|
const rect = block.getBoundingClientRect();
|
|
65122
65318
|
const viewRect2 = this.getViewRect(block);
|
|
65123
65319
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -67507,6 +67703,7 @@ ${codeText}
|
|
|
67507
67703
|
const buttonElement = createElement("button", ["block-button"], null);
|
|
67508
67704
|
buttonElement.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, i18n$1.t("blockMenu.button.tips"));
|
|
67509
67705
|
buttonElement.innerHTML = DragIcon;
|
|
67706
|
+
buttonElement.type = "button";
|
|
67510
67707
|
return buttonElement;
|
|
67511
67708
|
}
|
|
67512
67709
|
setButtonType(type) {
|
|
@@ -68104,7 +68301,7 @@ ${codeText}
|
|
|
68104
68301
|
return false;
|
|
68105
68302
|
}
|
|
68106
68303
|
if (isRootContainer(getParentContainer(block))) {
|
|
68107
|
-
if (getBlockIndex(block) === 0) {
|
|
68304
|
+
if (getBlockIndex(block) === 0 && isTitleBlock$2(block)) {
|
|
68108
68305
|
return false;
|
|
68109
68306
|
}
|
|
68110
68307
|
}
|
|
@@ -69182,7 +69379,7 @@ ${codeText}
|
|
|
69182
69379
|
const data2 = blockData.embedData;
|
|
69183
69380
|
const images = getImages$1(data2);
|
|
69184
69381
|
if (type === "html") {
|
|
69185
|
-
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${
|
|
69382
|
+
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
|
|
69186
69383
|
}
|
|
69187
69384
|
if (type === "markdown") {
|
|
69188
69385
|
const markdown = images.map((image) => `})`).join("\n");
|
|
@@ -81818,10 +82015,11 @@ ${docStr}
|
|
|
81818
82015
|
assert(logger$B, false, "no local actions for history doc");
|
|
81819
82016
|
}
|
|
81820
82017
|
class HistoryDoc extends EventCallbacks {
|
|
81821
|
-
constructor(server, docObject) {
|
|
82018
|
+
constructor(server, docObject, editorOptions) {
|
|
81822
82019
|
super();
|
|
81823
82020
|
this.server = server;
|
|
81824
82021
|
this.docObject = docObject;
|
|
82022
|
+
this.editorOptions = editorOptions;
|
|
81825
82023
|
}
|
|
81826
82024
|
beginBatchUpdate() {
|
|
81827
82025
|
return 0;
|
|
@@ -81832,6 +82030,9 @@ ${docStr}
|
|
|
81832
82030
|
toJSON() {
|
|
81833
82031
|
return cloneDeep__default.default(this.docObject);
|
|
81834
82032
|
}
|
|
82033
|
+
applyingOps() {
|
|
82034
|
+
return false;
|
|
82035
|
+
}
|
|
81835
82036
|
getContainerBlocks(containerId) {
|
|
81836
82037
|
const blocks = this.docObject.blocks[containerId];
|
|
81837
82038
|
return blocks;
|
|
@@ -81876,6 +82077,10 @@ ${docStr}
|
|
|
81876
82077
|
return (_c = (_b = (_a = this.server).getServerMeta) == null ? void 0 : _b.call(_a)) != null ? _c : {};
|
|
81877
82078
|
}
|
|
81878
82079
|
buildResourceUrl(src) {
|
|
82080
|
+
var _a;
|
|
82081
|
+
if ((_a = this.editorOptions) == null ? void 0 : _a.buildResourceUrl) {
|
|
82082
|
+
return this.editorOptions.buildResourceUrl(this, src);
|
|
82083
|
+
}
|
|
81879
82084
|
return this.server.buildResourceUrl(src);
|
|
81880
82085
|
}
|
|
81881
82086
|
request() {
|
|
@@ -82403,7 +82608,7 @@ ${docStr}
|
|
|
82403
82608
|
if (hasLastVersion) {
|
|
82404
82609
|
const item = {
|
|
82405
82610
|
id: "last-version",
|
|
82406
|
-
name: "
|
|
82611
|
+
name: i18n$1.t("version.lastVersion"),
|
|
82407
82612
|
data: lastVersion,
|
|
82408
82613
|
element: renderItem
|
|
82409
82614
|
};
|
|
@@ -82733,7 +82938,7 @@ ${docStr}
|
|
|
82733
82938
|
}
|
|
82734
82939
|
const logger$x = getLogger("version-dialog");
|
|
82735
82940
|
class OnesEditorVersionsDialog {
|
|
82736
|
-
constructor(server, provider) {
|
|
82941
|
+
constructor(server, provider, editorOptions) {
|
|
82737
82942
|
__publicField(this, "dialog", null);
|
|
82738
82943
|
__publicField(this, "oldViewer", null);
|
|
82739
82944
|
__publicField(this, "versionOptions");
|
|
@@ -82802,7 +83007,7 @@ ${docStr}
|
|
|
82802
83007
|
}
|
|
82803
83008
|
const { editorContainer: editorElement } = this.components;
|
|
82804
83009
|
editorElement.innerHTML = "";
|
|
82805
|
-
const historyDoc = new HistoryDoc(this.server, docObject);
|
|
83010
|
+
const historyDoc = new HistoryDoc(this.server, docObject, this.editorOptions);
|
|
82806
83011
|
const viewer = this.provider.createHistoryEditor(editorElement, historyDoc);
|
|
82807
83012
|
viewer.editorBlockRenders.registerRender(new OnesEditorHistoryRender());
|
|
82808
83013
|
viewer.editorBoxes.registerBoxClass(HistoryDeletedTextBox);
|
|
@@ -82825,6 +83030,7 @@ ${docStr}
|
|
|
82825
83030
|
this.components.infoHeader.dropdown.setVersions(this.versions);
|
|
82826
83031
|
});
|
|
82827
83032
|
this.server = server;
|
|
83033
|
+
this.editorOptions = editorOptions;
|
|
82828
83034
|
this.provider = provider;
|
|
82829
83035
|
const root2 = createElement("div", ["version-dialog"], null);
|
|
82830
83036
|
root2.style.setProperty("--history-mask-identifier", `"${HISTORY_MASK_IDENTIFIER}"`);
|
|
@@ -83067,12 +83273,7 @@ ${docStr}
|
|
|
83067
83273
|
}
|
|
83068
83274
|
}
|
|
83069
83275
|
function isTitleBlock$1(block) {
|
|
83070
|
-
|
|
83071
|
-
if (prevBlock) {
|
|
83072
|
-
return false;
|
|
83073
|
-
}
|
|
83074
|
-
const container = getParentContainer(block);
|
|
83075
|
-
return isRootContainer(container);
|
|
83276
|
+
return block.hasAttribute("data-document-title");
|
|
83076
83277
|
}
|
|
83077
83278
|
function canShowCollapseButtons(editor, hoverBlock) {
|
|
83078
83279
|
var _a, _b;
|
|
@@ -85577,7 +85778,6 @@ ${docStr}
|
|
|
85577
85778
|
});
|
|
85578
85779
|
setTimeout(() => {
|
|
85579
85780
|
textarea2.setSelectionRange(0, 0);
|
|
85580
|
-
textarea2.focus();
|
|
85581
85781
|
textarea2.scrollTop = 0;
|
|
85582
85782
|
textarea2.style.height = `${textarea2.scrollHeight}px`;
|
|
85583
85783
|
}, 20);
|
|
@@ -85588,6 +85788,9 @@ ${docStr}
|
|
|
85588
85788
|
assert(logger$n, textarea2 instanceof HTMLTextAreaElement, "Textarea is not HTMLTextAreaElement");
|
|
85589
85789
|
return textarea2;
|
|
85590
85790
|
};
|
|
85791
|
+
function focusToCodeEditor(block) {
|
|
85792
|
+
getCodeEditor(block).focus();
|
|
85793
|
+
}
|
|
85591
85794
|
const logger$m = getLogger("graph-dom/view-select");
|
|
85592
85795
|
var ViewId = /* @__PURE__ */ ((ViewId2) => {
|
|
85593
85796
|
ViewId2["Both"] = "both";
|
|
@@ -87469,6 +87672,9 @@ ${data2.flowchartText}
|
|
|
87469
87672
|
if (!plantumlImgFile) {
|
|
87470
87673
|
return await Promise.resolve(url);
|
|
87471
87674
|
}
|
|
87675
|
+
if (plantumlImgFile.type === "text/html") {
|
|
87676
|
+
return await Promise.resolve(url);
|
|
87677
|
+
}
|
|
87472
87678
|
const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile, { resourceType: "graph" });
|
|
87473
87679
|
return uploadResourceResult.resourceId;
|
|
87474
87680
|
} catch (error2) {
|
|
@@ -87613,7 +87819,10 @@ ${data2.plantumlText}
|
|
|
87613
87819
|
subText: `/${base.graphType}`,
|
|
87614
87820
|
name: i18n$1.t(`graph.${base.graphType}`),
|
|
87615
87821
|
execute: (editor, containerId, blockIndex) => {
|
|
87616
|
-
editor.insertEmbed(containerId, blockIndex, base.graphType, base.createEmptyEmbedData());
|
|
87822
|
+
const block = editor.insertEmbed(containerId, blockIndex, base.graphType, base.createEmptyEmbedData());
|
|
87823
|
+
setTimeout(() => {
|
|
87824
|
+
focusToCodeEditor(block);
|
|
87825
|
+
});
|
|
87617
87826
|
}
|
|
87618
87827
|
}];
|
|
87619
87828
|
};
|
|
@@ -90173,9 +90382,6 @@ ${data2.plantumlText}
|
|
|
90173
90382
|
super.destroy();
|
|
90174
90383
|
}
|
|
90175
90384
|
}
|
|
90176
|
-
const ErrCode = {
|
|
90177
|
-
ANALYZER_UNKNOWN_URL: "analyzer cannot recognize this url"
|
|
90178
|
-
};
|
|
90179
90385
|
class FigmaAnalyzer {
|
|
90180
90386
|
constructor() {
|
|
90181
90387
|
__publicField(this, "regex", /https:\/\/([\w.-]+\.)?figma.com\/.*$/i);
|
|
@@ -90341,10 +90547,17 @@ ${data2.plantumlText}
|
|
|
90341
90547
|
return ret;
|
|
90342
90548
|
}
|
|
90343
90549
|
}
|
|
90344
|
-
|
|
90550
|
+
return {
|
|
90551
|
+
providerName: "unknown",
|
|
90552
|
+
type: "iframe",
|
|
90553
|
+
url
|
|
90554
|
+
};
|
|
90345
90555
|
}
|
|
90346
90556
|
}
|
|
90347
90557
|
const urlAnalyzer = new URLAnalyzer();
|
|
90558
|
+
const ErrCode = {
|
|
90559
|
+
ANALYZER_UNKNOWN_URL: "analyzer cannot recognize this url"
|
|
90560
|
+
};
|
|
90348
90561
|
const getCommandItems = () => [
|
|
90349
90562
|
{
|
|
90350
90563
|
name: i18n$1.t("webpage.bilibili"),
|
|
@@ -91758,9 +91971,9 @@ ${data2.plantumlText}
|
|
|
91758
91971
|
options.events.onClickLink(editor2, event, link2);
|
|
91759
91972
|
return;
|
|
91760
91973
|
}
|
|
91761
|
-
const href = link2.getAttribute("link");
|
|
91974
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
91762
91975
|
if (href) {
|
|
91763
|
-
if (editor2.readonly || event.ctrlKey || event.metaKey) {
|
|
91976
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
91764
91977
|
window.open(href, "_blank");
|
|
91765
91978
|
}
|
|
91766
91979
|
}
|
|
@@ -93842,8 +94055,23 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93842
94055
|
this.id = id;
|
|
93843
94056
|
}
|
|
93844
94057
|
getCommand(editor) {
|
|
94058
|
+
var _a;
|
|
93845
94059
|
const commands = editor.editorCommandProviders.getCommands(editor.selection.range);
|
|
93846
|
-
|
|
94060
|
+
const command = commands.find((c) => c.id === this.id);
|
|
94061
|
+
if (command) {
|
|
94062
|
+
return command;
|
|
94063
|
+
}
|
|
94064
|
+
const moreCommand = commands.find((c) => c.id === "text/more");
|
|
94065
|
+
if (moreCommand) {
|
|
94066
|
+
const ret = (_a = moreCommand.children) == null ? void 0 : _a.find((c) => c.id === this.id);
|
|
94067
|
+
if (ret) {
|
|
94068
|
+
return {
|
|
94069
|
+
...moreCommand,
|
|
94070
|
+
...ret
|
|
94071
|
+
};
|
|
94072
|
+
}
|
|
94073
|
+
}
|
|
94074
|
+
return void 0;
|
|
93847
94075
|
}
|
|
93848
94076
|
onClick(editor) {
|
|
93849
94077
|
const command = this.getCommand(editor);
|
|
@@ -93892,13 +94120,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93892
94120
|
}
|
|
93893
94121
|
class SuperscriptItem extends FontStyleBaseItem {
|
|
93894
94122
|
constructor() {
|
|
93895
|
-
super(i18n$1.t("commands.superscript"), "text/style-
|
|
94123
|
+
super(i18n$1.t("commands.superscript"), "text/style-super");
|
|
93896
94124
|
__publicField(this, "icon", SuperscriptIcon);
|
|
93897
94125
|
}
|
|
93898
94126
|
}
|
|
93899
94127
|
class SubscriptItem extends FontStyleBaseItem {
|
|
93900
94128
|
constructor() {
|
|
93901
|
-
super(i18n$1.t("commands.subscript"), "text/style-
|
|
94129
|
+
super(i18n$1.t("commands.subscript"), "text/style-sub");
|
|
93902
94130
|
__publicField(this, "icon", SubscriptIcon);
|
|
93903
94131
|
}
|
|
93904
94132
|
}
|
|
@@ -94056,9 +94284,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94056
94284
|
Heading3Icon,
|
|
94057
94285
|
Heading4Icon,
|
|
94058
94286
|
Heading5Icon,
|
|
94059
|
-
Heading6Icon
|
|
94287
|
+
Heading6Icon,
|
|
94288
|
+
Heading7Icon,
|
|
94289
|
+
Heading8Icon
|
|
94060
94290
|
];
|
|
94061
|
-
for (let i = 1; i <=
|
|
94291
|
+
for (let i = 1; i <= 8; i++) {
|
|
94062
94292
|
this.children.push({
|
|
94063
94293
|
name: i18n$1.t("commands.heading", { name: `${i}` }),
|
|
94064
94294
|
id: `heading-${i}`,
|
|
@@ -94230,6 +94460,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94230
94460
|
__publicField(this, "manualShowChildren", true);
|
|
94231
94461
|
__publicField(this, "childrenPlacement", "bottom-start");
|
|
94232
94462
|
__publicField(this, "children", []);
|
|
94463
|
+
__publicField(this, "allChildren", []);
|
|
94464
|
+
this.editor = editor;
|
|
94233
94465
|
const provider = new InsertMenuProvider(editor);
|
|
94234
94466
|
const startBlock = editor.getBlockById(editor.selection.range.start.blockId);
|
|
94235
94467
|
const container = getParentContainer(startBlock);
|
|
@@ -94239,6 +94471,34 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94239
94471
|
commands = commands.slice(index2);
|
|
94240
94472
|
}
|
|
94241
94473
|
this.children = commands;
|
|
94474
|
+
this.allChildren = commands;
|
|
94475
|
+
}
|
|
94476
|
+
beforePopup(subBar) {
|
|
94477
|
+
const focusBlock = this.editor.selection.focusedBlock;
|
|
94478
|
+
if (focusBlock.closest('[data-block-type="callout"]')) {
|
|
94479
|
+
const textOnlyCommands = /* @__PURE__ */ new Set([
|
|
94480
|
+
"section-1",
|
|
94481
|
+
"section-2",
|
|
94482
|
+
"insert-emoji",
|
|
94483
|
+
"insert-link",
|
|
94484
|
+
"DateBoxCommandProvider",
|
|
94485
|
+
"insert-status",
|
|
94486
|
+
"insert-math",
|
|
94487
|
+
"insert-known-link",
|
|
94488
|
+
"insert-task-link"
|
|
94489
|
+
]);
|
|
94490
|
+
const children = this.allChildren.filter((c) => {
|
|
94491
|
+
if (textOnlyCommands.has(c.id)) {
|
|
94492
|
+
return true;
|
|
94493
|
+
}
|
|
94494
|
+
return false;
|
|
94495
|
+
});
|
|
94496
|
+
this.children = children;
|
|
94497
|
+
subBar.updateItems(this.children);
|
|
94498
|
+
} else {
|
|
94499
|
+
this.children = this.allChildren;
|
|
94500
|
+
subBar.updateItems(this.children);
|
|
94501
|
+
}
|
|
94242
94502
|
}
|
|
94243
94503
|
onClick(editor, item, commandBar2) {
|
|
94244
94504
|
const provider = new InsertMenuProvider(editor);
|
|
@@ -94293,6 +94553,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94293
94553
|
event.stopPropagation();
|
|
94294
94554
|
});
|
|
94295
94555
|
this.provider = new ColorStyleProvider(editor);
|
|
94556
|
+
this.latestColors = this.getColorsFromLocalStorage();
|
|
94557
|
+
this.setCurrentButtonColor(this.latestColors);
|
|
94296
94558
|
this.addListener("onClick", this.handleChangeColor);
|
|
94297
94559
|
this.element.addEventListener("mousedown", this.handleMousedown);
|
|
94298
94560
|
}
|
|
@@ -94460,7 +94722,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94460
94722
|
async onClick(editor, item) {
|
|
94461
94723
|
const block = editor.getBlockById(editor.selection.range.start.blockId);
|
|
94462
94724
|
const container = editor.getParentContainer(block);
|
|
94463
|
-
|
|
94725
|
+
let index2 = editor.getBlockIndex(block);
|
|
94464
94726
|
const file2 = await selectFile("*");
|
|
94465
94727
|
if (!file2) {
|
|
94466
94728
|
return;
|
|
@@ -94478,7 +94740,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94478
94740
|
creator: editor.doc.getUser().displayName,
|
|
94479
94741
|
previewType: FilePreviewType.Card
|
|
94480
94742
|
};
|
|
94481
|
-
|
|
94743
|
+
if (!isEmptyTextBlock(editor, block)) {
|
|
94744
|
+
index2 += 1;
|
|
94745
|
+
}
|
|
94746
|
+
const embedBlock = editor.insertEmbed(getContainerId(container), index2, "office", data2);
|
|
94747
|
+
const nextBlock = getNextBlock(embedBlock);
|
|
94748
|
+
if (nextBlock && isTextKindBlock(editor, nextBlock)) {
|
|
94749
|
+
editor.selection.selectBlock(nextBlock, 0);
|
|
94750
|
+
}
|
|
94482
94751
|
}
|
|
94483
94752
|
}
|
|
94484
94753
|
class InsertMentionItem {
|
|
@@ -94641,6 +94910,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94641
94910
|
}
|
|
94642
94911
|
const parent = findParent(child, id);
|
|
94643
94912
|
if (parent) {
|
|
94913
|
+
if (!parent.onClick) {
|
|
94914
|
+
return item2;
|
|
94915
|
+
}
|
|
94644
94916
|
return parent;
|
|
94645
94917
|
}
|
|
94646
94918
|
}
|
|
@@ -94672,6 +94944,12 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94672
94944
|
tooltipId: editor.clientId,
|
|
94673
94945
|
id: "main-toolbar"
|
|
94674
94946
|
});
|
|
94947
|
+
this.toolbar.addListener("closing", () => {
|
|
94948
|
+
setTimeout(() => {
|
|
94949
|
+
editor.focus();
|
|
94950
|
+
}, 100);
|
|
94951
|
+
return true;
|
|
94952
|
+
});
|
|
94675
94953
|
this.toolbar.addListener("click", this.handleClick);
|
|
94676
94954
|
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
94677
94955
|
this.updateState();
|
|
@@ -94750,6 +95028,294 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94750
95028
|
}
|
|
94751
95029
|
});
|
|
94752
95030
|
}
|
|
95031
|
+
const CkeImageConverter = {
|
|
95032
|
+
filter: (node) => {
|
|
95033
|
+
if (node.nodeName !== "IMG") {
|
|
95034
|
+
return false;
|
|
95035
|
+
}
|
|
95036
|
+
const elem = node;
|
|
95037
|
+
const refId = elem.getAttribute("data-ref-id");
|
|
95038
|
+
const refType = elem.getAttribute("data-ref-type");
|
|
95039
|
+
const uuid = elem.getAttribute("data-uuid");
|
|
95040
|
+
return Boolean(refType === "task" && refId && uuid);
|
|
95041
|
+
},
|
|
95042
|
+
replacement: (content, node) => {
|
|
95043
|
+
const refType = node.getAttribute("data-ref-type");
|
|
95044
|
+
const refId = node.getAttribute("data-ref-id");
|
|
95045
|
+
const uuid = node.getAttribute("data-uuid");
|
|
95046
|
+
const src = `ones-file:${refType}/${refId}/${uuid}`;
|
|
95047
|
+
return ``;
|
|
95048
|
+
}
|
|
95049
|
+
};
|
|
95050
|
+
const ckeHtmlConverters = /* @__PURE__ */ new Map();
|
|
95051
|
+
function registerCKEHtmlConvert(name, converter) {
|
|
95052
|
+
if (ckeHtmlConverters.has(name)) {
|
|
95053
|
+
return;
|
|
95054
|
+
}
|
|
95055
|
+
ckeHtmlConverters.set(name, converter);
|
|
95056
|
+
turndownService.use((ts) => {
|
|
95057
|
+
ts.addRule(name, converter);
|
|
95058
|
+
});
|
|
95059
|
+
}
|
|
95060
|
+
function getTurndownRootElement(node) {
|
|
95061
|
+
let parent = node;
|
|
95062
|
+
while (parent) {
|
|
95063
|
+
if (parent instanceof HTMLElement && parent.tagName === "BODY") {
|
|
95064
|
+
return parent;
|
|
95065
|
+
}
|
|
95066
|
+
if (!parent.parentNode) {
|
|
95067
|
+
return parent;
|
|
95068
|
+
}
|
|
95069
|
+
parent = parent.parentNode;
|
|
95070
|
+
}
|
|
95071
|
+
return node;
|
|
95072
|
+
}
|
|
95073
|
+
function patchForEmptyBlock(key, node, className) {
|
|
95074
|
+
const root2 = getTurndownRootElement(node);
|
|
95075
|
+
if (root2 && root2 instanceof HTMLElement) {
|
|
95076
|
+
const attributeKey = `data-${key}-processed`;
|
|
95077
|
+
if (!root2.getAttribute(attributeKey)) {
|
|
95078
|
+
root2.setAttribute(attributeKey, "true");
|
|
95079
|
+
const elements = root2.querySelectorAll(className);
|
|
95080
|
+
elements.forEach((elem) => {
|
|
95081
|
+
var _a;
|
|
95082
|
+
const text2 = (_a = elem.textContent) == null ? void 0 : _a.trim();
|
|
95083
|
+
if (!text2) {
|
|
95084
|
+
elem.innerText = "--temp-data--";
|
|
95085
|
+
}
|
|
95086
|
+
});
|
|
95087
|
+
}
|
|
95088
|
+
}
|
|
95089
|
+
}
|
|
95090
|
+
const CkeCommentConverter = {
|
|
95091
|
+
filter: (node) => {
|
|
95092
|
+
if (node.nodeName === "SPAN") {
|
|
95093
|
+
const span = node;
|
|
95094
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
95095
|
+
return Boolean(ref);
|
|
95096
|
+
}
|
|
95097
|
+
return false;
|
|
95098
|
+
},
|
|
95099
|
+
replacement: (content, node) => {
|
|
95100
|
+
var _a;
|
|
95101
|
+
const span = node;
|
|
95102
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
95103
|
+
const text2 = (_a = span.textContent) != null ? _a : "";
|
|
95104
|
+
return `[${text2}](comment://${ref})`;
|
|
95105
|
+
}
|
|
95106
|
+
};
|
|
95107
|
+
function processCkeCommentsLink(doc2) {
|
|
95108
|
+
const containers = doc2.blocks;
|
|
95109
|
+
Object.values(containers).forEach((blocks) => {
|
|
95110
|
+
blocks.forEach((block) => {
|
|
95111
|
+
const text2 = block.text;
|
|
95112
|
+
if (text2) {
|
|
95113
|
+
text2.forEach((op) => {
|
|
95114
|
+
if (op.attributes) {
|
|
95115
|
+
const attributes = op.attributes;
|
|
95116
|
+
const link2 = attributes.link;
|
|
95117
|
+
if (link2 == null ? void 0 : link2.startsWith("comment://")) {
|
|
95118
|
+
delete attributes.link;
|
|
95119
|
+
const commentId = link2.replace("comment://", "");
|
|
95120
|
+
const key = `comment-${commentId.toLocaleLowerCase()}`;
|
|
95121
|
+
attributes[key] = commentId;
|
|
95122
|
+
}
|
|
95123
|
+
}
|
|
95124
|
+
});
|
|
95125
|
+
}
|
|
95126
|
+
});
|
|
95127
|
+
});
|
|
95128
|
+
}
|
|
95129
|
+
const CkeMentionConverter = {
|
|
95130
|
+
filter: (node) => {
|
|
95131
|
+
patchForEmptyBlock("mention", node, ".ones-at-user-block");
|
|
95132
|
+
if (node.nodeName === "SPAN") {
|
|
95133
|
+
const span = node;
|
|
95134
|
+
if (hasClass(span, "ones-at-user-block")) {
|
|
95135
|
+
const name = span.getAttribute("data-default-name");
|
|
95136
|
+
const refId = span.getAttribute("data-ref-id");
|
|
95137
|
+
return Boolean(name) && Boolean(refId);
|
|
95138
|
+
}
|
|
95139
|
+
}
|
|
95140
|
+
return false;
|
|
95141
|
+
},
|
|
95142
|
+
replacement: (content, node) => {
|
|
95143
|
+
const span = node;
|
|
95144
|
+
const name = span.getAttribute("data-default-name") || "";
|
|
95145
|
+
const refId = span.getAttribute("data-ref-id") || "";
|
|
95146
|
+
if (name && refId) {
|
|
95147
|
+
const box = {
|
|
95148
|
+
id: genId(),
|
|
95149
|
+
type: "mention",
|
|
95150
|
+
box: true,
|
|
95151
|
+
created: Date.now(),
|
|
95152
|
+
iconUrl: "",
|
|
95153
|
+
text: name,
|
|
95154
|
+
mentionId: refId
|
|
95155
|
+
};
|
|
95156
|
+
const text2 = [
|
|
95157
|
+
{
|
|
95158
|
+
insert: " ",
|
|
95159
|
+
attributes: box
|
|
95160
|
+
}
|
|
95161
|
+
];
|
|
95162
|
+
const obj = {
|
|
95163
|
+
text: text2
|
|
95164
|
+
};
|
|
95165
|
+
const base64 = toBase64URL(JSON.stringify(obj));
|
|
95166
|
+
return `[[${base64}]]`;
|
|
95167
|
+
}
|
|
95168
|
+
return name;
|
|
95169
|
+
}
|
|
95170
|
+
};
|
|
95171
|
+
function convertMentionToCkeMention(editor, boxData, doc2, type) {
|
|
95172
|
+
const data2 = boxData;
|
|
95173
|
+
if (type === "html") {
|
|
95174
|
+
return `<ones-at-user data-ref-name="${data2.text}" data-ref-id="${data2.mentionId}" data-default-name="${data2.text}" class="ones-at-user-block" data-viewer="1"><span>@${data2.text}</span></ones-at-user>`;
|
|
95175
|
+
}
|
|
95176
|
+
return `@${data2.text}`;
|
|
95177
|
+
}
|
|
95178
|
+
function patchMentionConverter(editor) {
|
|
95179
|
+
const mentionBox = editor.editorBoxes.getBoxClass("mention");
|
|
95180
|
+
if (mentionBox) {
|
|
95181
|
+
const oldConvertTo = mentionBox.convertTo;
|
|
95182
|
+
if (oldConvertTo !== convertMentionToCkeMention) {
|
|
95183
|
+
mentionBox.convertTo = convertMentionToCkeMention;
|
|
95184
|
+
}
|
|
95185
|
+
}
|
|
95186
|
+
}
|
|
95187
|
+
function processLinks(doc2) {
|
|
95188
|
+
const containers = doc2.blocks;
|
|
95189
|
+
Object.values(containers).forEach((blocks) => {
|
|
95190
|
+
blocks.forEach((block) => {
|
|
95191
|
+
if (block.text) {
|
|
95192
|
+
const text2 = block.text;
|
|
95193
|
+
text2.forEach((op) => {
|
|
95194
|
+
const attributes = op.attributes;
|
|
95195
|
+
if (attributes) {
|
|
95196
|
+
attributes.link;
|
|
95197
|
+
}
|
|
95198
|
+
});
|
|
95199
|
+
}
|
|
95200
|
+
});
|
|
95201
|
+
});
|
|
95202
|
+
}
|
|
95203
|
+
const CkeMarkdownConverter = {
|
|
95204
|
+
filter: (node) => {
|
|
95205
|
+
if (node.nodeName !== "DIV") {
|
|
95206
|
+
return false;
|
|
95207
|
+
}
|
|
95208
|
+
const div = node;
|
|
95209
|
+
return hasClass(div, "ones-marked-card");
|
|
95210
|
+
},
|
|
95211
|
+
replacement: (content, node) => {
|
|
95212
|
+
const textToCodeBlock2 = (text2, language) => {
|
|
95213
|
+
const codeBlocks = text2.split("\n").map((line) => {
|
|
95214
|
+
const block = {
|
|
95215
|
+
type: "text",
|
|
95216
|
+
id: genId(),
|
|
95217
|
+
text: createRichText(line)
|
|
95218
|
+
};
|
|
95219
|
+
return block;
|
|
95220
|
+
});
|
|
95221
|
+
const containerId = genId();
|
|
95222
|
+
const doc22 = {
|
|
95223
|
+
blocks: {
|
|
95224
|
+
root: [
|
|
95225
|
+
{
|
|
95226
|
+
id: genId(),
|
|
95227
|
+
type: "code",
|
|
95228
|
+
language,
|
|
95229
|
+
children: [containerId]
|
|
95230
|
+
}
|
|
95231
|
+
],
|
|
95232
|
+
[containerId]: codeBlocks
|
|
95233
|
+
},
|
|
95234
|
+
meta: {},
|
|
95235
|
+
comments: {}
|
|
95236
|
+
};
|
|
95237
|
+
return toBase64URL(JSON.stringify(doc22));
|
|
95238
|
+
};
|
|
95239
|
+
const nodeToCodeBlock2 = (node2, lang) => {
|
|
95240
|
+
const text2 = node2.textContent || "";
|
|
95241
|
+
return textToCodeBlock2(text2, lang);
|
|
95242
|
+
};
|
|
95243
|
+
const doc2 = nodeToCodeBlock2(node, "markdown");
|
|
95244
|
+
const fence = "```";
|
|
95245
|
+
return "\n\n" + fence + "\n" + doc2 + "\n" + fence + "\n\n";
|
|
95246
|
+
}
|
|
95247
|
+
};
|
|
95248
|
+
registerCKEHtmlConvert("image", CkeImageConverter);
|
|
95249
|
+
registerCKEHtmlConvert("comment", CkeCommentConverter);
|
|
95250
|
+
registerCKEHtmlConvert("mention", CkeMentionConverter);
|
|
95251
|
+
registerCKEHtmlConvert("markdown", CkeMarkdownConverter);
|
|
95252
|
+
function ckeHtml2Doc(html) {
|
|
95253
|
+
const doc2 = htmlToDoc(html) || createEmptyDoc$1();
|
|
95254
|
+
processCkeCommentsLink(doc2);
|
|
95255
|
+
processLinks(doc2);
|
|
95256
|
+
return doc2;
|
|
95257
|
+
}
|
|
95258
|
+
function injectDocToCkeHtmlFragment(htmlFragment, doc2, text2) {
|
|
95259
|
+
const meta = `<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${toBase64URL(
|
|
95260
|
+
JSON.stringify(doc2)
|
|
95261
|
+
)}::ones-editor-doc" />`;
|
|
95262
|
+
let textMeta = "";
|
|
95263
|
+
if (text2) {
|
|
95264
|
+
textMeta = `<meta name="ones-editor-text" content="${toBase64URL(text2)}" />`;
|
|
95265
|
+
}
|
|
95266
|
+
const html = `<!doctype html><html><head>${meta}${textMeta}</head><body>${htmlFragment}</body></html>`;
|
|
95267
|
+
return html;
|
|
95268
|
+
}
|
|
95269
|
+
function editorToCKEHtml(editor) {
|
|
95270
|
+
patchMentionConverter(editor);
|
|
95271
|
+
const docObject = editor.doc.toJSON();
|
|
95272
|
+
if (isEmptyDoc(docObject)) {
|
|
95273
|
+
return "";
|
|
95274
|
+
}
|
|
95275
|
+
let html = docToHtmlFragment(editor, docObject);
|
|
95276
|
+
const text2 = docToText(editor, docObject);
|
|
95277
|
+
html = injectDocToCkeHtmlFragment(html, docObject, text2);
|
|
95278
|
+
return html;
|
|
95279
|
+
}
|
|
95280
|
+
function combineDoc(doc1, doc2) {
|
|
95281
|
+
if (isEmptyDoc(doc1)) {
|
|
95282
|
+
return doc2;
|
|
95283
|
+
}
|
|
95284
|
+
if (isEmptyDoc(doc2)) {
|
|
95285
|
+
return doc1;
|
|
95286
|
+
}
|
|
95287
|
+
const splitterDoc = createEmptyDoc$1("", {
|
|
95288
|
+
firstLineAsTitle: false
|
|
95289
|
+
});
|
|
95290
|
+
return mergeDocs([doc1, splitterDoc, doc2]);
|
|
95291
|
+
}
|
|
95292
|
+
function mergeHTMLBodiesOnly(htmlA, htmlB) {
|
|
95293
|
+
const parser = new DOMParser();
|
|
95294
|
+
const docA = parser.parseFromString(htmlA, "text/html");
|
|
95295
|
+
const docB = parser.parseFromString(htmlB, "text/html");
|
|
95296
|
+
const mergedDoc = document.implementation.createHTMLDocument("Merged");
|
|
95297
|
+
const bodyA = docA.body;
|
|
95298
|
+
const bodyB = docB.body;
|
|
95299
|
+
const mergedBody = mergedDoc.body;
|
|
95300
|
+
Array.from(bodyA.childNodes).forEach((node) => {
|
|
95301
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95302
|
+
});
|
|
95303
|
+
Array.from(bodyB.childNodes).forEach((node) => {
|
|
95304
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95305
|
+
});
|
|
95306
|
+
return mergedBody.innerHTML;
|
|
95307
|
+
}
|
|
95308
|
+
function combineCkeHtml(html1, html2) {
|
|
95309
|
+
const doc1 = ckeHtml2Doc(html1);
|
|
95310
|
+
const doc2 = ckeHtml2Doc(html2);
|
|
95311
|
+
const newDoc = combineDoc(doc1, doc2);
|
|
95312
|
+
const newHtml = mergeHTMLBodiesOnly(html1, html2);
|
|
95313
|
+
const ret = injectDocToCkeHtmlFragment(newHtml, newDoc);
|
|
95314
|
+
return ret;
|
|
95315
|
+
}
|
|
95316
|
+
function combineRichTextValue(value1, value2) {
|
|
95317
|
+
return combineCkeHtml(value1, value2);
|
|
95318
|
+
}
|
|
94753
95319
|
const logger = getLogger("create-editor");
|
|
94754
95320
|
function getHooks(options, local) {
|
|
94755
95321
|
var _a;
|
|
@@ -94975,9 +95541,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94975
95541
|
options.events.onClickLink(editor2, event, link2);
|
|
94976
95542
|
return;
|
|
94977
95543
|
}
|
|
94978
|
-
const href = link2.getAttribute("link");
|
|
95544
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
94979
95545
|
if (href) {
|
|
94980
|
-
if (editor2.readonly || event.ctrlKey || event.metaKey) {
|
|
95546
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
94981
95547
|
window.open(href, "_blank");
|
|
94982
95548
|
}
|
|
94983
95549
|
}
|
|
@@ -95008,7 +95574,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95008
95574
|
}
|
|
95009
95575
|
}
|
|
95010
95576
|
});
|
|
95011
|
-
editor.version = "2.9.8-beta.
|
|
95577
|
+
editor.version = "2.9.8-beta.41";
|
|
95012
95578
|
return editor;
|
|
95013
95579
|
}
|
|
95014
95580
|
function isDoc(doc2) {
|
|
@@ -95129,9 +95695,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95129
95695
|
options.events.onClickLink(editor2, event, link2);
|
|
95130
95696
|
return;
|
|
95131
95697
|
}
|
|
95132
|
-
const href = link2.getAttribute("link");
|
|
95698
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
95133
95699
|
if (href) {
|
|
95134
|
-
if (editor2.readonly || event.ctrlKey || event.metaKey) {
|
|
95700
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
95135
95701
|
window.open(href, "_blank");
|
|
95136
95702
|
}
|
|
95137
95703
|
}
|
|
@@ -95140,7 +95706,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95140
95706
|
OnesEditorDropTarget.register(editor);
|
|
95141
95707
|
OnesEditorTocProvider.register(editor);
|
|
95142
95708
|
OnesEditorExclusiveBlock.register(editor);
|
|
95143
|
-
editor.version = "2.9.8-beta.
|
|
95709
|
+
editor.version = "2.9.8-beta.41";
|
|
95144
95710
|
return editor;
|
|
95145
95711
|
}
|
|
95146
95712
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -95176,8 +95742,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95176
95742
|
displayName,
|
|
95177
95743
|
avatarUrl: ""
|
|
95178
95744
|
};
|
|
95179
|
-
const
|
|
95180
|
-
|
|
95745
|
+
const server = await ShareDBServer.load({
|
|
95746
|
+
auth,
|
|
95747
|
+
serverUrl: options.serverUrl
|
|
95748
|
+
});
|
|
95749
|
+
const versionHelper = (_a = server.getVersionHelper) == null ? void 0 : _a.call(server);
|
|
95181
95750
|
if (!versionHelper) {
|
|
95182
95751
|
throw new Error("the editor does not support to show versions");
|
|
95183
95752
|
}
|
|
@@ -95192,10 +95761,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95192
95761
|
userId,
|
|
95193
95762
|
displayName,
|
|
95194
95763
|
avatarUrl: ""
|
|
95195
|
-
}
|
|
95764
|
+
},
|
|
95765
|
+
...options == null ? void 0 : options.editorOptions
|
|
95196
95766
|
};
|
|
95197
95767
|
const versionsProvider = new ShareDBDocVersionsProvider(editorOptions);
|
|
95198
|
-
const dialog = new OnesEditorVersionsDialog(
|
|
95768
|
+
const dialog = new OnesEditorVersionsDialog(server, versionsProvider, editorOptions);
|
|
95199
95769
|
const dialogOptions = options.options || {
|
|
95200
95770
|
container: parent
|
|
95201
95771
|
};
|
|
@@ -141242,12 +141812,15 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141242
141812
|
exports2.blockToText = blockToText;
|
|
141243
141813
|
exports2.blocksToDoc = blocksToDoc;
|
|
141244
141814
|
exports2.changeButtonName = changeButtonName;
|
|
141815
|
+
exports2.ckeHtml2Doc = ckeHtml2Doc;
|
|
141245
141816
|
exports2.clearAllSelection = clearAllSelection;
|
|
141246
141817
|
exports2.clientType = clientType;
|
|
141247
141818
|
exports2.cloneBlock = cloneBlock;
|
|
141248
141819
|
exports2.cloneChildContainer = cloneChildContainer;
|
|
141249
141820
|
exports2.cloneDoc = cloneDoc;
|
|
141250
141821
|
exports2.cloneText = cloneText;
|
|
141822
|
+
exports2.combineCkeHtml = combineCkeHtml;
|
|
141823
|
+
exports2.combineRichTextValue = combineRichTextValue;
|
|
141251
141824
|
exports2.commentToShareDbComment = commentToShareDbComment;
|
|
141252
141825
|
exports2.compareElement = compareElement;
|
|
141253
141826
|
exports2.comparePosition = comparePosition;
|
|
@@ -141387,6 +141960,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141387
141960
|
exports2.editorRunOnce = editorRunOnce;
|
|
141388
141961
|
exports2.editorScrollIntoView = editorScrollIntoView;
|
|
141389
141962
|
exports2.editorSelectAll = editorSelectAll;
|
|
141963
|
+
exports2.editorSelectAllBlocks = editorSelectAllBlocks;
|
|
141390
141964
|
exports2.editorSelectContainer = editorSelectContainer;
|
|
141391
141965
|
exports2.editorSelectDown = editorSelectDown;
|
|
141392
141966
|
exports2.editorSelectEnd = editorSelectEnd;
|
|
@@ -141403,6 +141977,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141403
141977
|
exports2.editorSelectWordLeft = editorSelectWordLeft;
|
|
141404
141978
|
exports2.editorSetTextColor = editorSetTextColor;
|
|
141405
141979
|
exports2.editorShowFindDialog = editorShowFindDialog;
|
|
141980
|
+
exports2.editorToCKEHtml = editorToCKEHtml;
|
|
141406
141981
|
exports2.editorToDocx = editorToDocx;
|
|
141407
141982
|
exports2.editorUpdateBlockData = editorUpdateBlockData;
|
|
141408
141983
|
exports2.editorUpdateCompositionText = editorUpdateCompositionText;
|
|
@@ -141569,6 +142144,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141569
142144
|
exports2.i18n = i18n$1;
|
|
141570
142145
|
exports2.includeBigTable = includeBigTable;
|
|
141571
142146
|
exports2.injectBlockOptions = injectBlockOptions;
|
|
142147
|
+
exports2.injectDocToCkeHtmlFragment = injectDocToCkeHtmlFragment;
|
|
141572
142148
|
exports2.injectDocToHtmlFragment = injectDocToHtmlFragment;
|
|
141573
142149
|
exports2.injectSource = injectSource;
|
|
141574
142150
|
exports2.injectStyle = injectStyle;
|