@ones-editor/editor 2.9.8-beta.2 → 2.9.8-beta.21
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/types.d.ts +1 -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/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-base/src/command-bar/types.d.ts +5 -0
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +428 -79
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3190,11 +3190,9 @@ div.editor-root div.editor-content div[data-type=editor-block] div[data-type=blo
|
|
|
3190
3190
|
}
|
|
3191
3191
|
div.editor-root div.editor-content div[data-type=editor-block] div[data-type=block-content] > span.status-box .box-status-common {
|
|
3192
3192
|
max-width: 100%;
|
|
3193
|
-
line-height: 20px;
|
|
3194
3193
|
padding: 0px 5px;
|
|
3195
3194
|
border-radius: 3px;
|
|
3196
|
-
font-size:
|
|
3197
|
-
height: 20px;
|
|
3195
|
+
font-size: 0.8em;
|
|
3198
3196
|
cursor: pointer;
|
|
3199
3197
|
white-space: nowrap;
|
|
3200
3198
|
text-overflow: ellipsis;
|
|
@@ -8809,7 +8807,31 @@ div.editor-root div.editor-content div[data-type=editor-container].root.select-a
|
|
|
8809
8807
|
margin-left: 5px;
|
|
8810
8808
|
margin-right: 5px;
|
|
8811
8809
|
}div.editor-root.compact div.editor-content div[data-type=editor-container].root > .container-blocks > * + * {
|
|
8812
|
-
margin: 0.2em
|
|
8810
|
+
margin-top: 0.2em;
|
|
8811
|
+
}
|
|
8812
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-quoted] + div[data-type=editor-block][data-style-quoted] {
|
|
8813
|
+
margin-top: 0;
|
|
8814
|
+
}
|
|
8815
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block].layout-block .container-blocks > * + * {
|
|
8816
|
+
margin-top: 0.2em;
|
|
8817
|
+
}
|
|
8818
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="1"]:not(:first-child) {
|
|
8819
|
+
margin-top: 0.5em !important;
|
|
8820
|
+
}
|
|
8821
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="2"]:not(:first-child) {
|
|
8822
|
+
margin-top: 0.5em !important;
|
|
8823
|
+
}
|
|
8824
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="3"]:not(:first-child) {
|
|
8825
|
+
margin-top: 0.5em !important;
|
|
8826
|
+
}
|
|
8827
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="4"]:not(:first-child) {
|
|
8828
|
+
margin-top: 0.4em !important;
|
|
8829
|
+
}
|
|
8830
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="5"]:not(:first-child) {
|
|
8831
|
+
margin-top: 0.3em !important;
|
|
8832
|
+
}
|
|
8833
|
+
div.editor-root.compact div.editor-content div[data-type=editor-block][data-style-heading="6"]:not(:first-child) {
|
|
8834
|
+
margin-top: 0.2em !important;
|
|
8813
8835
|
}
|
|
8814
8836
|
div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
|
|
8815
8837
|
padding-left: 10px;
|
|
@@ -24898,18 +24920,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24898
24920
|
};
|
|
24899
24921
|
}
|
|
24900
24922
|
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;
|
|
24923
|
+
const blocks = doc2.blocks.root;
|
|
24924
|
+
const ret = blocks.every((block) => {
|
|
24925
|
+
return block.type === "text" && getTextLength(block.text || []) === 0;
|
|
24926
|
+
});
|
|
24927
|
+
return ret;
|
|
24913
24928
|
}
|
|
24914
24929
|
function createContainer$1(doc2, docsOrDocObject) {
|
|
24915
24930
|
const containerId = genId();
|
|
@@ -26352,9 +26367,10 @@ var __publicField = (obj, key, value) => {
|
|
|
26352
26367
|
const y2 = rect.bottom > windowHeight ? windowHeight : rect.bottom;
|
|
26353
26368
|
const centerX = (x1 + x2) / 2;
|
|
26354
26369
|
const centerY = (y1 + y2) / 2;
|
|
26355
|
-
const x = 0 - rect.left + centerX;
|
|
26356
|
-
const y = 0 - rect.top + centerY + container.scrollTop;
|
|
26357
26370
|
const input2 = editor.input.inputElement;
|
|
26371
|
+
const inputHeight = input2.getBoundingClientRect().height;
|
|
26372
|
+
const x = 0 - rect.left + centerX;
|
|
26373
|
+
const y = 0 - rect.top + centerY + container.scrollTop - inputHeight / 2;
|
|
26358
26374
|
input2.style.left = `${x / scale}px`;
|
|
26359
26375
|
input2.style.top = `${y / scale}px`;
|
|
26360
26376
|
}
|
|
@@ -26640,13 +26656,14 @@ var __publicField = (obj, key, value) => {
|
|
|
26640
26656
|
while (prevBlock && !blocks.has(getBlockId(prevBlock))) {
|
|
26641
26657
|
prevBlock = getPrevVisibleBlock(prevBlock);
|
|
26642
26658
|
}
|
|
26643
|
-
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
assert(logger$3Q, nextBlock, "no prev and next block while deleting a block");
|
|
26648
|
-
newRange = createBlockSimpleRange(editor, nextBlock, 0);
|
|
26659
|
+
if (prevBlock) {
|
|
26660
|
+
newRange = createBlockSimpleRange(editor, prevBlock, getBlockTextLength$6(editor, prevBlock));
|
|
26661
|
+
return newRange;
|
|
26662
|
+
}
|
|
26649
26663
|
}
|
|
26664
|
+
const nextBlock = getNextVisibleBlock(block);
|
|
26665
|
+
assert(logger$3Q, nextBlock, "no prev and next block while deleting a block");
|
|
26666
|
+
newRange = createBlockSimpleRange(editor, nextBlock, 0);
|
|
26650
26667
|
return newRange;
|
|
26651
26668
|
}
|
|
26652
26669
|
const logger$3P = getLogger("block-to-html");
|
|
@@ -30570,6 +30587,10 @@ ${codeText}
|
|
|
30570
30587
|
endBatchUpdate() {
|
|
30571
30588
|
return this.externalDoc.endBatchUpdate();
|
|
30572
30589
|
}
|
|
30590
|
+
applyingOps() {
|
|
30591
|
+
var _a, _b;
|
|
30592
|
+
return ((_b = (_a = this.externalDoc).applyingOps) == null ? void 0 : _b.call(_a)) || false;
|
|
30593
|
+
}
|
|
30573
30594
|
registerLocalEvents(events2) {
|
|
30574
30595
|
this.localEvents.push(events2);
|
|
30575
30596
|
}
|
|
@@ -31795,11 +31816,16 @@ ${codeText}
|
|
|
31795
31816
|
return rangeResult;
|
|
31796
31817
|
}
|
|
31797
31818
|
}
|
|
31798
|
-
|
|
31799
|
-
|
|
31800
|
-
const
|
|
31801
|
-
|
|
31802
|
-
|
|
31819
|
+
editor.doc.beginBatchUpdate();
|
|
31820
|
+
try {
|
|
31821
|
+
const blocks = range.getSelectedBlocks();
|
|
31822
|
+
blocks.forEach((b) => {
|
|
31823
|
+
const childRange = createEditorSelectionRange(editor, { anchor: b.start, focus: b.end });
|
|
31824
|
+
this.executeBlockCommand(editor, b.block, childRange, command, params, rangeResult);
|
|
31825
|
+
});
|
|
31826
|
+
} finally {
|
|
31827
|
+
editor.doc.endBatchUpdate();
|
|
31828
|
+
}
|
|
31803
31829
|
if (!clientType.isMobile) {
|
|
31804
31830
|
editor.focus();
|
|
31805
31831
|
}
|
|
@@ -31956,6 +31982,7 @@ ${codeText}
|
|
|
31956
31982
|
__publicField(this, "settingsProvider");
|
|
31957
31983
|
__publicField(this, "_readonly", false);
|
|
31958
31984
|
__publicField(this, "_scrollable", true);
|
|
31985
|
+
__publicField(this, "_destroyed", false);
|
|
31959
31986
|
__publicField(this, "getColor", (index2) => {
|
|
31960
31987
|
const colors = this.options.colors;
|
|
31961
31988
|
if (colors.length === 0) {
|
|
@@ -32095,6 +32122,10 @@ ${codeText}
|
|
|
32095
32122
|
this.domEvents.destroy();
|
|
32096
32123
|
this.removeAllListeners();
|
|
32097
32124
|
this.inputHandlers.destroy();
|
|
32125
|
+
this._destroyed = true;
|
|
32126
|
+
}
|
|
32127
|
+
get destroyed() {
|
|
32128
|
+
return this._destroyed;
|
|
32098
32129
|
}
|
|
32099
32130
|
focus(options) {
|
|
32100
32131
|
this.input.focus(options);
|
|
@@ -32386,11 +32417,17 @@ ${codeText}
|
|
|
32386
32417
|
this.emit("change", Array.from(this.users.values()));
|
|
32387
32418
|
}, 300);
|
|
32388
32419
|
}
|
|
32389
|
-
getSimpleCursors(blockId) {
|
|
32420
|
+
getSimpleCursors(blockId, excludeUserId) {
|
|
32390
32421
|
const ret = /* @__PURE__ */ new Map();
|
|
32391
32422
|
Array.from(this.cursors.values()).filter((message) => {
|
|
32392
32423
|
const ret2 = message.range.anchor.blockId === blockId && isSimpleRange(message.range);
|
|
32393
|
-
|
|
32424
|
+
if (!ret2) {
|
|
32425
|
+
return false;
|
|
32426
|
+
}
|
|
32427
|
+
if (excludeUserId && excludeUserId === message.user.userId) {
|
|
32428
|
+
return false;
|
|
32429
|
+
}
|
|
32430
|
+
return true;
|
|
32394
32431
|
}).forEach((message) => {
|
|
32395
32432
|
const offset = message.range.focus.offset;
|
|
32396
32433
|
let users = ret.get(offset);
|
|
@@ -32471,6 +32508,9 @@ ${codeText}
|
|
|
32471
32508
|
rawData() {
|
|
32472
32509
|
return this.doc;
|
|
32473
32510
|
}
|
|
32511
|
+
applyingOps() {
|
|
32512
|
+
return false;
|
|
32513
|
+
}
|
|
32474
32514
|
getContainerBlocks(containerId) {
|
|
32475
32515
|
const blocks = this.doc.blocks[containerId];
|
|
32476
32516
|
return blocks;
|
|
@@ -39453,6 +39493,7 @@ ${codeText}
|
|
|
39453
39493
|
__publicField(this, "disableLogout");
|
|
39454
39494
|
__publicField(this, "destroyed", false);
|
|
39455
39495
|
__publicField(this, "editStatus");
|
|
39496
|
+
__publicField(this, "_applyingOps", false);
|
|
39456
39497
|
__publicField(this, "handleNothingPending", () => {
|
|
39457
39498
|
this.setStatus("clean");
|
|
39458
39499
|
});
|
|
@@ -39637,11 +39678,14 @@ ${codeText}
|
|
|
39637
39678
|
return;
|
|
39638
39679
|
}
|
|
39639
39680
|
try {
|
|
39681
|
+
this._applyingOps = true;
|
|
39640
39682
|
const local = !!source;
|
|
39641
39683
|
parseOps(ops, this, local);
|
|
39642
39684
|
} catch (err) {
|
|
39643
39685
|
logger$2T.error(err);
|
|
39644
39686
|
throw err;
|
|
39687
|
+
} finally {
|
|
39688
|
+
this._applyingOps = false;
|
|
39645
39689
|
}
|
|
39646
39690
|
});
|
|
39647
39691
|
this.options = options;
|
|
@@ -39666,6 +39710,9 @@ ${codeText}
|
|
|
39666
39710
|
}
|
|
39667
39711
|
return this.batching;
|
|
39668
39712
|
}
|
|
39713
|
+
applyingOps() {
|
|
39714
|
+
return this._applyingOps;
|
|
39715
|
+
}
|
|
39669
39716
|
static async load(options) {
|
|
39670
39717
|
try {
|
|
39671
39718
|
const client = new ShareDBClient(options.auth, options.serverUrl, options.renewTokenFunc);
|
|
@@ -40162,7 +40209,7 @@ ${codeText}
|
|
|
40162
40209
|
assert(logger$2S, typeof blockIndex === "number", "invalid path blockIndex");
|
|
40163
40210
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
40164
40211
|
const length = getTextLength(blockText);
|
|
40165
|
-
const cursorMessages = remoteUsers.getSimpleCursors(blockData.id);
|
|
40212
|
+
const cursorMessages = remoteUsers.getSimpleCursors(blockData.id, editor.doc.getUser().userId);
|
|
40166
40213
|
cursorMessages.forEach((messages, offset) => {
|
|
40167
40214
|
if (offset > length) {
|
|
40168
40215
|
offset = length;
|
|
@@ -41987,7 +42034,7 @@ ${codeText}
|
|
|
41987
42034
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
41988
42035
|
maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
|
|
41989
42036
|
arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
|
|
41990
|
-
appendTo: document.body,
|
|
42037
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
41991
42038
|
onShow: this.handleShow,
|
|
41992
42039
|
onHidden: this.handleHidden,
|
|
41993
42040
|
onShown: this.handleShown,
|
|
@@ -42553,7 +42600,7 @@ ${codeText}
|
|
|
42553
42600
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
42554
42601
|
maxWidth: 500,
|
|
42555
42602
|
arrow: this.options.tippyArrow,
|
|
42556
|
-
appendTo: document.body,
|
|
42603
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
42557
42604
|
onShow: this.handleShow,
|
|
42558
42605
|
onHidden: this.handleHidden,
|
|
42559
42606
|
delay: options == null ? void 0 : options.delay,
|
|
@@ -43163,7 +43210,7 @@ ${codeText}
|
|
|
43163
43210
|
placement: "bottom",
|
|
43164
43211
|
maxWidth: 1e3,
|
|
43165
43212
|
arrow: (_b = options == null ? void 0 : options.arrow) != null ? _b : this.options.tippyArrow,
|
|
43166
|
-
appendTo: document.body,
|
|
43213
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
43167
43214
|
onShow: this.handleShow,
|
|
43168
43215
|
onShown: this.handleShown,
|
|
43169
43216
|
onHidden: this.handleHidden,
|
|
@@ -51475,23 +51522,28 @@ ${codeText}
|
|
|
51475
51522
|
}
|
|
51476
51523
|
function resetListStart(editor, brothers, start, options) {
|
|
51477
51524
|
var _a;
|
|
51478
|
-
|
|
51479
|
-
|
|
51480
|
-
const
|
|
51481
|
-
|
|
51482
|
-
const
|
|
51483
|
-
|
|
51484
|
-
|
|
51485
|
-
|
|
51486
|
-
|
|
51487
|
-
|
|
51525
|
+
editor.doc.beginBatchUpdate();
|
|
51526
|
+
try {
|
|
51527
|
+
const groupId = (_a = options == null ? void 0 : options.groupId) != null ? _a : genId();
|
|
51528
|
+
brothers.forEach((block) => {
|
|
51529
|
+
const oldData = editor.getBlockData(block);
|
|
51530
|
+
if (oldData.start !== start || (options == null ? void 0 : options.resetGroupId)) {
|
|
51531
|
+
const newData = {
|
|
51532
|
+
...oldData,
|
|
51533
|
+
start
|
|
51534
|
+
};
|
|
51535
|
+
if (options == null ? void 0 : options.resetGroupId) {
|
|
51536
|
+
newData.groupId = groupId;
|
|
51537
|
+
}
|
|
51538
|
+
editor.updateBlockData(block, newData);
|
|
51488
51539
|
}
|
|
51489
|
-
|
|
51490
|
-
|
|
51491
|
-
|
|
51492
|
-
|
|
51493
|
-
|
|
51494
|
-
|
|
51540
|
+
if (!oldData.textOnly) {
|
|
51541
|
+
start += 1;
|
|
51542
|
+
}
|
|
51543
|
+
});
|
|
51544
|
+
} finally {
|
|
51545
|
+
editor.doc.endBatchUpdate();
|
|
51546
|
+
}
|
|
51495
51547
|
}
|
|
51496
51548
|
function resetListStartByBrother(editor, listBrother, start, options) {
|
|
51497
51549
|
const allBrothers = getListAllBrothers(listBrother, { withSelf: true });
|
|
@@ -53110,7 +53162,11 @@ ${codeText}
|
|
|
53110
53162
|
handleDrop: handleListDrop,
|
|
53111
53163
|
notify,
|
|
53112
53164
|
handleDeleteBlock: (editor, block) => {
|
|
53165
|
+
var _a, _b;
|
|
53113
53166
|
if (isListBlock(block)) {
|
|
53167
|
+
if ((_b = (_a = editor.doc).applyingOps) == null ? void 0 : _b.call(_a)) {
|
|
53168
|
+
return;
|
|
53169
|
+
}
|
|
53114
53170
|
const fixStart = new FixStartByWillDeletedList(editor, block);
|
|
53115
53171
|
setTimeout(() => {
|
|
53116
53172
|
fixStart.fix();
|
|
@@ -54589,6 +54645,7 @@ ${codeText}
|
|
|
54589
54645
|
}, 50));
|
|
54590
54646
|
this.editor = editor;
|
|
54591
54647
|
const popover = editor.options.componentsOptions.popover;
|
|
54648
|
+
const objectToolbar = editor.options.componentsOptions.objectToolbar;
|
|
54592
54649
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
54593
54650
|
tooltipId: editor.clientId,
|
|
54594
54651
|
id: "editor-toolbar",
|
|
@@ -54596,7 +54653,8 @@ ${codeText}
|
|
|
54596
54653
|
refuseOverflow: true,
|
|
54597
54654
|
padding: 20,
|
|
54598
54655
|
showName: clientType.isMobile,
|
|
54599
|
-
autoClose: clientType.isMobile ? true : void 0
|
|
54656
|
+
autoClose: clientType.isMobile ? true : void 0,
|
|
54657
|
+
appendTo: (objectToolbar == null ? void 0 : objectToolbar.appendTo) || (popover == null ? void 0 : popover.appendTo)
|
|
54600
54658
|
});
|
|
54601
54659
|
this.toolbar.on("click", this.handleButtonClick);
|
|
54602
54660
|
this.toolbar.on("close", this.handleClose);
|
|
@@ -65116,7 +65174,6 @@ $$${mathData.mathjaxText}$$
|
|
|
65116
65174
|
if (insertPos === "before") {
|
|
65117
65175
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
65118
65176
|
if (!beforeBlock) {
|
|
65119
|
-
assert(logger$1z, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
65120
65177
|
const rect = block.getBoundingClientRect();
|
|
65121
65178
|
const viewRect2 = this.getViewRect(block);
|
|
65122
65179
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -68103,7 +68160,7 @@ ${codeText}
|
|
|
68103
68160
|
return false;
|
|
68104
68161
|
}
|
|
68105
68162
|
if (isRootContainer(getParentContainer(block))) {
|
|
68106
|
-
if (getBlockIndex(block) === 0) {
|
|
68163
|
+
if (getBlockIndex(block) === 0 && isTitleBlock$2(block)) {
|
|
68107
68164
|
return false;
|
|
68108
68165
|
}
|
|
68109
68166
|
}
|
|
@@ -74544,20 +74601,6 @@ ${codeText}
|
|
|
74544
74601
|
const maxCellTextLength = maxCellTextLengths.get(cell.col) || 0;
|
|
74545
74602
|
return padText(text2, maxCellTextLength);
|
|
74546
74603
|
};
|
|
74547
|
-
if (type === "text") {
|
|
74548
|
-
const text2 = [];
|
|
74549
|
-
for (let col = 0; col < grid.colCount; col++) {
|
|
74550
|
-
const cellText = getCellText({ row: 0, col });
|
|
74551
|
-
text2.push(cellText);
|
|
74552
|
-
}
|
|
74553
|
-
for (let row = 1; row < grid.rowCount; row++) {
|
|
74554
|
-
for (let col = 0; col < grid.colCount; col++) {
|
|
74555
|
-
const cellText = getCellText({ row, col });
|
|
74556
|
-
text2.push(cellText);
|
|
74557
|
-
}
|
|
74558
|
-
}
|
|
74559
|
-
return text2.join("\n");
|
|
74560
|
-
}
|
|
74561
74604
|
const lines = [];
|
|
74562
74605
|
let headerText = "|";
|
|
74563
74606
|
let headerSeparator = "|";
|
|
@@ -81845,6 +81888,9 @@ ${docStr}
|
|
|
81845
81888
|
toJSON() {
|
|
81846
81889
|
return cloneDeep__default.default(this.docObject);
|
|
81847
81890
|
}
|
|
81891
|
+
applyingOps() {
|
|
81892
|
+
return false;
|
|
81893
|
+
}
|
|
81848
81894
|
getContainerBlocks(containerId) {
|
|
81849
81895
|
const blocks = this.docObject.blocks[containerId];
|
|
81850
81896
|
return blocks;
|
|
@@ -83080,12 +83126,7 @@ ${docStr}
|
|
|
83080
83126
|
}
|
|
83081
83127
|
}
|
|
83082
83128
|
function isTitleBlock$1(block) {
|
|
83083
|
-
|
|
83084
|
-
if (prevBlock) {
|
|
83085
|
-
return false;
|
|
83086
|
-
}
|
|
83087
|
-
const container = getParentContainer(block);
|
|
83088
|
-
return isRootContainer(container);
|
|
83129
|
+
return block.hasAttribute("data-document-title");
|
|
83089
83130
|
}
|
|
83090
83131
|
function canShowCollapseButtons(editor, hoverBlock) {
|
|
83091
83132
|
var _a, _b;
|
|
@@ -93855,8 +93896,23 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93855
93896
|
this.id = id;
|
|
93856
93897
|
}
|
|
93857
93898
|
getCommand(editor) {
|
|
93899
|
+
var _a;
|
|
93858
93900
|
const commands = editor.editorCommandProviders.getCommands(editor.selection.range);
|
|
93859
|
-
|
|
93901
|
+
const command = commands.find((c) => c.id === this.id);
|
|
93902
|
+
if (command) {
|
|
93903
|
+
return command;
|
|
93904
|
+
}
|
|
93905
|
+
const moreCommand = commands.find((c) => c.id === "text/more");
|
|
93906
|
+
if (moreCommand) {
|
|
93907
|
+
const ret = (_a = moreCommand.children) == null ? void 0 : _a.find((c) => c.id === this.id);
|
|
93908
|
+
if (ret) {
|
|
93909
|
+
return {
|
|
93910
|
+
...moreCommand,
|
|
93911
|
+
...ret
|
|
93912
|
+
};
|
|
93913
|
+
}
|
|
93914
|
+
}
|
|
93915
|
+
return void 0;
|
|
93860
93916
|
}
|
|
93861
93917
|
onClick(editor) {
|
|
93862
93918
|
const command = this.getCommand(editor);
|
|
@@ -93905,13 +93961,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93905
93961
|
}
|
|
93906
93962
|
class SuperscriptItem extends FontStyleBaseItem {
|
|
93907
93963
|
constructor() {
|
|
93908
|
-
super(i18n$1.t("commands.superscript"), "text/style-
|
|
93964
|
+
super(i18n$1.t("commands.superscript"), "text/style-super");
|
|
93909
93965
|
__publicField(this, "icon", SuperscriptIcon);
|
|
93910
93966
|
}
|
|
93911
93967
|
}
|
|
93912
93968
|
class SubscriptItem extends FontStyleBaseItem {
|
|
93913
93969
|
constructor() {
|
|
93914
|
-
super(i18n$1.t("commands.subscript"), "text/style-
|
|
93970
|
+
super(i18n$1.t("commands.subscript"), "text/style-sub");
|
|
93915
93971
|
__publicField(this, "icon", SubscriptIcon);
|
|
93916
93972
|
}
|
|
93917
93973
|
}
|
|
@@ -94763,6 +94819,294 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94763
94819
|
}
|
|
94764
94820
|
});
|
|
94765
94821
|
}
|
|
94822
|
+
const CkeImageConverter = {
|
|
94823
|
+
filter: (node) => {
|
|
94824
|
+
if (node.nodeName !== "IMG") {
|
|
94825
|
+
return false;
|
|
94826
|
+
}
|
|
94827
|
+
const elem = node;
|
|
94828
|
+
const refId = elem.getAttribute("data-ref-id");
|
|
94829
|
+
const refType = elem.getAttribute("data-ref-type");
|
|
94830
|
+
const uuid = elem.getAttribute("data-uuid");
|
|
94831
|
+
return Boolean(refType === "task" && refId && uuid);
|
|
94832
|
+
},
|
|
94833
|
+
replacement: (content, node) => {
|
|
94834
|
+
const refType = node.getAttribute("data-ref-type");
|
|
94835
|
+
const refId = node.getAttribute("data-ref-id");
|
|
94836
|
+
const uuid = node.getAttribute("data-uuid");
|
|
94837
|
+
const src = `ones-file:${refType}/${refId}/${uuid}`;
|
|
94838
|
+
return ``;
|
|
94839
|
+
}
|
|
94840
|
+
};
|
|
94841
|
+
const ckeHtmlConverters = /* @__PURE__ */ new Map();
|
|
94842
|
+
function registerCKEHtmlConvert(name, converter) {
|
|
94843
|
+
if (ckeHtmlConverters.has(name)) {
|
|
94844
|
+
return;
|
|
94845
|
+
}
|
|
94846
|
+
ckeHtmlConverters.set(name, converter);
|
|
94847
|
+
turndownService.use((ts) => {
|
|
94848
|
+
ts.addRule(name, converter);
|
|
94849
|
+
});
|
|
94850
|
+
}
|
|
94851
|
+
function getTurndownRootElement(node) {
|
|
94852
|
+
let parent = node;
|
|
94853
|
+
while (parent) {
|
|
94854
|
+
if (parent instanceof HTMLElement && parent.tagName === "BODY") {
|
|
94855
|
+
return parent;
|
|
94856
|
+
}
|
|
94857
|
+
if (!parent.parentNode) {
|
|
94858
|
+
return parent;
|
|
94859
|
+
}
|
|
94860
|
+
parent = parent.parentNode;
|
|
94861
|
+
}
|
|
94862
|
+
return node;
|
|
94863
|
+
}
|
|
94864
|
+
function patchForEmptyBlock(key, node, className) {
|
|
94865
|
+
const root2 = getTurndownRootElement(node);
|
|
94866
|
+
if (root2 && root2 instanceof HTMLElement) {
|
|
94867
|
+
const attributeKey = `data-${key}-processed`;
|
|
94868
|
+
if (!root2.getAttribute(attributeKey)) {
|
|
94869
|
+
root2.setAttribute(attributeKey, "true");
|
|
94870
|
+
const elements = root2.querySelectorAll(className);
|
|
94871
|
+
elements.forEach((elem) => {
|
|
94872
|
+
var _a;
|
|
94873
|
+
const text2 = (_a = elem.textContent) == null ? void 0 : _a.trim();
|
|
94874
|
+
if (!text2) {
|
|
94875
|
+
elem.innerText = "--temp-data--";
|
|
94876
|
+
}
|
|
94877
|
+
});
|
|
94878
|
+
}
|
|
94879
|
+
}
|
|
94880
|
+
}
|
|
94881
|
+
const CkeCommentConverter = {
|
|
94882
|
+
filter: (node) => {
|
|
94883
|
+
if (node.nodeName === "SPAN") {
|
|
94884
|
+
const span = node;
|
|
94885
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
94886
|
+
return Boolean(ref);
|
|
94887
|
+
}
|
|
94888
|
+
return false;
|
|
94889
|
+
},
|
|
94890
|
+
replacement: (content, node) => {
|
|
94891
|
+
var _a;
|
|
94892
|
+
const span = node;
|
|
94893
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
94894
|
+
const text2 = (_a = span.textContent) != null ? _a : "";
|
|
94895
|
+
return `[${text2}](comment://${ref})`;
|
|
94896
|
+
}
|
|
94897
|
+
};
|
|
94898
|
+
function processCkeCommentsLink(doc2) {
|
|
94899
|
+
const containers = doc2.blocks;
|
|
94900
|
+
Object.values(containers).forEach((blocks) => {
|
|
94901
|
+
blocks.forEach((block) => {
|
|
94902
|
+
const text2 = block.text;
|
|
94903
|
+
if (text2) {
|
|
94904
|
+
text2.forEach((op) => {
|
|
94905
|
+
if (op.attributes) {
|
|
94906
|
+
const attributes = op.attributes;
|
|
94907
|
+
const link2 = attributes.link;
|
|
94908
|
+
if (link2 == null ? void 0 : link2.startsWith("comment://")) {
|
|
94909
|
+
delete attributes.link;
|
|
94910
|
+
const commentId = link2.replace("comment://", "");
|
|
94911
|
+
const key = `comment-${commentId.toLocaleLowerCase()}`;
|
|
94912
|
+
attributes[key] = commentId;
|
|
94913
|
+
}
|
|
94914
|
+
}
|
|
94915
|
+
});
|
|
94916
|
+
}
|
|
94917
|
+
});
|
|
94918
|
+
});
|
|
94919
|
+
}
|
|
94920
|
+
const CkeMentionConverter = {
|
|
94921
|
+
filter: (node) => {
|
|
94922
|
+
patchForEmptyBlock("mention", node, ".ones-at-user-block");
|
|
94923
|
+
if (node.nodeName === "SPAN") {
|
|
94924
|
+
const span = node;
|
|
94925
|
+
if (hasClass(span, "ones-at-user-block")) {
|
|
94926
|
+
const name = span.getAttribute("data-default-name");
|
|
94927
|
+
const refId = span.getAttribute("data-ref-id");
|
|
94928
|
+
return Boolean(name) && Boolean(refId);
|
|
94929
|
+
}
|
|
94930
|
+
}
|
|
94931
|
+
return false;
|
|
94932
|
+
},
|
|
94933
|
+
replacement: (content, node) => {
|
|
94934
|
+
const span = node;
|
|
94935
|
+
const name = span.getAttribute("data-default-name") || "";
|
|
94936
|
+
const refId = span.getAttribute("data-ref-id") || "";
|
|
94937
|
+
if (name && refId) {
|
|
94938
|
+
const box = {
|
|
94939
|
+
id: genId(),
|
|
94940
|
+
type: "mention",
|
|
94941
|
+
box: true,
|
|
94942
|
+
created: Date.now(),
|
|
94943
|
+
iconUrl: "",
|
|
94944
|
+
text: name,
|
|
94945
|
+
mentionId: refId
|
|
94946
|
+
};
|
|
94947
|
+
const text2 = [
|
|
94948
|
+
{
|
|
94949
|
+
insert: " ",
|
|
94950
|
+
attributes: box
|
|
94951
|
+
}
|
|
94952
|
+
];
|
|
94953
|
+
const obj = {
|
|
94954
|
+
text: text2
|
|
94955
|
+
};
|
|
94956
|
+
const base64 = toBase64URL(JSON.stringify(obj));
|
|
94957
|
+
return `[[${base64}]]`;
|
|
94958
|
+
}
|
|
94959
|
+
return name;
|
|
94960
|
+
}
|
|
94961
|
+
};
|
|
94962
|
+
function convertMentionToCkeMention(editor, boxData, doc2, type) {
|
|
94963
|
+
const data2 = boxData;
|
|
94964
|
+
if (type === "html") {
|
|
94965
|
+
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>`;
|
|
94966
|
+
}
|
|
94967
|
+
return `@${data2.text}`;
|
|
94968
|
+
}
|
|
94969
|
+
function patchMentionConverter(editor) {
|
|
94970
|
+
const mentionBox = editor.editorBoxes.getBoxClass("mention");
|
|
94971
|
+
if (mentionBox) {
|
|
94972
|
+
const oldConvertTo = mentionBox.convertTo;
|
|
94973
|
+
if (oldConvertTo !== convertMentionToCkeMention) {
|
|
94974
|
+
mentionBox.convertTo = convertMentionToCkeMention;
|
|
94975
|
+
}
|
|
94976
|
+
}
|
|
94977
|
+
}
|
|
94978
|
+
function processLinks(doc2) {
|
|
94979
|
+
const containers = doc2.blocks;
|
|
94980
|
+
Object.values(containers).forEach((blocks) => {
|
|
94981
|
+
blocks.forEach((block) => {
|
|
94982
|
+
if (block.text) {
|
|
94983
|
+
const text2 = block.text;
|
|
94984
|
+
text2.forEach((op) => {
|
|
94985
|
+
const attributes = op.attributes;
|
|
94986
|
+
if (attributes) {
|
|
94987
|
+
attributes.link;
|
|
94988
|
+
}
|
|
94989
|
+
});
|
|
94990
|
+
}
|
|
94991
|
+
});
|
|
94992
|
+
});
|
|
94993
|
+
}
|
|
94994
|
+
const CkeMarkdownConverter = {
|
|
94995
|
+
filter: (node) => {
|
|
94996
|
+
if (node.nodeName !== "DIV") {
|
|
94997
|
+
return false;
|
|
94998
|
+
}
|
|
94999
|
+
const div = node;
|
|
95000
|
+
return hasClass(div, "ones-marked-card");
|
|
95001
|
+
},
|
|
95002
|
+
replacement: (content, node) => {
|
|
95003
|
+
const textToCodeBlock2 = (text2, language) => {
|
|
95004
|
+
const codeBlocks = text2.split("\n").map((line) => {
|
|
95005
|
+
const block = {
|
|
95006
|
+
type: "text",
|
|
95007
|
+
id: genId(),
|
|
95008
|
+
text: createRichText(line)
|
|
95009
|
+
};
|
|
95010
|
+
return block;
|
|
95011
|
+
});
|
|
95012
|
+
const containerId = genId();
|
|
95013
|
+
const doc22 = {
|
|
95014
|
+
blocks: {
|
|
95015
|
+
root: [
|
|
95016
|
+
{
|
|
95017
|
+
id: genId(),
|
|
95018
|
+
type: "code",
|
|
95019
|
+
language,
|
|
95020
|
+
children: [containerId]
|
|
95021
|
+
}
|
|
95022
|
+
],
|
|
95023
|
+
[containerId]: codeBlocks
|
|
95024
|
+
},
|
|
95025
|
+
meta: {},
|
|
95026
|
+
comments: {}
|
|
95027
|
+
};
|
|
95028
|
+
return toBase64URL(JSON.stringify(doc22));
|
|
95029
|
+
};
|
|
95030
|
+
const nodeToCodeBlock2 = (node2, lang) => {
|
|
95031
|
+
const text2 = node2.textContent || "";
|
|
95032
|
+
return textToCodeBlock2(text2, lang);
|
|
95033
|
+
};
|
|
95034
|
+
const doc2 = nodeToCodeBlock2(node, "markdown");
|
|
95035
|
+
const fence = "```";
|
|
95036
|
+
return "\n\n" + fence + "\n" + doc2 + "\n" + fence + "\n\n";
|
|
95037
|
+
}
|
|
95038
|
+
};
|
|
95039
|
+
registerCKEHtmlConvert("image", CkeImageConverter);
|
|
95040
|
+
registerCKEHtmlConvert("comment", CkeCommentConverter);
|
|
95041
|
+
registerCKEHtmlConvert("mention", CkeMentionConverter);
|
|
95042
|
+
registerCKEHtmlConvert("markdown", CkeMarkdownConverter);
|
|
95043
|
+
function ckeHtml2Doc(html) {
|
|
95044
|
+
const doc2 = htmlToDoc(html) || createEmptyDoc$1();
|
|
95045
|
+
processCkeCommentsLink(doc2);
|
|
95046
|
+
processLinks(doc2);
|
|
95047
|
+
return doc2;
|
|
95048
|
+
}
|
|
95049
|
+
function injectDocToCkeHtmlFragment(htmlFragment, doc2, text2) {
|
|
95050
|
+
const meta = `<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${toBase64URL(
|
|
95051
|
+
JSON.stringify(doc2)
|
|
95052
|
+
)}::ones-editor-doc" />`;
|
|
95053
|
+
let textMeta = "";
|
|
95054
|
+
if (text2) {
|
|
95055
|
+
textMeta = `<meta name="ones-editor-text" content="${toBase64URL(text2)}" />`;
|
|
95056
|
+
}
|
|
95057
|
+
const html = `<!doctype html><html><head>${meta}${textMeta}</head><body>${htmlFragment}</body></html>`;
|
|
95058
|
+
return html;
|
|
95059
|
+
}
|
|
95060
|
+
function editorToCKEHtml(editor) {
|
|
95061
|
+
patchMentionConverter(editor);
|
|
95062
|
+
const docObject = editor.doc.toJSON();
|
|
95063
|
+
if (isEmptyDoc(docObject)) {
|
|
95064
|
+
return "";
|
|
95065
|
+
}
|
|
95066
|
+
let html = docToHtmlFragment(editor, docObject);
|
|
95067
|
+
const text2 = docToText(editor, docObject);
|
|
95068
|
+
html = injectDocToCkeHtmlFragment(html, docObject, text2);
|
|
95069
|
+
return html;
|
|
95070
|
+
}
|
|
95071
|
+
function combineDoc(doc1, doc2) {
|
|
95072
|
+
if (isEmptyDoc(doc1)) {
|
|
95073
|
+
return doc2;
|
|
95074
|
+
}
|
|
95075
|
+
if (isEmptyDoc(doc2)) {
|
|
95076
|
+
return doc1;
|
|
95077
|
+
}
|
|
95078
|
+
const splitterDoc = createEmptyDoc$1("", {
|
|
95079
|
+
firstLineAsTitle: false
|
|
95080
|
+
});
|
|
95081
|
+
return mergeDocs([doc1, splitterDoc, doc2]);
|
|
95082
|
+
}
|
|
95083
|
+
function mergeHTMLBodiesOnly(htmlA, htmlB) {
|
|
95084
|
+
const parser = new DOMParser();
|
|
95085
|
+
const docA = parser.parseFromString(htmlA, "text/html");
|
|
95086
|
+
const docB = parser.parseFromString(htmlB, "text/html");
|
|
95087
|
+
const mergedDoc = document.implementation.createHTMLDocument("Merged");
|
|
95088
|
+
const bodyA = docA.body;
|
|
95089
|
+
const bodyB = docB.body;
|
|
95090
|
+
const mergedBody = mergedDoc.body;
|
|
95091
|
+
Array.from(bodyA.childNodes).forEach((node) => {
|
|
95092
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95093
|
+
});
|
|
95094
|
+
Array.from(bodyB.childNodes).forEach((node) => {
|
|
95095
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95096
|
+
});
|
|
95097
|
+
return mergedBody.innerHTML;
|
|
95098
|
+
}
|
|
95099
|
+
function combineCkeHtml(html1, html2) {
|
|
95100
|
+
const doc1 = ckeHtml2Doc(html1);
|
|
95101
|
+
const doc2 = ckeHtml2Doc(html2);
|
|
95102
|
+
const newDoc = combineDoc(doc1, doc2);
|
|
95103
|
+
const newHtml = mergeHTMLBodiesOnly(html1, html2);
|
|
95104
|
+
const ret = injectDocToCkeHtmlFragment(newHtml, newDoc);
|
|
95105
|
+
return ret;
|
|
95106
|
+
}
|
|
95107
|
+
function combineRichTextValue(value1, value2) {
|
|
95108
|
+
return combineCkeHtml(value1, value2);
|
|
95109
|
+
}
|
|
94766
95110
|
const logger = getLogger("create-editor");
|
|
94767
95111
|
function getHooks(options, local) {
|
|
94768
95112
|
var _a;
|
|
@@ -95021,7 +95365,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95021
95365
|
}
|
|
95022
95366
|
}
|
|
95023
95367
|
});
|
|
95024
|
-
editor.version = "2.9.8-beta.
|
|
95368
|
+
editor.version = "2.9.8-beta.21";
|
|
95025
95369
|
return editor;
|
|
95026
95370
|
}
|
|
95027
95371
|
function isDoc(doc2) {
|
|
@@ -95153,7 +95497,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95153
95497
|
OnesEditorDropTarget.register(editor);
|
|
95154
95498
|
OnesEditorTocProvider.register(editor);
|
|
95155
95499
|
OnesEditorExclusiveBlock.register(editor);
|
|
95156
|
-
editor.version = "2.9.8-beta.
|
|
95500
|
+
editor.version = "2.9.8-beta.21";
|
|
95157
95501
|
return editor;
|
|
95158
95502
|
}
|
|
95159
95503
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -141255,12 +141599,15 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141255
141599
|
exports2.blockToText = blockToText;
|
|
141256
141600
|
exports2.blocksToDoc = blocksToDoc;
|
|
141257
141601
|
exports2.changeButtonName = changeButtonName;
|
|
141602
|
+
exports2.ckeHtml2Doc = ckeHtml2Doc;
|
|
141258
141603
|
exports2.clearAllSelection = clearAllSelection;
|
|
141259
141604
|
exports2.clientType = clientType;
|
|
141260
141605
|
exports2.cloneBlock = cloneBlock;
|
|
141261
141606
|
exports2.cloneChildContainer = cloneChildContainer;
|
|
141262
141607
|
exports2.cloneDoc = cloneDoc;
|
|
141263
141608
|
exports2.cloneText = cloneText;
|
|
141609
|
+
exports2.combineCkeHtml = combineCkeHtml;
|
|
141610
|
+
exports2.combineRichTextValue = combineRichTextValue;
|
|
141264
141611
|
exports2.commentToShareDbComment = commentToShareDbComment;
|
|
141265
141612
|
exports2.compareElement = compareElement;
|
|
141266
141613
|
exports2.comparePosition = comparePosition;
|
|
@@ -141416,6 +141763,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141416
141763
|
exports2.editorSelectWordLeft = editorSelectWordLeft;
|
|
141417
141764
|
exports2.editorSetTextColor = editorSetTextColor;
|
|
141418
141765
|
exports2.editorShowFindDialog = editorShowFindDialog;
|
|
141766
|
+
exports2.editorToCKEHtml = editorToCKEHtml;
|
|
141419
141767
|
exports2.editorToDocx = editorToDocx;
|
|
141420
141768
|
exports2.editorUpdateBlockData = editorUpdateBlockData;
|
|
141421
141769
|
exports2.editorUpdateCompositionText = editorUpdateCompositionText;
|
|
@@ -141582,6 +141930,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141582
141930
|
exports2.i18n = i18n$1;
|
|
141583
141931
|
exports2.includeBigTable = includeBigTable;
|
|
141584
141932
|
exports2.injectBlockOptions = injectBlockOptions;
|
|
141933
|
+
exports2.injectDocToCkeHtmlFragment = injectDocToCkeHtmlFragment;
|
|
141585
141934
|
exports2.injectDocToHtmlFragment = injectDocToHtmlFragment;
|
|
141586
141935
|
exports2.injectSource = injectSource;
|
|
141587
141936
|
exports2.injectStyle = injectStyle;
|