@ones-editor/editor 2.9.8-beta.4 → 2.9.8-beta.40
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 +724 -150
- 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
41444
|
if ((_b = (_a = this.options).beforeClose) == null ? void 0 : _b.call(_a, event)) {
|
|
41371
41445
|
return;
|
|
41372
41446
|
}
|
|
41373
41447
|
if (!this.isInCommandBar(event.target)) {
|
|
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,
|
|
@@ -43825,6 +43951,9 @@ ${codeText}
|
|
|
43825
43951
|
__publicField(this, "handlePaletteClick", (type, value) => {
|
|
43826
43952
|
this.setLatestColors(type, value);
|
|
43827
43953
|
this.emit("onClick", type, value);
|
|
43954
|
+
setTimeout(() => {
|
|
43955
|
+
this.editor.emit("textColorChanged", this.editor, this);
|
|
43956
|
+
}, 100);
|
|
43828
43957
|
});
|
|
43829
43958
|
__publicField(this, "handleButtonClick", () => {
|
|
43830
43959
|
const [color, backgroundColor] = this.latestColors;
|
|
@@ -43850,6 +43979,9 @@ ${codeText}
|
|
|
43850
43979
|
this.emit("onClick", "backgroundColor", backgroundColor);
|
|
43851
43980
|
}
|
|
43852
43981
|
this.currentTextColors = [color, backgroundColor];
|
|
43982
|
+
setTimeout(() => {
|
|
43983
|
+
this.editor.emit("textColorChanged", this.editor, this);
|
|
43984
|
+
}, 100);
|
|
43853
43985
|
});
|
|
43854
43986
|
__publicField(this, "setLatestColors", (type, value) => {
|
|
43855
43987
|
var _a, _b;
|
|
@@ -43887,6 +44019,13 @@ ${codeText}
|
|
|
43887
44019
|
this.element.addEventListener("click", this.handleButtonClick);
|
|
43888
44020
|
this.bindColorButtonEvents();
|
|
43889
44021
|
this.element.setAttribute(`data-editor-tooltip-${editor.clientId}`, this.name);
|
|
44022
|
+
this.editor.addListener("textColorChanged", (e2, sender) => {
|
|
44023
|
+
if (sender !== this) {
|
|
44024
|
+
this.latestColors = this.getColorsFromLocalStorage();
|
|
44025
|
+
this.setCurrentButtonColor(this.latestColors);
|
|
44026
|
+
this.updatePaletteColor();
|
|
44027
|
+
}
|
|
44028
|
+
});
|
|
43890
44029
|
}
|
|
43891
44030
|
bindColorButtonEvents() {
|
|
43892
44031
|
if (clientType.isMobile) {
|
|
@@ -51476,23 +51615,28 @@ ${codeText}
|
|
|
51476
51615
|
}
|
|
51477
51616
|
function resetListStart(editor, brothers, start, options) {
|
|
51478
51617
|
var _a;
|
|
51479
|
-
|
|
51480
|
-
|
|
51481
|
-
const
|
|
51482
|
-
|
|
51483
|
-
const
|
|
51484
|
-
|
|
51485
|
-
|
|
51486
|
-
|
|
51487
|
-
|
|
51488
|
-
|
|
51618
|
+
editor.doc.beginBatchUpdate();
|
|
51619
|
+
try {
|
|
51620
|
+
const groupId = (_a = options == null ? void 0 : options.groupId) != null ? _a : genId();
|
|
51621
|
+
brothers.forEach((block) => {
|
|
51622
|
+
const oldData = editor.getBlockData(block);
|
|
51623
|
+
if (oldData.start !== start || (options == null ? void 0 : options.resetGroupId)) {
|
|
51624
|
+
const newData = {
|
|
51625
|
+
...oldData,
|
|
51626
|
+
start
|
|
51627
|
+
};
|
|
51628
|
+
if (options == null ? void 0 : options.resetGroupId) {
|
|
51629
|
+
newData.groupId = groupId;
|
|
51630
|
+
}
|
|
51631
|
+
editor.updateBlockData(block, newData);
|
|
51489
51632
|
}
|
|
51490
|
-
|
|
51491
|
-
|
|
51492
|
-
|
|
51493
|
-
|
|
51494
|
-
|
|
51495
|
-
|
|
51633
|
+
if (!oldData.textOnly) {
|
|
51634
|
+
start += 1;
|
|
51635
|
+
}
|
|
51636
|
+
});
|
|
51637
|
+
} finally {
|
|
51638
|
+
editor.doc.endBatchUpdate();
|
|
51639
|
+
}
|
|
51496
51640
|
}
|
|
51497
51641
|
function resetListStartByBrother(editor, listBrother, start, options) {
|
|
51498
51642
|
const allBrothers = getListAllBrothers(listBrother, { withSelf: true });
|
|
@@ -53111,7 +53255,11 @@ ${codeText}
|
|
|
53111
53255
|
handleDrop: handleListDrop,
|
|
53112
53256
|
notify,
|
|
53113
53257
|
handleDeleteBlock: (editor, block) => {
|
|
53258
|
+
var _a, _b;
|
|
53114
53259
|
if (isListBlock(block)) {
|
|
53260
|
+
if ((_b = (_a = editor.doc).applyingOps) == null ? void 0 : _b.call(_a)) {
|
|
53261
|
+
return;
|
|
53262
|
+
}
|
|
53115
53263
|
const fixStart = new FixStartByWillDeletedList(editor, block);
|
|
53116
53264
|
setTimeout(() => {
|
|
53117
53265
|
fixStart.fix();
|
|
@@ -53142,15 +53290,15 @@ ${codeText}
|
|
|
53142
53290
|
__publicField(this, "id", "ListProvider");
|
|
53143
53291
|
__publicField(this, "executeInsertCommand", (editor, containerId, blockIndex, command) => {
|
|
53144
53292
|
if (command.id === "unordered-list") {
|
|
53145
|
-
this.insertList(editor, containerId, blockIndex, "unordered");
|
|
53293
|
+
this.insertList(editor, containerId, blockIndex, "unordered", command);
|
|
53146
53294
|
return true;
|
|
53147
53295
|
}
|
|
53148
53296
|
if (command.id === "ordered-list") {
|
|
53149
|
-
this.insertList(editor, containerId, blockIndex, "ordered");
|
|
53297
|
+
this.insertList(editor, containerId, blockIndex, "ordered", command);
|
|
53150
53298
|
return true;
|
|
53151
53299
|
}
|
|
53152
53300
|
if (command.id === "check-list") {
|
|
53153
|
-
this.insertList(editor, containerId, blockIndex, "unchecked");
|
|
53301
|
+
this.insertList(editor, containerId, blockIndex, "unchecked", command);
|
|
53154
53302
|
return true;
|
|
53155
53303
|
}
|
|
53156
53304
|
return false;
|
|
@@ -53233,21 +53381,66 @@ ${codeText}
|
|
|
53233
53381
|
});
|
|
53234
53382
|
}
|
|
53235
53383
|
}
|
|
53236
|
-
insertList(editor, containerId, blockIndex, listType) {
|
|
53384
|
+
insertList(editor, containerId, blockIndex, listType, command) {
|
|
53237
53385
|
var _a;
|
|
53238
|
-
|
|
53239
|
-
|
|
53240
|
-
|
|
53386
|
+
editor.getChildContainerData(containerId);
|
|
53387
|
+
let sourceIndex = blockIndex;
|
|
53388
|
+
let insertBefore = true;
|
|
53389
|
+
if (((_a = command.source) == null ? void 0 : _a.indexOf("/insert-block-after")) !== -1) {
|
|
53390
|
+
insertBefore = false;
|
|
53391
|
+
if (blockIndex > 0) {
|
|
53392
|
+
sourceIndex = blockIndex - 1;
|
|
53393
|
+
}
|
|
53394
|
+
}
|
|
53395
|
+
const currentBlock = editor.findBlockByIndex(containerId, sourceIndex);
|
|
53396
|
+
if (!currentBlock) {
|
|
53397
|
+
return;
|
|
53398
|
+
}
|
|
53399
|
+
const convertResult = convertBlockFrom(editor, currentBlock, "list", {
|
|
53241
53400
|
offset: 0,
|
|
53242
53401
|
data: {
|
|
53243
53402
|
listType
|
|
53244
53403
|
}
|
|
53245
53404
|
});
|
|
53246
|
-
|
|
53247
|
-
|
|
53248
|
-
|
|
53249
|
-
|
|
53405
|
+
const newData = convertResult == null ? void 0 : convertResult.blockData;
|
|
53406
|
+
if (!newData) {
|
|
53407
|
+
return;
|
|
53408
|
+
}
|
|
53409
|
+
const oldData = editor.getBlockData(currentBlock);
|
|
53410
|
+
const oldType = getListType(oldData);
|
|
53411
|
+
const newType = getListType(newData);
|
|
53412
|
+
if (oldType === newType) {
|
|
53413
|
+
if (typeof newData.start === "number") {
|
|
53414
|
+
if (typeof oldData.start === "number") {
|
|
53415
|
+
if (insertBefore) {
|
|
53416
|
+
newData.start = oldData.start - 1;
|
|
53417
|
+
} else {
|
|
53418
|
+
newData.start = oldData.start + 1;
|
|
53419
|
+
}
|
|
53420
|
+
} else {
|
|
53421
|
+
if (insertBefore) {
|
|
53422
|
+
newData.start -= 1;
|
|
53423
|
+
} else {
|
|
53424
|
+
newData.start += 1;
|
|
53425
|
+
}
|
|
53426
|
+
}
|
|
53427
|
+
}
|
|
53428
|
+
if (typeof newData.start === "number" && newData.start <= 0) {
|
|
53429
|
+
newData.start = 1;
|
|
53430
|
+
}
|
|
53431
|
+
newData.groupId = oldData.groupId;
|
|
53250
53432
|
}
|
|
53433
|
+
newData.text = [];
|
|
53434
|
+
if (oldType === newType) {
|
|
53435
|
+
newData.heading = oldData.heading;
|
|
53436
|
+
} else {
|
|
53437
|
+
delete newData.heading;
|
|
53438
|
+
}
|
|
53439
|
+
editor.undoManager.runInGroup(() => {
|
|
53440
|
+
const newBlock = editor.insertBlock(containerId, blockIndex, newData);
|
|
53441
|
+
const fix = new FixStartByList(editor, newBlock);
|
|
53442
|
+
fix.fix();
|
|
53443
|
+
});
|
|
53251
53444
|
}
|
|
53252
53445
|
executeCommand(editor, block, range, command) {
|
|
53253
53446
|
if (!isTextKindBlock(editor, block)) {
|
|
@@ -54590,6 +54783,7 @@ ${codeText}
|
|
|
54590
54783
|
}, 50));
|
|
54591
54784
|
this.editor = editor;
|
|
54592
54785
|
const popover = editor.options.componentsOptions.popover;
|
|
54786
|
+
const objectToolbar = editor.options.componentsOptions.objectToolbar;
|
|
54593
54787
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
54594
54788
|
tooltipId: editor.clientId,
|
|
54595
54789
|
id: "editor-toolbar",
|
|
@@ -54597,7 +54791,8 @@ ${codeText}
|
|
|
54597
54791
|
refuseOverflow: true,
|
|
54598
54792
|
padding: 20,
|
|
54599
54793
|
showName: clientType.isMobile,
|
|
54600
|
-
autoClose: clientType.isMobile ? true : void 0
|
|
54794
|
+
autoClose: clientType.isMobile ? true : void 0,
|
|
54795
|
+
appendTo: (objectToolbar == null ? void 0 : objectToolbar.appendTo) || (popover == null ? void 0 : popover.appendTo)
|
|
54601
54796
|
});
|
|
54602
54797
|
this.toolbar.on("click", this.handleButtonClick);
|
|
54603
54798
|
this.toolbar.on("close", this.handleClose);
|
|
@@ -54774,14 +54969,14 @@ ${codeText}
|
|
|
54774
54969
|
const child = this.hoveringTextChild;
|
|
54775
54970
|
const { commands, element } = getObjectCommands(this.editor, block, child);
|
|
54776
54971
|
if (!commands.length || !element) {
|
|
54777
|
-
this.toolbar.close("fromHover");
|
|
54972
|
+
this.toolbar.close("fromHover", event);
|
|
54778
54973
|
return;
|
|
54779
54974
|
}
|
|
54780
54975
|
this.toolbarType = "object";
|
|
54781
54976
|
if (this.toolbar.isVisible) {
|
|
54782
54977
|
const currentElement = (_b = (_a = this.toolbar) == null ? void 0 : _a.tippyInstance) == null ? void 0 : _b.reference;
|
|
54783
54978
|
if (currentElement !== element) {
|
|
54784
|
-
this.toolbar.close("fromHover");
|
|
54979
|
+
this.toolbar.close("fromHover", event);
|
|
54785
54980
|
}
|
|
54786
54981
|
}
|
|
54787
54982
|
const getReferenceClientRectByCaret = () => {
|
|
@@ -64204,7 +64399,7 @@ $$${mathData.mathjaxText}$$
|
|
|
64204
64399
|
const failedLoad = !!block.querySelector(".images > .image-container.error, .images > .image-container.empty ");
|
|
64205
64400
|
const width = calImageBlockStyleWidth(editor, blockData, parentContainer, failedLoad);
|
|
64206
64401
|
const height = calBlockHeight(editor, blockData, parentContainer, failedLoad);
|
|
64207
|
-
if (width.startsWith("0")
|
|
64402
|
+
if (width.startsWith("0") || height.startsWith("0")) {
|
|
64208
64403
|
const image = block.querySelector("img");
|
|
64209
64404
|
if (image) {
|
|
64210
64405
|
image.onload = () => {
|
|
@@ -65117,7 +65312,6 @@ $$${mathData.mathjaxText}$$
|
|
|
65117
65312
|
if (insertPos === "before") {
|
|
65118
65313
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
65119
65314
|
if (!beforeBlock) {
|
|
65120
|
-
assert(logger$1z, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
65121
65315
|
const rect = block.getBoundingClientRect();
|
|
65122
65316
|
const viewRect2 = this.getViewRect(block);
|
|
65123
65317
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -67507,6 +67701,7 @@ ${codeText}
|
|
|
67507
67701
|
const buttonElement = createElement("button", ["block-button"], null);
|
|
67508
67702
|
buttonElement.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, i18n$1.t("blockMenu.button.tips"));
|
|
67509
67703
|
buttonElement.innerHTML = DragIcon;
|
|
67704
|
+
buttonElement.type = "button";
|
|
67510
67705
|
return buttonElement;
|
|
67511
67706
|
}
|
|
67512
67707
|
setButtonType(type) {
|
|
@@ -68104,7 +68299,7 @@ ${codeText}
|
|
|
68104
68299
|
return false;
|
|
68105
68300
|
}
|
|
68106
68301
|
if (isRootContainer(getParentContainer(block))) {
|
|
68107
|
-
if (getBlockIndex(block) === 0) {
|
|
68302
|
+
if (getBlockIndex(block) === 0 && isTitleBlock$2(block)) {
|
|
68108
68303
|
return false;
|
|
68109
68304
|
}
|
|
68110
68305
|
}
|
|
@@ -69182,7 +69377,7 @@ ${codeText}
|
|
|
69182
69377
|
const data2 = blockData.embedData;
|
|
69183
69378
|
const images = getImages$1(data2);
|
|
69184
69379
|
if (type === "html") {
|
|
69185
|
-
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${
|
|
69380
|
+
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
|
|
69186
69381
|
}
|
|
69187
69382
|
if (type === "markdown") {
|
|
69188
69383
|
const markdown = images.map((image) => `})`).join("\n");
|
|
@@ -81818,10 +82013,11 @@ ${docStr}
|
|
|
81818
82013
|
assert(logger$B, false, "no local actions for history doc");
|
|
81819
82014
|
}
|
|
81820
82015
|
class HistoryDoc extends EventCallbacks {
|
|
81821
|
-
constructor(server, docObject) {
|
|
82016
|
+
constructor(server, docObject, editorOptions) {
|
|
81822
82017
|
super();
|
|
81823
82018
|
this.server = server;
|
|
81824
82019
|
this.docObject = docObject;
|
|
82020
|
+
this.editorOptions = editorOptions;
|
|
81825
82021
|
}
|
|
81826
82022
|
beginBatchUpdate() {
|
|
81827
82023
|
return 0;
|
|
@@ -81832,6 +82028,9 @@ ${docStr}
|
|
|
81832
82028
|
toJSON() {
|
|
81833
82029
|
return cloneDeep__default.default(this.docObject);
|
|
81834
82030
|
}
|
|
82031
|
+
applyingOps() {
|
|
82032
|
+
return false;
|
|
82033
|
+
}
|
|
81835
82034
|
getContainerBlocks(containerId) {
|
|
81836
82035
|
const blocks = this.docObject.blocks[containerId];
|
|
81837
82036
|
return blocks;
|
|
@@ -81876,6 +82075,10 @@ ${docStr}
|
|
|
81876
82075
|
return (_c = (_b = (_a = this.server).getServerMeta) == null ? void 0 : _b.call(_a)) != null ? _c : {};
|
|
81877
82076
|
}
|
|
81878
82077
|
buildResourceUrl(src) {
|
|
82078
|
+
var _a;
|
|
82079
|
+
if ((_a = this.editorOptions) == null ? void 0 : _a.buildResourceUrl) {
|
|
82080
|
+
return this.editorOptions.buildResourceUrl(this, src);
|
|
82081
|
+
}
|
|
81879
82082
|
return this.server.buildResourceUrl(src);
|
|
81880
82083
|
}
|
|
81881
82084
|
request() {
|
|
@@ -82403,7 +82606,7 @@ ${docStr}
|
|
|
82403
82606
|
if (hasLastVersion) {
|
|
82404
82607
|
const item = {
|
|
82405
82608
|
id: "last-version",
|
|
82406
|
-
name: "
|
|
82609
|
+
name: i18n$1.t("version.lastVersion"),
|
|
82407
82610
|
data: lastVersion,
|
|
82408
82611
|
element: renderItem
|
|
82409
82612
|
};
|
|
@@ -82733,7 +82936,7 @@ ${docStr}
|
|
|
82733
82936
|
}
|
|
82734
82937
|
const logger$x = getLogger("version-dialog");
|
|
82735
82938
|
class OnesEditorVersionsDialog {
|
|
82736
|
-
constructor(server, provider) {
|
|
82939
|
+
constructor(server, provider, editorOptions) {
|
|
82737
82940
|
__publicField(this, "dialog", null);
|
|
82738
82941
|
__publicField(this, "oldViewer", null);
|
|
82739
82942
|
__publicField(this, "versionOptions");
|
|
@@ -82802,7 +83005,7 @@ ${docStr}
|
|
|
82802
83005
|
}
|
|
82803
83006
|
const { editorContainer: editorElement } = this.components;
|
|
82804
83007
|
editorElement.innerHTML = "";
|
|
82805
|
-
const historyDoc = new HistoryDoc(this.server, docObject);
|
|
83008
|
+
const historyDoc = new HistoryDoc(this.server, docObject, this.editorOptions);
|
|
82806
83009
|
const viewer = this.provider.createHistoryEditor(editorElement, historyDoc);
|
|
82807
83010
|
viewer.editorBlockRenders.registerRender(new OnesEditorHistoryRender());
|
|
82808
83011
|
viewer.editorBoxes.registerBoxClass(HistoryDeletedTextBox);
|
|
@@ -82825,6 +83028,7 @@ ${docStr}
|
|
|
82825
83028
|
this.components.infoHeader.dropdown.setVersions(this.versions);
|
|
82826
83029
|
});
|
|
82827
83030
|
this.server = server;
|
|
83031
|
+
this.editorOptions = editorOptions;
|
|
82828
83032
|
this.provider = provider;
|
|
82829
83033
|
const root2 = createElement("div", ["version-dialog"], null);
|
|
82830
83034
|
root2.style.setProperty("--history-mask-identifier", `"${HISTORY_MASK_IDENTIFIER}"`);
|
|
@@ -83067,12 +83271,7 @@ ${docStr}
|
|
|
83067
83271
|
}
|
|
83068
83272
|
}
|
|
83069
83273
|
function isTitleBlock$1(block) {
|
|
83070
|
-
|
|
83071
|
-
if (prevBlock) {
|
|
83072
|
-
return false;
|
|
83073
|
-
}
|
|
83074
|
-
const container = getParentContainer(block);
|
|
83075
|
-
return isRootContainer(container);
|
|
83274
|
+
return block.hasAttribute("data-document-title");
|
|
83076
83275
|
}
|
|
83077
83276
|
function canShowCollapseButtons(editor, hoverBlock) {
|
|
83078
83277
|
var _a, _b;
|
|
@@ -85577,7 +85776,6 @@ ${docStr}
|
|
|
85577
85776
|
});
|
|
85578
85777
|
setTimeout(() => {
|
|
85579
85778
|
textarea2.setSelectionRange(0, 0);
|
|
85580
|
-
textarea2.focus();
|
|
85581
85779
|
textarea2.scrollTop = 0;
|
|
85582
85780
|
textarea2.style.height = `${textarea2.scrollHeight}px`;
|
|
85583
85781
|
}, 20);
|
|
@@ -85588,6 +85786,9 @@ ${docStr}
|
|
|
85588
85786
|
assert(logger$n, textarea2 instanceof HTMLTextAreaElement, "Textarea is not HTMLTextAreaElement");
|
|
85589
85787
|
return textarea2;
|
|
85590
85788
|
};
|
|
85789
|
+
function focusToCodeEditor(block) {
|
|
85790
|
+
getCodeEditor(block).focus();
|
|
85791
|
+
}
|
|
85591
85792
|
const logger$m = getLogger("graph-dom/view-select");
|
|
85592
85793
|
var ViewId = /* @__PURE__ */ ((ViewId2) => {
|
|
85593
85794
|
ViewId2["Both"] = "both";
|
|
@@ -87469,6 +87670,9 @@ ${data2.flowchartText}
|
|
|
87469
87670
|
if (!plantumlImgFile) {
|
|
87470
87671
|
return await Promise.resolve(url);
|
|
87471
87672
|
}
|
|
87673
|
+
if (plantumlImgFile.type === "text/html") {
|
|
87674
|
+
return await Promise.resolve(url);
|
|
87675
|
+
}
|
|
87472
87676
|
const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile, { resourceType: "graph" });
|
|
87473
87677
|
return uploadResourceResult.resourceId;
|
|
87474
87678
|
} catch (error2) {
|
|
@@ -87613,7 +87817,10 @@ ${data2.plantumlText}
|
|
|
87613
87817
|
subText: `/${base.graphType}`,
|
|
87614
87818
|
name: i18n$1.t(`graph.${base.graphType}`),
|
|
87615
87819
|
execute: (editor, containerId, blockIndex) => {
|
|
87616
|
-
editor.insertEmbed(containerId, blockIndex, base.graphType, base.createEmptyEmbedData());
|
|
87820
|
+
const block = editor.insertEmbed(containerId, blockIndex, base.graphType, base.createEmptyEmbedData());
|
|
87821
|
+
setTimeout(() => {
|
|
87822
|
+
focusToCodeEditor(block);
|
|
87823
|
+
});
|
|
87617
87824
|
}
|
|
87618
87825
|
}];
|
|
87619
87826
|
};
|
|
@@ -90173,9 +90380,6 @@ ${data2.plantumlText}
|
|
|
90173
90380
|
super.destroy();
|
|
90174
90381
|
}
|
|
90175
90382
|
}
|
|
90176
|
-
const ErrCode = {
|
|
90177
|
-
ANALYZER_UNKNOWN_URL: "analyzer cannot recognize this url"
|
|
90178
|
-
};
|
|
90179
90383
|
class FigmaAnalyzer {
|
|
90180
90384
|
constructor() {
|
|
90181
90385
|
__publicField(this, "regex", /https:\/\/([\w.-]+\.)?figma.com\/.*$/i);
|
|
@@ -90341,10 +90545,17 @@ ${data2.plantumlText}
|
|
|
90341
90545
|
return ret;
|
|
90342
90546
|
}
|
|
90343
90547
|
}
|
|
90344
|
-
|
|
90548
|
+
return {
|
|
90549
|
+
providerName: "unknown",
|
|
90550
|
+
type: "iframe",
|
|
90551
|
+
url
|
|
90552
|
+
};
|
|
90345
90553
|
}
|
|
90346
90554
|
}
|
|
90347
90555
|
const urlAnalyzer = new URLAnalyzer();
|
|
90556
|
+
const ErrCode = {
|
|
90557
|
+
ANALYZER_UNKNOWN_URL: "analyzer cannot recognize this url"
|
|
90558
|
+
};
|
|
90348
90559
|
const getCommandItems = () => [
|
|
90349
90560
|
{
|
|
90350
90561
|
name: i18n$1.t("webpage.bilibili"),
|
|
@@ -91758,9 +91969,9 @@ ${data2.plantumlText}
|
|
|
91758
91969
|
options.events.onClickLink(editor2, event, link2);
|
|
91759
91970
|
return;
|
|
91760
91971
|
}
|
|
91761
|
-
const href = link2.getAttribute("link");
|
|
91972
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
91762
91973
|
if (href) {
|
|
91763
|
-
if (editor2.readonly || event.ctrlKey || event.metaKey) {
|
|
91974
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
91764
91975
|
window.open(href, "_blank");
|
|
91765
91976
|
}
|
|
91766
91977
|
}
|
|
@@ -93842,8 +94053,23 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93842
94053
|
this.id = id;
|
|
93843
94054
|
}
|
|
93844
94055
|
getCommand(editor) {
|
|
94056
|
+
var _a;
|
|
93845
94057
|
const commands = editor.editorCommandProviders.getCommands(editor.selection.range);
|
|
93846
|
-
|
|
94058
|
+
const command = commands.find((c) => c.id === this.id);
|
|
94059
|
+
if (command) {
|
|
94060
|
+
return command;
|
|
94061
|
+
}
|
|
94062
|
+
const moreCommand = commands.find((c) => c.id === "text/more");
|
|
94063
|
+
if (moreCommand) {
|
|
94064
|
+
const ret = (_a = moreCommand.children) == null ? void 0 : _a.find((c) => c.id === this.id);
|
|
94065
|
+
if (ret) {
|
|
94066
|
+
return {
|
|
94067
|
+
...moreCommand,
|
|
94068
|
+
...ret
|
|
94069
|
+
};
|
|
94070
|
+
}
|
|
94071
|
+
}
|
|
94072
|
+
return void 0;
|
|
93847
94073
|
}
|
|
93848
94074
|
onClick(editor) {
|
|
93849
94075
|
const command = this.getCommand(editor);
|
|
@@ -93892,13 +94118,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93892
94118
|
}
|
|
93893
94119
|
class SuperscriptItem extends FontStyleBaseItem {
|
|
93894
94120
|
constructor() {
|
|
93895
|
-
super(i18n$1.t("commands.superscript"), "text/style-
|
|
94121
|
+
super(i18n$1.t("commands.superscript"), "text/style-super");
|
|
93896
94122
|
__publicField(this, "icon", SuperscriptIcon);
|
|
93897
94123
|
}
|
|
93898
94124
|
}
|
|
93899
94125
|
class SubscriptItem extends FontStyleBaseItem {
|
|
93900
94126
|
constructor() {
|
|
93901
|
-
super(i18n$1.t("commands.subscript"), "text/style-
|
|
94127
|
+
super(i18n$1.t("commands.subscript"), "text/style-sub");
|
|
93902
94128
|
__publicField(this, "icon", SubscriptIcon);
|
|
93903
94129
|
}
|
|
93904
94130
|
}
|
|
@@ -94056,9 +94282,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94056
94282
|
Heading3Icon,
|
|
94057
94283
|
Heading4Icon,
|
|
94058
94284
|
Heading5Icon,
|
|
94059
|
-
Heading6Icon
|
|
94285
|
+
Heading6Icon,
|
|
94286
|
+
Heading7Icon,
|
|
94287
|
+
Heading8Icon
|
|
94060
94288
|
];
|
|
94061
|
-
for (let i = 1; i <=
|
|
94289
|
+
for (let i = 1; i <= 8; i++) {
|
|
94062
94290
|
this.children.push({
|
|
94063
94291
|
name: i18n$1.t("commands.heading", { name: `${i}` }),
|
|
94064
94292
|
id: `heading-${i}`,
|
|
@@ -94230,6 +94458,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94230
94458
|
__publicField(this, "manualShowChildren", true);
|
|
94231
94459
|
__publicField(this, "childrenPlacement", "bottom-start");
|
|
94232
94460
|
__publicField(this, "children", []);
|
|
94461
|
+
__publicField(this, "allChildren", []);
|
|
94462
|
+
this.editor = editor;
|
|
94233
94463
|
const provider = new InsertMenuProvider(editor);
|
|
94234
94464
|
const startBlock = editor.getBlockById(editor.selection.range.start.blockId);
|
|
94235
94465
|
const container = getParentContainer(startBlock);
|
|
@@ -94239,6 +94469,34 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94239
94469
|
commands = commands.slice(index2);
|
|
94240
94470
|
}
|
|
94241
94471
|
this.children = commands;
|
|
94472
|
+
this.allChildren = commands;
|
|
94473
|
+
}
|
|
94474
|
+
beforePopup(subBar) {
|
|
94475
|
+
const focusBlock = this.editor.selection.focusedBlock;
|
|
94476
|
+
if (focusBlock.closest('[data-block-type="callout"]')) {
|
|
94477
|
+
const textOnlyCommands = /* @__PURE__ */ new Set([
|
|
94478
|
+
"section-1",
|
|
94479
|
+
"section-2",
|
|
94480
|
+
"insert-emoji",
|
|
94481
|
+
"insert-link",
|
|
94482
|
+
"DateBoxCommandProvider",
|
|
94483
|
+
"insert-status",
|
|
94484
|
+
"insert-math",
|
|
94485
|
+
"insert-known-link",
|
|
94486
|
+
"insert-task-link"
|
|
94487
|
+
]);
|
|
94488
|
+
const children = this.allChildren.filter((c) => {
|
|
94489
|
+
if (textOnlyCommands.has(c.id)) {
|
|
94490
|
+
return true;
|
|
94491
|
+
}
|
|
94492
|
+
return false;
|
|
94493
|
+
});
|
|
94494
|
+
this.children = children;
|
|
94495
|
+
subBar.updateItems(this.children);
|
|
94496
|
+
} else {
|
|
94497
|
+
this.children = this.allChildren;
|
|
94498
|
+
subBar.updateItems(this.children);
|
|
94499
|
+
}
|
|
94242
94500
|
}
|
|
94243
94501
|
onClick(editor, item, commandBar2) {
|
|
94244
94502
|
const provider = new InsertMenuProvider(editor);
|
|
@@ -94293,6 +94551,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94293
94551
|
event.stopPropagation();
|
|
94294
94552
|
});
|
|
94295
94553
|
this.provider = new ColorStyleProvider(editor);
|
|
94554
|
+
this.latestColors = this.getColorsFromLocalStorage();
|
|
94555
|
+
this.setCurrentButtonColor(this.latestColors);
|
|
94296
94556
|
this.addListener("onClick", this.handleChangeColor);
|
|
94297
94557
|
this.element.addEventListener("mousedown", this.handleMousedown);
|
|
94298
94558
|
}
|
|
@@ -94460,7 +94720,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94460
94720
|
async onClick(editor, item) {
|
|
94461
94721
|
const block = editor.getBlockById(editor.selection.range.start.blockId);
|
|
94462
94722
|
const container = editor.getParentContainer(block);
|
|
94463
|
-
|
|
94723
|
+
let index2 = editor.getBlockIndex(block);
|
|
94464
94724
|
const file2 = await selectFile("*");
|
|
94465
94725
|
if (!file2) {
|
|
94466
94726
|
return;
|
|
@@ -94478,7 +94738,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94478
94738
|
creator: editor.doc.getUser().displayName,
|
|
94479
94739
|
previewType: FilePreviewType.Card
|
|
94480
94740
|
};
|
|
94481
|
-
|
|
94741
|
+
if (!isEmptyTextBlock(editor, block)) {
|
|
94742
|
+
index2 += 1;
|
|
94743
|
+
}
|
|
94744
|
+
const embedBlock = editor.insertEmbed(getContainerId(container), index2, "office", data2);
|
|
94745
|
+
const nextBlock = getNextBlock(embedBlock);
|
|
94746
|
+
if (nextBlock && isTextKindBlock(editor, nextBlock)) {
|
|
94747
|
+
editor.selection.selectBlock(nextBlock, 0);
|
|
94748
|
+
}
|
|
94482
94749
|
}
|
|
94483
94750
|
}
|
|
94484
94751
|
class InsertMentionItem {
|
|
@@ -94641,6 +94908,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94641
94908
|
}
|
|
94642
94909
|
const parent = findParent(child, id);
|
|
94643
94910
|
if (parent) {
|
|
94911
|
+
if (!parent.onClick) {
|
|
94912
|
+
return item2;
|
|
94913
|
+
}
|
|
94644
94914
|
return parent;
|
|
94645
94915
|
}
|
|
94646
94916
|
}
|
|
@@ -94672,6 +94942,12 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94672
94942
|
tooltipId: editor.clientId,
|
|
94673
94943
|
id: "main-toolbar"
|
|
94674
94944
|
});
|
|
94945
|
+
this.toolbar.addListener("closing", () => {
|
|
94946
|
+
setTimeout(() => {
|
|
94947
|
+
editor.focus();
|
|
94948
|
+
}, 100);
|
|
94949
|
+
return true;
|
|
94950
|
+
});
|
|
94675
94951
|
this.toolbar.addListener("click", this.handleClick);
|
|
94676
94952
|
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
94677
94953
|
this.updateState();
|
|
@@ -94750,6 +95026,294 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94750
95026
|
}
|
|
94751
95027
|
});
|
|
94752
95028
|
}
|
|
95029
|
+
const CkeImageConverter = {
|
|
95030
|
+
filter: (node) => {
|
|
95031
|
+
if (node.nodeName !== "IMG") {
|
|
95032
|
+
return false;
|
|
95033
|
+
}
|
|
95034
|
+
const elem = node;
|
|
95035
|
+
const refId = elem.getAttribute("data-ref-id");
|
|
95036
|
+
const refType = elem.getAttribute("data-ref-type");
|
|
95037
|
+
const uuid = elem.getAttribute("data-uuid");
|
|
95038
|
+
return Boolean(refType === "task" && refId && uuid);
|
|
95039
|
+
},
|
|
95040
|
+
replacement: (content, node) => {
|
|
95041
|
+
const refType = node.getAttribute("data-ref-type");
|
|
95042
|
+
const refId = node.getAttribute("data-ref-id");
|
|
95043
|
+
const uuid = node.getAttribute("data-uuid");
|
|
95044
|
+
const src = `ones-file:${refType}/${refId}/${uuid}`;
|
|
95045
|
+
return ``;
|
|
95046
|
+
}
|
|
95047
|
+
};
|
|
95048
|
+
const ckeHtmlConverters = /* @__PURE__ */ new Map();
|
|
95049
|
+
function registerCKEHtmlConvert(name, converter) {
|
|
95050
|
+
if (ckeHtmlConverters.has(name)) {
|
|
95051
|
+
return;
|
|
95052
|
+
}
|
|
95053
|
+
ckeHtmlConverters.set(name, converter);
|
|
95054
|
+
turndownService.use((ts) => {
|
|
95055
|
+
ts.addRule(name, converter);
|
|
95056
|
+
});
|
|
95057
|
+
}
|
|
95058
|
+
function getTurndownRootElement(node) {
|
|
95059
|
+
let parent = node;
|
|
95060
|
+
while (parent) {
|
|
95061
|
+
if (parent instanceof HTMLElement && parent.tagName === "BODY") {
|
|
95062
|
+
return parent;
|
|
95063
|
+
}
|
|
95064
|
+
if (!parent.parentNode) {
|
|
95065
|
+
return parent;
|
|
95066
|
+
}
|
|
95067
|
+
parent = parent.parentNode;
|
|
95068
|
+
}
|
|
95069
|
+
return node;
|
|
95070
|
+
}
|
|
95071
|
+
function patchForEmptyBlock(key, node, className) {
|
|
95072
|
+
const root2 = getTurndownRootElement(node);
|
|
95073
|
+
if (root2 && root2 instanceof HTMLElement) {
|
|
95074
|
+
const attributeKey = `data-${key}-processed`;
|
|
95075
|
+
if (!root2.getAttribute(attributeKey)) {
|
|
95076
|
+
root2.setAttribute(attributeKey, "true");
|
|
95077
|
+
const elements = root2.querySelectorAll(className);
|
|
95078
|
+
elements.forEach((elem) => {
|
|
95079
|
+
var _a;
|
|
95080
|
+
const text2 = (_a = elem.textContent) == null ? void 0 : _a.trim();
|
|
95081
|
+
if (!text2) {
|
|
95082
|
+
elem.innerText = "--temp-data--";
|
|
95083
|
+
}
|
|
95084
|
+
});
|
|
95085
|
+
}
|
|
95086
|
+
}
|
|
95087
|
+
}
|
|
95088
|
+
const CkeCommentConverter = {
|
|
95089
|
+
filter: (node) => {
|
|
95090
|
+
if (node.nodeName === "SPAN") {
|
|
95091
|
+
const span = node;
|
|
95092
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
95093
|
+
return Boolean(ref);
|
|
95094
|
+
}
|
|
95095
|
+
return false;
|
|
95096
|
+
},
|
|
95097
|
+
replacement: (content, node) => {
|
|
95098
|
+
var _a;
|
|
95099
|
+
const span = node;
|
|
95100
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
95101
|
+
const text2 = (_a = span.textContent) != null ? _a : "";
|
|
95102
|
+
return `[${text2}](comment://${ref})`;
|
|
95103
|
+
}
|
|
95104
|
+
};
|
|
95105
|
+
function processCkeCommentsLink(doc2) {
|
|
95106
|
+
const containers = doc2.blocks;
|
|
95107
|
+
Object.values(containers).forEach((blocks) => {
|
|
95108
|
+
blocks.forEach((block) => {
|
|
95109
|
+
const text2 = block.text;
|
|
95110
|
+
if (text2) {
|
|
95111
|
+
text2.forEach((op) => {
|
|
95112
|
+
if (op.attributes) {
|
|
95113
|
+
const attributes = op.attributes;
|
|
95114
|
+
const link2 = attributes.link;
|
|
95115
|
+
if (link2 == null ? void 0 : link2.startsWith("comment://")) {
|
|
95116
|
+
delete attributes.link;
|
|
95117
|
+
const commentId = link2.replace("comment://", "");
|
|
95118
|
+
const key = `comment-${commentId.toLocaleLowerCase()}`;
|
|
95119
|
+
attributes[key] = commentId;
|
|
95120
|
+
}
|
|
95121
|
+
}
|
|
95122
|
+
});
|
|
95123
|
+
}
|
|
95124
|
+
});
|
|
95125
|
+
});
|
|
95126
|
+
}
|
|
95127
|
+
const CkeMentionConverter = {
|
|
95128
|
+
filter: (node) => {
|
|
95129
|
+
patchForEmptyBlock("mention", node, ".ones-at-user-block");
|
|
95130
|
+
if (node.nodeName === "SPAN") {
|
|
95131
|
+
const span = node;
|
|
95132
|
+
if (hasClass(span, "ones-at-user-block")) {
|
|
95133
|
+
const name = span.getAttribute("data-default-name");
|
|
95134
|
+
const refId = span.getAttribute("data-ref-id");
|
|
95135
|
+
return Boolean(name) && Boolean(refId);
|
|
95136
|
+
}
|
|
95137
|
+
}
|
|
95138
|
+
return false;
|
|
95139
|
+
},
|
|
95140
|
+
replacement: (content, node) => {
|
|
95141
|
+
const span = node;
|
|
95142
|
+
const name = span.getAttribute("data-default-name") || "";
|
|
95143
|
+
const refId = span.getAttribute("data-ref-id") || "";
|
|
95144
|
+
if (name && refId) {
|
|
95145
|
+
const box = {
|
|
95146
|
+
id: genId(),
|
|
95147
|
+
type: "mention",
|
|
95148
|
+
box: true,
|
|
95149
|
+
created: Date.now(),
|
|
95150
|
+
iconUrl: "",
|
|
95151
|
+
text: name,
|
|
95152
|
+
mentionId: refId
|
|
95153
|
+
};
|
|
95154
|
+
const text2 = [
|
|
95155
|
+
{
|
|
95156
|
+
insert: " ",
|
|
95157
|
+
attributes: box
|
|
95158
|
+
}
|
|
95159
|
+
];
|
|
95160
|
+
const obj = {
|
|
95161
|
+
text: text2
|
|
95162
|
+
};
|
|
95163
|
+
const base64 = toBase64URL(JSON.stringify(obj));
|
|
95164
|
+
return `[[${base64}]]`;
|
|
95165
|
+
}
|
|
95166
|
+
return name;
|
|
95167
|
+
}
|
|
95168
|
+
};
|
|
95169
|
+
function convertMentionToCkeMention(editor, boxData, doc2, type) {
|
|
95170
|
+
const data2 = boxData;
|
|
95171
|
+
if (type === "html") {
|
|
95172
|
+
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>`;
|
|
95173
|
+
}
|
|
95174
|
+
return `@${data2.text}`;
|
|
95175
|
+
}
|
|
95176
|
+
function patchMentionConverter(editor) {
|
|
95177
|
+
const mentionBox = editor.editorBoxes.getBoxClass("mention");
|
|
95178
|
+
if (mentionBox) {
|
|
95179
|
+
const oldConvertTo = mentionBox.convertTo;
|
|
95180
|
+
if (oldConvertTo !== convertMentionToCkeMention) {
|
|
95181
|
+
mentionBox.convertTo = convertMentionToCkeMention;
|
|
95182
|
+
}
|
|
95183
|
+
}
|
|
95184
|
+
}
|
|
95185
|
+
function processLinks(doc2) {
|
|
95186
|
+
const containers = doc2.blocks;
|
|
95187
|
+
Object.values(containers).forEach((blocks) => {
|
|
95188
|
+
blocks.forEach((block) => {
|
|
95189
|
+
if (block.text) {
|
|
95190
|
+
const text2 = block.text;
|
|
95191
|
+
text2.forEach((op) => {
|
|
95192
|
+
const attributes = op.attributes;
|
|
95193
|
+
if (attributes) {
|
|
95194
|
+
attributes.link;
|
|
95195
|
+
}
|
|
95196
|
+
});
|
|
95197
|
+
}
|
|
95198
|
+
});
|
|
95199
|
+
});
|
|
95200
|
+
}
|
|
95201
|
+
const CkeMarkdownConverter = {
|
|
95202
|
+
filter: (node) => {
|
|
95203
|
+
if (node.nodeName !== "DIV") {
|
|
95204
|
+
return false;
|
|
95205
|
+
}
|
|
95206
|
+
const div = node;
|
|
95207
|
+
return hasClass(div, "ones-marked-card");
|
|
95208
|
+
},
|
|
95209
|
+
replacement: (content, node) => {
|
|
95210
|
+
const textToCodeBlock2 = (text2, language) => {
|
|
95211
|
+
const codeBlocks = text2.split("\n").map((line) => {
|
|
95212
|
+
const block = {
|
|
95213
|
+
type: "text",
|
|
95214
|
+
id: genId(),
|
|
95215
|
+
text: createRichText(line)
|
|
95216
|
+
};
|
|
95217
|
+
return block;
|
|
95218
|
+
});
|
|
95219
|
+
const containerId = genId();
|
|
95220
|
+
const doc22 = {
|
|
95221
|
+
blocks: {
|
|
95222
|
+
root: [
|
|
95223
|
+
{
|
|
95224
|
+
id: genId(),
|
|
95225
|
+
type: "code",
|
|
95226
|
+
language,
|
|
95227
|
+
children: [containerId]
|
|
95228
|
+
}
|
|
95229
|
+
],
|
|
95230
|
+
[containerId]: codeBlocks
|
|
95231
|
+
},
|
|
95232
|
+
meta: {},
|
|
95233
|
+
comments: {}
|
|
95234
|
+
};
|
|
95235
|
+
return toBase64URL(JSON.stringify(doc22));
|
|
95236
|
+
};
|
|
95237
|
+
const nodeToCodeBlock2 = (node2, lang) => {
|
|
95238
|
+
const text2 = node2.textContent || "";
|
|
95239
|
+
return textToCodeBlock2(text2, lang);
|
|
95240
|
+
};
|
|
95241
|
+
const doc2 = nodeToCodeBlock2(node, "markdown");
|
|
95242
|
+
const fence = "```";
|
|
95243
|
+
return "\n\n" + fence + "\n" + doc2 + "\n" + fence + "\n\n";
|
|
95244
|
+
}
|
|
95245
|
+
};
|
|
95246
|
+
registerCKEHtmlConvert("image", CkeImageConverter);
|
|
95247
|
+
registerCKEHtmlConvert("comment", CkeCommentConverter);
|
|
95248
|
+
registerCKEHtmlConvert("mention", CkeMentionConverter);
|
|
95249
|
+
registerCKEHtmlConvert("markdown", CkeMarkdownConverter);
|
|
95250
|
+
function ckeHtml2Doc(html) {
|
|
95251
|
+
const doc2 = htmlToDoc(html) || createEmptyDoc$1();
|
|
95252
|
+
processCkeCommentsLink(doc2);
|
|
95253
|
+
processLinks(doc2);
|
|
95254
|
+
return doc2;
|
|
95255
|
+
}
|
|
95256
|
+
function injectDocToCkeHtmlFragment(htmlFragment, doc2, text2) {
|
|
95257
|
+
const meta = `<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${toBase64URL(
|
|
95258
|
+
JSON.stringify(doc2)
|
|
95259
|
+
)}::ones-editor-doc" />`;
|
|
95260
|
+
let textMeta = "";
|
|
95261
|
+
if (text2) {
|
|
95262
|
+
textMeta = `<meta name="ones-editor-text" content="${toBase64URL(text2)}" />`;
|
|
95263
|
+
}
|
|
95264
|
+
const html = `<!doctype html><html><head>${meta}${textMeta}</head><body>${htmlFragment}</body></html>`;
|
|
95265
|
+
return html;
|
|
95266
|
+
}
|
|
95267
|
+
function editorToCKEHtml(editor) {
|
|
95268
|
+
patchMentionConverter(editor);
|
|
95269
|
+
const docObject = editor.doc.toJSON();
|
|
95270
|
+
if (isEmptyDoc(docObject)) {
|
|
95271
|
+
return "";
|
|
95272
|
+
}
|
|
95273
|
+
let html = docToHtmlFragment(editor, docObject);
|
|
95274
|
+
const text2 = docToText(editor, docObject);
|
|
95275
|
+
html = injectDocToCkeHtmlFragment(html, docObject, text2);
|
|
95276
|
+
return html;
|
|
95277
|
+
}
|
|
95278
|
+
function combineDoc(doc1, doc2) {
|
|
95279
|
+
if (isEmptyDoc(doc1)) {
|
|
95280
|
+
return doc2;
|
|
95281
|
+
}
|
|
95282
|
+
if (isEmptyDoc(doc2)) {
|
|
95283
|
+
return doc1;
|
|
95284
|
+
}
|
|
95285
|
+
const splitterDoc = createEmptyDoc$1("", {
|
|
95286
|
+
firstLineAsTitle: false
|
|
95287
|
+
});
|
|
95288
|
+
return mergeDocs([doc1, splitterDoc, doc2]);
|
|
95289
|
+
}
|
|
95290
|
+
function mergeHTMLBodiesOnly(htmlA, htmlB) {
|
|
95291
|
+
const parser = new DOMParser();
|
|
95292
|
+
const docA = parser.parseFromString(htmlA, "text/html");
|
|
95293
|
+
const docB = parser.parseFromString(htmlB, "text/html");
|
|
95294
|
+
const mergedDoc = document.implementation.createHTMLDocument("Merged");
|
|
95295
|
+
const bodyA = docA.body;
|
|
95296
|
+
const bodyB = docB.body;
|
|
95297
|
+
const mergedBody = mergedDoc.body;
|
|
95298
|
+
Array.from(bodyA.childNodes).forEach((node) => {
|
|
95299
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95300
|
+
});
|
|
95301
|
+
Array.from(bodyB.childNodes).forEach((node) => {
|
|
95302
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95303
|
+
});
|
|
95304
|
+
return mergedBody.innerHTML;
|
|
95305
|
+
}
|
|
95306
|
+
function combineCkeHtml(html1, html2) {
|
|
95307
|
+
const doc1 = ckeHtml2Doc(html1);
|
|
95308
|
+
const doc2 = ckeHtml2Doc(html2);
|
|
95309
|
+
const newDoc = combineDoc(doc1, doc2);
|
|
95310
|
+
const newHtml = mergeHTMLBodiesOnly(html1, html2);
|
|
95311
|
+
const ret = injectDocToCkeHtmlFragment(newHtml, newDoc);
|
|
95312
|
+
return ret;
|
|
95313
|
+
}
|
|
95314
|
+
function combineRichTextValue(value1, value2) {
|
|
95315
|
+
return combineCkeHtml(value1, value2);
|
|
95316
|
+
}
|
|
94753
95317
|
const logger = getLogger("create-editor");
|
|
94754
95318
|
function getHooks(options, local) {
|
|
94755
95319
|
var _a;
|
|
@@ -94975,9 +95539,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94975
95539
|
options.events.onClickLink(editor2, event, link2);
|
|
94976
95540
|
return;
|
|
94977
95541
|
}
|
|
94978
|
-
const href = link2.getAttribute("link");
|
|
95542
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
94979
95543
|
if (href) {
|
|
94980
|
-
if (editor2.readonly || event.ctrlKey || event.metaKey) {
|
|
95544
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
94981
95545
|
window.open(href, "_blank");
|
|
94982
95546
|
}
|
|
94983
95547
|
}
|
|
@@ -95008,7 +95572,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95008
95572
|
}
|
|
95009
95573
|
}
|
|
95010
95574
|
});
|
|
95011
|
-
editor.version = "2.9.8-beta.
|
|
95575
|
+
editor.version = "2.9.8-beta.40";
|
|
95012
95576
|
return editor;
|
|
95013
95577
|
}
|
|
95014
95578
|
function isDoc(doc2) {
|
|
@@ -95129,9 +95693,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95129
95693
|
options.events.onClickLink(editor2, event, link2);
|
|
95130
95694
|
return;
|
|
95131
95695
|
}
|
|
95132
|
-
const href = link2.getAttribute("link");
|
|
95696
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
95133
95697
|
if (href) {
|
|
95134
|
-
if (editor2.readonly || event.ctrlKey || event.metaKey) {
|
|
95698
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
95135
95699
|
window.open(href, "_blank");
|
|
95136
95700
|
}
|
|
95137
95701
|
}
|
|
@@ -95140,7 +95704,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95140
95704
|
OnesEditorDropTarget.register(editor);
|
|
95141
95705
|
OnesEditorTocProvider.register(editor);
|
|
95142
95706
|
OnesEditorExclusiveBlock.register(editor);
|
|
95143
|
-
editor.version = "2.9.8-beta.
|
|
95707
|
+
editor.version = "2.9.8-beta.40";
|
|
95144
95708
|
return editor;
|
|
95145
95709
|
}
|
|
95146
95710
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -95176,8 +95740,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95176
95740
|
displayName,
|
|
95177
95741
|
avatarUrl: ""
|
|
95178
95742
|
};
|
|
95179
|
-
const
|
|
95180
|
-
|
|
95743
|
+
const server = await ShareDBServer.load({
|
|
95744
|
+
auth,
|
|
95745
|
+
serverUrl: options.serverUrl
|
|
95746
|
+
});
|
|
95747
|
+
const versionHelper = (_a = server.getVersionHelper) == null ? void 0 : _a.call(server);
|
|
95181
95748
|
if (!versionHelper) {
|
|
95182
95749
|
throw new Error("the editor does not support to show versions");
|
|
95183
95750
|
}
|
|
@@ -95192,10 +95759,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95192
95759
|
userId,
|
|
95193
95760
|
displayName,
|
|
95194
95761
|
avatarUrl: ""
|
|
95195
|
-
}
|
|
95762
|
+
},
|
|
95763
|
+
...options == null ? void 0 : options.editorOptions
|
|
95196
95764
|
};
|
|
95197
95765
|
const versionsProvider = new ShareDBDocVersionsProvider(editorOptions);
|
|
95198
|
-
const dialog = new OnesEditorVersionsDialog(
|
|
95766
|
+
const dialog = new OnesEditorVersionsDialog(server, versionsProvider, editorOptions);
|
|
95199
95767
|
const dialogOptions = options.options || {
|
|
95200
95768
|
container: parent
|
|
95201
95769
|
};
|
|
@@ -141242,12 +141810,15 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141242
141810
|
exports2.blockToText = blockToText;
|
|
141243
141811
|
exports2.blocksToDoc = blocksToDoc;
|
|
141244
141812
|
exports2.changeButtonName = changeButtonName;
|
|
141813
|
+
exports2.ckeHtml2Doc = ckeHtml2Doc;
|
|
141245
141814
|
exports2.clearAllSelection = clearAllSelection;
|
|
141246
141815
|
exports2.clientType = clientType;
|
|
141247
141816
|
exports2.cloneBlock = cloneBlock;
|
|
141248
141817
|
exports2.cloneChildContainer = cloneChildContainer;
|
|
141249
141818
|
exports2.cloneDoc = cloneDoc;
|
|
141250
141819
|
exports2.cloneText = cloneText;
|
|
141820
|
+
exports2.combineCkeHtml = combineCkeHtml;
|
|
141821
|
+
exports2.combineRichTextValue = combineRichTextValue;
|
|
141251
141822
|
exports2.commentToShareDbComment = commentToShareDbComment;
|
|
141252
141823
|
exports2.compareElement = compareElement;
|
|
141253
141824
|
exports2.comparePosition = comparePosition;
|
|
@@ -141387,6 +141958,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141387
141958
|
exports2.editorRunOnce = editorRunOnce;
|
|
141388
141959
|
exports2.editorScrollIntoView = editorScrollIntoView;
|
|
141389
141960
|
exports2.editorSelectAll = editorSelectAll;
|
|
141961
|
+
exports2.editorSelectAllBlocks = editorSelectAllBlocks;
|
|
141390
141962
|
exports2.editorSelectContainer = editorSelectContainer;
|
|
141391
141963
|
exports2.editorSelectDown = editorSelectDown;
|
|
141392
141964
|
exports2.editorSelectEnd = editorSelectEnd;
|
|
@@ -141403,6 +141975,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141403
141975
|
exports2.editorSelectWordLeft = editorSelectWordLeft;
|
|
141404
141976
|
exports2.editorSetTextColor = editorSetTextColor;
|
|
141405
141977
|
exports2.editorShowFindDialog = editorShowFindDialog;
|
|
141978
|
+
exports2.editorToCKEHtml = editorToCKEHtml;
|
|
141406
141979
|
exports2.editorToDocx = editorToDocx;
|
|
141407
141980
|
exports2.editorUpdateBlockData = editorUpdateBlockData;
|
|
141408
141981
|
exports2.editorUpdateCompositionText = editorUpdateCompositionText;
|
|
@@ -141569,6 +142142,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141569
142142
|
exports2.i18n = i18n$1;
|
|
141570
142143
|
exports2.includeBigTable = includeBigTable;
|
|
141571
142144
|
exports2.injectBlockOptions = injectBlockOptions;
|
|
142145
|
+
exports2.injectDocToCkeHtmlFragment = injectDocToCkeHtmlFragment;
|
|
141572
142146
|
exports2.injectDocToHtmlFragment = injectDocToHtmlFragment;
|
|
141573
142147
|
exports2.injectSource = injectSource;
|
|
141574
142148
|
exports2.injectStyle = injectStyle;
|