@ones-editor/editor 5.0.8 → 5.0.9-beta.hotfix-release-7-77-0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@ones-editor/core/package.json +0 -3
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +0 -1
- package/@ones-editor/core/src/core/composition/index.d.ts +0 -2
- package/@ones-editor/main-toolbar/src/index.d.ts +0 -2
- package/@ones-editor/paste-special/src/paste-special-button.d.ts +1 -7
- package/@ones-editor/scroll-container/src/scroll-bar-handle.d.ts +1 -3
- package/@ones-editor/server-tools/package.json +1 -2
- package/@ones-editor/sharedb-doc/src/versions/version-ops.d.ts +5 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/package.json +0 -3
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +1 -2
- package/@ones-editor/ui-base/src/auto-suggest/editor-auto-suggest-menu.d.ts +0 -2
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +0 -9
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +0 -1
- package/@ones-editor/versions/src/index.d.ts +2 -0
- package/@ones-editor/versions/src/types.d.ts +2 -0
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +7 -6
- package/dist/index.js +281 -560
- package/package.json +1 -1
- package/@ones-editor/core/src/core/composition/focus-restoration.d.ts +0 -25
- package/@ones-editor/server-tools/src/to-markdown/embeds/markdown.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -26555,114 +26555,6 @@ var __publicField = (obj, key, value) => {
|
|
|
26555
26555
|
};
|
|
26556
26556
|
}
|
|
26557
26557
|
}
|
|
26558
|
-
const controllers = /* @__PURE__ */ new WeakMap();
|
|
26559
|
-
const noop$1 = () => {
|
|
26560
|
-
};
|
|
26561
|
-
class FocusRestoration {
|
|
26562
|
-
constructor(input2, restore) {
|
|
26563
|
-
__publicField(this, "generation", 0);
|
|
26564
|
-
__publicField(this, "owner", null);
|
|
26565
|
-
__publicField(this, "destroyed", false);
|
|
26566
|
-
__publicField(this, "activeScope");
|
|
26567
|
-
__publicField(this, "timers", /* @__PURE__ */ new Set());
|
|
26568
|
-
this.input = input2;
|
|
26569
|
-
this.restore = restore;
|
|
26570
|
-
controllers.set(input2, this);
|
|
26571
|
-
}
|
|
26572
|
-
canFocus() {
|
|
26573
|
-
var _a;
|
|
26574
|
-
return !this.destroyed && !this.owner && !((_a = this.activeScope) == null ? void 0 : _a.cancelled) && this.input.isConnected;
|
|
26575
|
-
}
|
|
26576
|
-
hasOtherInput() {
|
|
26577
|
-
const active = this.input.ownerDocument.activeElement;
|
|
26578
|
-
return active !== this.input && !!(active == null ? void 0 : active.matches('input, textarea, select, [contenteditable="true"], [contenteditable=""]'));
|
|
26579
|
-
}
|
|
26580
|
-
schedule(callback, delay = 0, protectUserFocus = false) {
|
|
26581
|
-
var _a;
|
|
26582
|
-
return this.scheduleInScope(callback, delay, protectUserFocus, (_a = this.activeScope) != null ? _a : this.createScope());
|
|
26583
|
-
}
|
|
26584
|
-
createScope() {
|
|
26585
|
-
return { cancelled: false, timers: /* @__PURE__ */ new Set() };
|
|
26586
|
-
}
|
|
26587
|
-
scheduleInScope(callback, delay, protectUserFocus, scope) {
|
|
26588
|
-
if (scope.cancelled || !this.canFocus()) {
|
|
26589
|
-
return noop$1;
|
|
26590
|
-
}
|
|
26591
|
-
const generation = this.generation;
|
|
26592
|
-
const timer = setTimeout(() => {
|
|
26593
|
-
this.timers.delete(timer);
|
|
26594
|
-
scope.timers.delete(timer);
|
|
26595
|
-
if (!scope.cancelled && generation === this.generation && this.canFocus() && (!protectUserFocus || !this.hasOtherInput())) {
|
|
26596
|
-
const previousScope = this.activeScope;
|
|
26597
|
-
this.activeScope = scope;
|
|
26598
|
-
try {
|
|
26599
|
-
callback();
|
|
26600
|
-
} finally {
|
|
26601
|
-
this.activeScope = previousScope;
|
|
26602
|
-
}
|
|
26603
|
-
}
|
|
26604
|
-
}, delay);
|
|
26605
|
-
this.timers.add(timer);
|
|
26606
|
-
scope.timers.add(timer);
|
|
26607
|
-
return () => {
|
|
26608
|
-
scope.cancelled = true;
|
|
26609
|
-
scope.timers.forEach((pending) => {
|
|
26610
|
-
clearTimeout(pending);
|
|
26611
|
-
this.timers.delete(pending);
|
|
26612
|
-
});
|
|
26613
|
-
scope.timers.clear();
|
|
26614
|
-
};
|
|
26615
|
-
}
|
|
26616
|
-
request(delay = 0) {
|
|
26617
|
-
return this.scheduleInScope(this.restore, delay, !clientType.isMobile, this.createScope());
|
|
26618
|
-
}
|
|
26619
|
-
cancelPending() {
|
|
26620
|
-
if (this.activeScope) {
|
|
26621
|
-
this.activeScope.cancelled = true;
|
|
26622
|
-
}
|
|
26623
|
-
this.generation += 1;
|
|
26624
|
-
this.timers.forEach((timer) => clearTimeout(timer));
|
|
26625
|
-
this.timers.clear();
|
|
26626
|
-
}
|
|
26627
|
-
acquire() {
|
|
26628
|
-
this.cancelPending();
|
|
26629
|
-
const owner = {};
|
|
26630
|
-
this.owner = owner;
|
|
26631
|
-
return () => {
|
|
26632
|
-
if (this.owner === owner) {
|
|
26633
|
-
this.cancelPending();
|
|
26634
|
-
this.owner = null;
|
|
26635
|
-
}
|
|
26636
|
-
};
|
|
26637
|
-
}
|
|
26638
|
-
destroy() {
|
|
26639
|
-
this.destroyed = true;
|
|
26640
|
-
this.cancelPending();
|
|
26641
|
-
this.owner = null;
|
|
26642
|
-
controllers.delete(this.input);
|
|
26643
|
-
}
|
|
26644
|
-
}
|
|
26645
|
-
function requestInputFocus(input2, delay = 0) {
|
|
26646
|
-
var _a, _b;
|
|
26647
|
-
return (_b = (_a = controllers.get(input2)) == null ? void 0 : _a.request(delay)) != null ? _b : noop$1;
|
|
26648
|
-
}
|
|
26649
|
-
function requestEditorFocus(editor, delay = 0) {
|
|
26650
|
-
if (editor.destroyed) {
|
|
26651
|
-
return noop$1;
|
|
26652
|
-
}
|
|
26653
|
-
if (clientType.isMobile && delay === 0) {
|
|
26654
|
-
editor.focus();
|
|
26655
|
-
return noop$1;
|
|
26656
|
-
}
|
|
26657
|
-
return requestInputFocus(editor.input.inputElement, delay);
|
|
26658
|
-
}
|
|
26659
|
-
function acquireEditorFocus(editor) {
|
|
26660
|
-
var _a, _b;
|
|
26661
|
-
if (clientType.isMobile || editor.destroyed) {
|
|
26662
|
-
return noop$1;
|
|
26663
|
-
}
|
|
26664
|
-
return (_b = (_a = controllers.get(editor.input.inputElement)) == null ? void 0 : _a.acquire()) != null ? _b : noop$1;
|
|
26665
|
-
}
|
|
26666
26558
|
const logger$3W = getLogger("editor-input");
|
|
26667
26559
|
class EditorInput$1 {
|
|
26668
26560
|
constructor(editor, callbacks) {
|
|
@@ -26672,7 +26564,6 @@ var __publicField = (obj, key, value) => {
|
|
|
26672
26564
|
__publicField(this, "callbacks");
|
|
26673
26565
|
__publicField(this, "inputElement");
|
|
26674
26566
|
__publicField(this, "focused", false);
|
|
26675
|
-
__publicField(this, "focusRestoration");
|
|
26676
26567
|
__publicField(this, "handleBlur", () => {
|
|
26677
26568
|
this.editor.emit("blur", this.editor);
|
|
26678
26569
|
this.callbacks.onBlur();
|
|
@@ -26694,20 +26585,12 @@ var __publicField = (obj, key, value) => {
|
|
|
26694
26585
|
const isInDisableScrollMask = this.isInDisableScrollMask(target);
|
|
26695
26586
|
if (target && (isInDisableScrollMask || rootElement === target || rootElement.contains(target))) {
|
|
26696
26587
|
if (!isInDisableScrollMask && !isInBlockTools(target)) {
|
|
26697
|
-
|
|
26698
|
-
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26699
|
-
return;
|
|
26700
|
-
}
|
|
26588
|
+
setTimeout(() => {
|
|
26701
26589
|
this.editor.emit("focus", this.editor);
|
|
26702
26590
|
this.callbacks.onFocus();
|
|
26703
26591
|
this.editor.input.focus({ preventScroll: true });
|
|
26704
26592
|
this.focused = true;
|
|
26705
|
-
};
|
|
26706
|
-
if (clientType.isMobile) {
|
|
26707
|
-
setTimeout(focus);
|
|
26708
|
-
} else {
|
|
26709
|
-
this.focusRestoration.schedule(focus);
|
|
26710
|
-
}
|
|
26593
|
+
});
|
|
26711
26594
|
}
|
|
26712
26595
|
return;
|
|
26713
26596
|
}
|
|
@@ -26842,11 +26725,6 @@ var __publicField = (obj, key, value) => {
|
|
|
26842
26725
|
input2.addEventListener("compositionstart", this.handleCompositionstart);
|
|
26843
26726
|
input2.addEventListener("compositionend", this.handleCompositionend);
|
|
26844
26727
|
this.inputElement = input2;
|
|
26845
|
-
this.focusRestoration = new FocusRestoration(input2, () => {
|
|
26846
|
-
if (!this.editor.destroyed) {
|
|
26847
|
-
this.editor.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
26848
|
-
}
|
|
26849
|
-
});
|
|
26850
26728
|
if (clientType.isMobile) {
|
|
26851
26729
|
document.addEventListener("touchend", this.handleDocumentClick);
|
|
26852
26730
|
} else {
|
|
@@ -26869,7 +26747,6 @@ var __publicField = (obj, key, value) => {
|
|
|
26869
26747
|
return !!(elem == null ? void 0 : elem.closest("div[data-command-bar-id]")) || !!(elem == null ? void 0 : elem.closest("[data-keep-editor-focus]")) || !!(elem == null ? void 0 : elem.closest(".data-keep-editor-focus"));
|
|
26870
26748
|
}
|
|
26871
26749
|
destroy() {
|
|
26872
|
-
this.focusRestoration.destroy();
|
|
26873
26750
|
this.callbacks.destroy();
|
|
26874
26751
|
if (clientType.isMobile) {
|
|
26875
26752
|
document.removeEventListener("touchend", this.handleDocumentClick);
|
|
@@ -26894,36 +26771,24 @@ var __publicField = (obj, key, value) => {
|
|
|
26894
26771
|
return this.inputElement;
|
|
26895
26772
|
}
|
|
26896
26773
|
focus(options) {
|
|
26897
|
-
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26898
|
-
return;
|
|
26899
|
-
}
|
|
26900
26774
|
if (!this.editor.selection.caret.visible()) {
|
|
26901
26775
|
this.editor.selection.caret.update();
|
|
26902
26776
|
}
|
|
26903
26777
|
if (clientType.isMobile) {
|
|
26904
26778
|
this.inputElement.focus(options);
|
|
26905
26779
|
this.callbacks.onFocus();
|
|
26906
|
-
this.focused = true;
|
|
26907
26780
|
} else {
|
|
26908
|
-
|
|
26909
|
-
if (this.editor.destroyed) {
|
|
26910
|
-
return;
|
|
26911
|
-
}
|
|
26781
|
+
setTimeout(() => {
|
|
26912
26782
|
if (document.activeElement !== this.inputElement) {
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
this.editor.emit("focus", this.editor);
|
|
26916
|
-
}
|
|
26783
|
+
setTimeout(() => {
|
|
26784
|
+
this.editor.emit("focus", this.editor);
|
|
26917
26785
|
});
|
|
26918
26786
|
}
|
|
26919
26787
|
this.inputElement.focus(options);
|
|
26920
|
-
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26921
|
-
return;
|
|
26922
|
-
}
|
|
26923
26788
|
this.callbacks.onFocus();
|
|
26924
|
-
|
|
26925
|
-
}, 0, (options == null ? void 0 : options.preventScroll) === true);
|
|
26789
|
+
});
|
|
26926
26790
|
}
|
|
26791
|
+
this.focused = true;
|
|
26927
26792
|
}
|
|
26928
26793
|
isInDisableScrollMask(target) {
|
|
26929
26794
|
let elem = target;
|
|
@@ -30100,7 +29965,7 @@ var __publicField = (obj, key, value) => {
|
|
|
30100
29965
|
});
|
|
30101
29966
|
return true;
|
|
30102
29967
|
}
|
|
30103
|
-
function defaultGetResourceFromBlock(editor, block, resources) {
|
|
29968
|
+
function defaultGetResourceFromBlock(editor, doc2, block, resources) {
|
|
30104
29969
|
if (block.type === "embed") {
|
|
30105
29970
|
const embedData = block.embedData;
|
|
30106
29971
|
if (block.embedType === WIKI_MACRO_TYPE) {
|
|
@@ -30141,23 +30006,43 @@ var __publicField = (obj, key, value) => {
|
|
|
30141
30006
|
}
|
|
30142
30007
|
});
|
|
30143
30008
|
}
|
|
30144
|
-
|
|
30145
|
-
|
|
30146
|
-
|
|
30147
|
-
|
|
30148
|
-
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
|
|
30152
|
-
defaultGetResourceFromBlock(editor, block, resources);
|
|
30009
|
+
const children = block.children;
|
|
30010
|
+
if (children) {
|
|
30011
|
+
children.forEach((childContainerId) => {
|
|
30012
|
+
const blocks = doc2.blocks[childContainerId];
|
|
30013
|
+
blocks.forEach((b) => {
|
|
30014
|
+
defaultGetResourceFromBlock(editor, doc2, b, resources);
|
|
30015
|
+
});
|
|
30016
|
+
});
|
|
30153
30017
|
}
|
|
30154
|
-
(_b = block.children) == null ? void 0 : _b.forEach((containerId) => {
|
|
30155
|
-
doc2.blocks[containerId].forEach((child) => getResourcesFromBlock(editor, doc2, child, resources));
|
|
30156
|
-
});
|
|
30157
30018
|
}
|
|
30158
30019
|
function getAllResourcesFromDoc(editor, doc2) {
|
|
30159
30020
|
const resources = /* @__PURE__ */ new Set();
|
|
30160
|
-
doc2.blocks.root
|
|
30021
|
+
const blocks = doc2.blocks.root;
|
|
30022
|
+
blocks.forEach((block) => {
|
|
30023
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30024
|
+
if (blockClass.getResources) {
|
|
30025
|
+
const ret = blockClass.getResources(editor, block);
|
|
30026
|
+
if (ret) {
|
|
30027
|
+
ret.forEach((resource) => {
|
|
30028
|
+
resources.add(resource);
|
|
30029
|
+
});
|
|
30030
|
+
const children = block.children;
|
|
30031
|
+
if (children) {
|
|
30032
|
+
children.forEach((childContainerId) => {
|
|
30033
|
+
const blocks2 = doc2.blocks[childContainerId];
|
|
30034
|
+
blocks2.forEach((b) => {
|
|
30035
|
+
defaultGetResourceFromBlock(editor, doc2, b, resources);
|
|
30036
|
+
});
|
|
30037
|
+
});
|
|
30038
|
+
}
|
|
30039
|
+
} else {
|
|
30040
|
+
defaultGetResourceFromBlock(editor, doc2, block, resources);
|
|
30041
|
+
}
|
|
30042
|
+
} else {
|
|
30043
|
+
defaultGetResourceFromBlock(editor, doc2, block, resources);
|
|
30044
|
+
}
|
|
30045
|
+
});
|
|
30161
30046
|
return Array.from(resources);
|
|
30162
30047
|
}
|
|
30163
30048
|
function injectDocToHtmlFragment(htmlFragment, doc2) {
|
|
@@ -30470,14 +30355,8 @@ ${codeText}
|
|
|
30470
30355
|
}
|
|
30471
30356
|
return true;
|
|
30472
30357
|
}
|
|
30473
|
-
function defaultReplaceBlockResources(
|
|
30474
|
-
var _a;
|
|
30358
|
+
function defaultReplaceBlockResources(doc2, block, resources) {
|
|
30475
30359
|
if (block.type === "embed") {
|
|
30476
|
-
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30477
|
-
const declaredResources = (_a = blockClass.getResources) == null ? void 0 : _a.call(blockClass, editor, block);
|
|
30478
|
-
if (declaredResources && declaredResources.length === 0) {
|
|
30479
|
-
return;
|
|
30480
|
-
}
|
|
30481
30360
|
const embedData = block.embedData;
|
|
30482
30361
|
if (block.embedType === WIKI_MACRO_TYPE) {
|
|
30483
30362
|
replaceWikiMacroResources(embedData, resources);
|
|
@@ -30522,26 +30401,23 @@ ${codeText}
|
|
|
30522
30401
|
children.forEach((childContainerId) => {
|
|
30523
30402
|
const blocks = doc2.blocks[childContainerId];
|
|
30524
30403
|
blocks.forEach((b) => {
|
|
30525
|
-
|
|
30404
|
+
defaultReplaceBlockResources(doc2, b, resources);
|
|
30526
30405
|
});
|
|
30527
30406
|
});
|
|
30528
30407
|
}
|
|
30529
30408
|
}
|
|
30530
|
-
function replaceBlockResources(editor, doc2, block, resources) {
|
|
30531
|
-
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30532
|
-
if (blockClass.replaceResources) {
|
|
30533
|
-
blockClass.replaceResources(block, resources);
|
|
30534
|
-
} else {
|
|
30535
|
-
defaultReplaceBlockResources(editor, doc2, block, resources);
|
|
30536
|
-
}
|
|
30537
|
-
}
|
|
30538
30409
|
function replaceDocResources(editor, doc2, resources) {
|
|
30539
30410
|
if (resources.size === 0) {
|
|
30540
30411
|
return;
|
|
30541
30412
|
}
|
|
30542
30413
|
const blocks = doc2.blocks.root;
|
|
30543
30414
|
blocks.forEach((block) => {
|
|
30544
|
-
|
|
30415
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30416
|
+
if (blockClass.replaceResources) {
|
|
30417
|
+
blockClass.replaceResources(block, resources);
|
|
30418
|
+
} else {
|
|
30419
|
+
defaultReplaceBlockResources(doc2, block, resources);
|
|
30420
|
+
}
|
|
30545
30421
|
});
|
|
30546
30422
|
}
|
|
30547
30423
|
async function addLocalResourcesToDoc(editor, resources) {
|
|
@@ -32599,7 +32475,7 @@ ${codeText}
|
|
|
32599
32475
|
editor.doc.endBatchUpdate();
|
|
32600
32476
|
}
|
|
32601
32477
|
if (!clientType.isMobile) {
|
|
32602
|
-
|
|
32478
|
+
editor.focus();
|
|
32603
32479
|
}
|
|
32604
32480
|
return rangeResult;
|
|
32605
32481
|
});
|
|
@@ -38819,6 +38695,57 @@ ${codeText}
|
|
|
38819
38695
|
};
|
|
38820
38696
|
var Connection = connection;
|
|
38821
38697
|
var types = types$3;
|
|
38698
|
+
function getContainers(doc2) {
|
|
38699
|
+
return Object.fromEntries(Object.entries(doc2).filter(([, value]) => Array.isArray(value) && value.every((block) => block && typeof block === "object" && block.id && block.type)));
|
|
38700
|
+
}
|
|
38701
|
+
function replaceDocOp(before, after) {
|
|
38702
|
+
const oldContainers = getContainers(before);
|
|
38703
|
+
const newContainers = getContainers(after);
|
|
38704
|
+
let result = null;
|
|
38705
|
+
for (const containerId of /* @__PURE__ */ new Set([...Object.keys(oldContainers), ...Object.keys(newContainers)])) {
|
|
38706
|
+
const oldBlocks = oldContainers[containerId];
|
|
38707
|
+
const newBlocks = newContainers[containerId] || [];
|
|
38708
|
+
if (!oldBlocks) {
|
|
38709
|
+
result = json1__namespace.type.compose(result, json1__namespace.insertOp([containerId], newBlocks));
|
|
38710
|
+
continue;
|
|
38711
|
+
}
|
|
38712
|
+
for (let index2 = oldBlocks.length - 1; index2 >= 0; index2--) {
|
|
38713
|
+
result = json1__namespace.type.compose(result, json1__namespace.removeOp([containerId, index2]));
|
|
38714
|
+
}
|
|
38715
|
+
for (let index2 = 0; index2 < newBlocks.length; index2++) {
|
|
38716
|
+
result = json1__namespace.type.compose(result, json1__namespace.insertOp([containerId, index2], newBlocks[index2]));
|
|
38717
|
+
}
|
|
38718
|
+
}
|
|
38719
|
+
return result || [];
|
|
38720
|
+
}
|
|
38721
|
+
function parseVersionOps(data2, ops, from) {
|
|
38722
|
+
var _a;
|
|
38723
|
+
const createdDocIndex = findLastIndex__default.default(ops, (op) => !!op.create);
|
|
38724
|
+
if (from === void 0 || from <= 0 || createdDocIndex === -1) {
|
|
38725
|
+
const createdDoc = (_a = ops[createdDocIndex]) == null ? void 0 : _a.create;
|
|
38726
|
+
const doc22 = createdDoc ? createdDoc.data : JSON.parse(data2);
|
|
38727
|
+
return { doc: { ...doc22, blocks: doc22.blocks || [] }, ops: ops.slice(createdDocIndex + 1) };
|
|
38728
|
+
}
|
|
38729
|
+
const baseline = JSON.parse(data2);
|
|
38730
|
+
const doc2 = { ...baseline, blocks: baseline.blocks || [] };
|
|
38731
|
+
let current = doc2;
|
|
38732
|
+
const historyOps = [];
|
|
38733
|
+
for (const item of ops) {
|
|
38734
|
+
if (item.create) {
|
|
38735
|
+
const op = replaceDocOp(current, item.create.data);
|
|
38736
|
+
if (op.length) {
|
|
38737
|
+
const historyOp = { ...item, op };
|
|
38738
|
+
delete historyOp.create;
|
|
38739
|
+
historyOps.push(historyOp);
|
|
38740
|
+
}
|
|
38741
|
+
current = item.create.data;
|
|
38742
|
+
} else if (item.op) {
|
|
38743
|
+
historyOps.push(item);
|
|
38744
|
+
current = json1__namespace.type.apply(current, item.op);
|
|
38745
|
+
}
|
|
38746
|
+
}
|
|
38747
|
+
return { doc: doc2, ops: historyOps };
|
|
38748
|
+
}
|
|
38822
38749
|
const AuthError = {
|
|
38823
38750
|
err: 1001,
|
|
38824
38751
|
msg: "user auth error",
|
|
@@ -39535,27 +39462,7 @@ ${codeText}
|
|
|
39535
39462
|
api += `&from=${from}`;
|
|
39536
39463
|
}
|
|
39537
39464
|
const ret = await this.request(api);
|
|
39538
|
-
|
|
39539
|
-
const createdDocIndex = findLastIndex__default.default(ops, (op) => !!op.create);
|
|
39540
|
-
let createdDoc = null;
|
|
39541
|
-
if (createdDocIndex !== -1) {
|
|
39542
|
-
createdDoc = ops[createdDocIndex];
|
|
39543
|
-
ops.splice(0, createdDocIndex + 1);
|
|
39544
|
-
}
|
|
39545
|
-
let doc2;
|
|
39546
|
-
if (createdDoc) {
|
|
39547
|
-
assert(logger$30, createdDoc.create, "no createDoc.create");
|
|
39548
|
-
doc2 = createdDoc.create.data;
|
|
39549
|
-
} else {
|
|
39550
|
-
doc2 = JSON.parse(ret.data.data);
|
|
39551
|
-
}
|
|
39552
|
-
if (!doc2.blocks) {
|
|
39553
|
-
doc2.blocks = [];
|
|
39554
|
-
}
|
|
39555
|
-
return {
|
|
39556
|
-
doc: doc2,
|
|
39557
|
-
ops: ret.data.ops
|
|
39558
|
-
};
|
|
39465
|
+
return parseVersionOps(ret.data.data, ret.data.ops, from);
|
|
39559
39466
|
}
|
|
39560
39467
|
async updateVersionExtra(version, tagId, extra) {
|
|
39561
39468
|
const server = this.apiServer();
|
|
@@ -41423,27 +41330,7 @@ ${codeText}
|
|
|
41423
41330
|
api += `&from=${from}`;
|
|
41424
41331
|
}
|
|
41425
41332
|
const ret = await this.request(api);
|
|
41426
|
-
|
|
41427
|
-
const createdDocIndex = findLastIndex__default.default(ops, (op) => !!op.create);
|
|
41428
|
-
let createdDoc = null;
|
|
41429
|
-
if (createdDocIndex !== -1) {
|
|
41430
|
-
createdDoc = ops[createdDocIndex];
|
|
41431
|
-
ops.splice(0, createdDocIndex + 1);
|
|
41432
|
-
}
|
|
41433
|
-
let doc2;
|
|
41434
|
-
if (createdDoc) {
|
|
41435
|
-
assert(logger$2S, createdDoc.create, "no createDoc.create");
|
|
41436
|
-
doc2 = createdDoc.create.data;
|
|
41437
|
-
} else {
|
|
41438
|
-
doc2 = JSON.parse(ret.data.data);
|
|
41439
|
-
}
|
|
41440
|
-
if (!doc2.blocks) {
|
|
41441
|
-
doc2.blocks = [];
|
|
41442
|
-
}
|
|
41443
|
-
return {
|
|
41444
|
-
doc: doc2,
|
|
41445
|
-
ops: ret.data.ops
|
|
41446
|
-
};
|
|
41333
|
+
return parseVersionOps(ret.data.data, ret.data.ops, from);
|
|
41447
41334
|
}
|
|
41448
41335
|
async updateVersionExtra(version, tagId, extra) {
|
|
41449
41336
|
const server = this.apiServer();
|
|
@@ -42933,13 +42820,8 @@ ${codeText}
|
|
|
42933
42820
|
});
|
|
42934
42821
|
__publicField(this, "tippyInstance", null);
|
|
42935
42822
|
__publicField(this, "_target", null);
|
|
42936
|
-
__publicField(this, "cancelFocus");
|
|
42937
|
-
__publicField(this, "focusTimer", null);
|
|
42938
|
-
__publicField(this, "focusRestoreGeneration", 0);
|
|
42939
42823
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42940
42824
|
var _a;
|
|
42941
|
-
const focusOwner = this.getFocusOwner();
|
|
42942
|
-
focusOwner.clearFocusTimer();
|
|
42943
42825
|
let ret = false;
|
|
42944
42826
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42945
42827
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42947,16 +42829,23 @@ ${codeText}
|
|
|
42947
42829
|
if (ret) {
|
|
42948
42830
|
return ret;
|
|
42949
42831
|
}
|
|
42950
|
-
|
|
42951
|
-
|
|
42952
|
-
});
|
|
42953
|
-
__publicField(this, "handleFocusInteraction", (event) => {
|
|
42954
|
-
if (!this.isFocusOwner(event.target)) {
|
|
42955
|
-
this.clearFocusTimer();
|
|
42832
|
+
if (!this._target) {
|
|
42833
|
+
return ret;
|
|
42956
42834
|
}
|
|
42957
|
-
|
|
42958
|
-
|
|
42959
|
-
|
|
42835
|
+
const target = this._target;
|
|
42836
|
+
setTimeout(() => {
|
|
42837
|
+
const parentEditor = target.closest(".editor-root");
|
|
42838
|
+
if (parentEditor) {
|
|
42839
|
+
const input2 = parentEditor.querySelector(".editor-input");
|
|
42840
|
+
if (input2) {
|
|
42841
|
+
if (parentEditor.contains(document.activeElement)) {
|
|
42842
|
+
return;
|
|
42843
|
+
}
|
|
42844
|
+
input2.focus();
|
|
42845
|
+
}
|
|
42846
|
+
}
|
|
42847
|
+
}, 100);
|
|
42848
|
+
return ret;
|
|
42960
42849
|
});
|
|
42961
42850
|
__publicField(this, "setProps", (props) => {
|
|
42962
42851
|
var _a;
|
|
@@ -42964,61 +42853,8 @@ ${codeText}
|
|
|
42964
42853
|
});
|
|
42965
42854
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42966
42855
|
}
|
|
42967
|
-
getFocusOwner() {
|
|
42968
|
-
return this.closeable instanceof ManualCommandBar ? this.closeable.getFocusOwner() : this;
|
|
42969
|
-
}
|
|
42970
|
-
restoreFocusAfterClose(event) {
|
|
42971
|
-
if (!this._target) {
|
|
42972
|
-
return;
|
|
42973
|
-
}
|
|
42974
|
-
const target = this._target;
|
|
42975
|
-
const parentEditor = target.closest(".editor-root");
|
|
42976
|
-
if (!parentEditor || event && !this.isFocusOwner(event.target)) {
|
|
42977
|
-
return;
|
|
42978
|
-
}
|
|
42979
|
-
const generation = this.focusRestoreGeneration;
|
|
42980
|
-
document.addEventListener("mousedown", this.handleFocusInteraction, true);
|
|
42981
|
-
document.addEventListener("focusin", this.handleFocusInteraction, true);
|
|
42982
|
-
window.addEventListener("blur", this.handleWindowBlur);
|
|
42983
|
-
this.focusTimer = setTimeout(() => {
|
|
42984
|
-
if (generation !== this.focusRestoreGeneration) {
|
|
42985
|
-
return;
|
|
42986
|
-
}
|
|
42987
|
-
this.clearFocusTimer();
|
|
42988
|
-
const input2 = parentEditor.querySelector(".editor-input");
|
|
42989
|
-
if (this._target !== target || !target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected) || !document.hasFocus()) {
|
|
42990
|
-
return;
|
|
42991
|
-
}
|
|
42992
|
-
const activeElement = document.activeElement;
|
|
42993
|
-
if (parentEditor.contains(activeElement)) {
|
|
42994
|
-
return;
|
|
42995
|
-
}
|
|
42996
|
-
if (!activeElement || activeElement === document.body || activeElement === document.documentElement || this.isInCommandBar(activeElement)) {
|
|
42997
|
-
this.cancelFocus = requestInputFocus(input2);
|
|
42998
|
-
}
|
|
42999
|
-
}, 100);
|
|
43000
|
-
}
|
|
43001
|
-
isFocusOwner(target) {
|
|
43002
|
-
var _a;
|
|
43003
|
-
const parentEditor = (_a = this._target) == null ? void 0 : _a.closest(".editor-root");
|
|
43004
|
-
return target instanceof Node && (!!(parentEditor == null ? void 0 : parentEditor.contains(target)) || this.isInCommandBar(target));
|
|
43005
|
-
}
|
|
43006
|
-
clearFocusTimer() {
|
|
43007
|
-
var _a;
|
|
43008
|
-
this.focusRestoreGeneration += 1;
|
|
43009
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
43010
|
-
this.cancelFocus = void 0;
|
|
43011
|
-
if (this.focusTimer !== null) {
|
|
43012
|
-
clearTimeout(this.focusTimer);
|
|
43013
|
-
this.focusTimer = null;
|
|
43014
|
-
}
|
|
43015
|
-
document.removeEventListener("mousedown", this.handleFocusInteraction, true);
|
|
43016
|
-
document.removeEventListener("focusin", this.handleFocusInteraction, true);
|
|
43017
|
-
window.removeEventListener("blur", this.handleWindowBlur);
|
|
43018
|
-
}
|
|
43019
42856
|
manualShow(target, options) {
|
|
43020
42857
|
var _a, _b, _c, _d;
|
|
43021
|
-
this.getFocusOwner().clearFocusTimer();
|
|
43022
42858
|
this._target = target;
|
|
43023
42859
|
if (this.isVisible) {
|
|
43024
42860
|
return;
|
|
@@ -43067,9 +42903,6 @@ ${codeText}
|
|
|
43067
42903
|
}
|
|
43068
42904
|
close(reason, e2) {
|
|
43069
42905
|
var _a, _b;
|
|
43070
|
-
if (reason === "clickBackground" || reason && reason !== "cancelBar" && reason !== "clickItem") {
|
|
43071
|
-
this.clearFocusTimer();
|
|
43072
|
-
}
|
|
43073
42906
|
super.close(reason);
|
|
43074
42907
|
if (this.isVisible) {
|
|
43075
42908
|
if (e2) {
|
|
@@ -43080,12 +42913,10 @@ ${codeText}
|
|
|
43080
42913
|
}
|
|
43081
42914
|
}
|
|
43082
42915
|
destroy() {
|
|
43083
|
-
var _a
|
|
43084
|
-
this.clearFocusTimer();
|
|
42916
|
+
var _a;
|
|
43085
42917
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
43086
42918
|
this.tippyInstance = null;
|
|
43087
42919
|
super.destroy();
|
|
43088
|
-
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
43089
42920
|
}
|
|
43090
42921
|
getCommandBarRoot() {
|
|
43091
42922
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -45211,22 +45042,19 @@ ${codeText}
|
|
|
45211
45042
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
45212
45043
|
constructor(editor, editorOptions) {
|
|
45213
45044
|
super(editorOptions);
|
|
45214
|
-
__publicField(this, "cancelFocus");
|
|
45215
45045
|
__publicField(this, "handleClose", () => {
|
|
45216
|
-
var _a, _b
|
|
45217
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45046
|
+
var _a, _b;
|
|
45218
45047
|
if (shouldFocusToEditor(this.editor)) {
|
|
45219
|
-
this.
|
|
45048
|
+
this.editor.focus();
|
|
45220
45049
|
}
|
|
45221
|
-
(
|
|
45050
|
+
(_b = (_a = this.options).onClose) == null ? void 0 : _b.call(_a);
|
|
45222
45051
|
});
|
|
45223
45052
|
this.editor = editor;
|
|
45224
45053
|
this.editorOptions = editorOptions;
|
|
45225
45054
|
}
|
|
45226
45055
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
45227
|
-
var _a, _b
|
|
45228
|
-
(_a = this.
|
|
45229
|
-
if (((_c = (_b = this.editorOptions).onShow) == null ? void 0 : _c.call(_b, this, containerId, blockIndex, offset)) === false) {
|
|
45056
|
+
var _a, _b;
|
|
45057
|
+
if (((_b = (_a = this.editorOptions).onShow) == null ? void 0 : _b.call(_a, this, containerId, blockIndex, offset)) === false) {
|
|
45230
45058
|
return;
|
|
45231
45059
|
}
|
|
45232
45060
|
if (this.options.showLoading) {
|
|
@@ -45244,11 +45072,6 @@ ${codeText}
|
|
|
45244
45072
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
45245
45073
|
super.popup(anchor2, { noEvent: true });
|
|
45246
45074
|
}
|
|
45247
|
-
destroy() {
|
|
45248
|
-
var _a;
|
|
45249
|
-
super.destroy();
|
|
45250
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45251
|
-
}
|
|
45252
45075
|
}
|
|
45253
45076
|
const logger$2H = getLogger("auto-suggest-menu");
|
|
45254
45077
|
class OnesEditorAutoSuggest {
|
|
@@ -49125,8 +48948,6 @@ ${codeText}
|
|
|
49125
48948
|
}
|
|
49126
48949
|
function resetScrollbarCore(scrollCore, scrollWrap) {
|
|
49127
48950
|
const scrollContainer = getScrollContainer(scrollWrap);
|
|
49128
|
-
if (!scrollContainer || !getContainerOption(scrollCore, getContainer(scrollContainer)))
|
|
49129
|
-
return;
|
|
49130
48951
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
49131
48952
|
const { scrollWidth, clientWidth } = getElementScrollSize(scrollContainer);
|
|
49132
48953
|
const { paddingLeft, paddingRight } = getScrollWrapPaddingSize(scrollWrap);
|
|
@@ -49143,7 +48964,7 @@ ${codeText}
|
|
|
49143
48964
|
}
|
|
49144
48965
|
function debounceByArgs(func, wait) {
|
|
49145
48966
|
const debouncers = /* @__PURE__ */ new Map();
|
|
49146
|
-
|
|
48967
|
+
return function(...args) {
|
|
49147
48968
|
var _a;
|
|
49148
48969
|
const scrollWrap = args[1];
|
|
49149
48970
|
let key = (scrollWrap == null ? void 0 : scrollWrap.genId) || "";
|
|
@@ -49155,30 +48976,17 @@ ${codeText}
|
|
|
49155
48976
|
if (!debouncers.has(key)) {
|
|
49156
48977
|
debouncers.set(key, debounce__default.default(
|
|
49157
48978
|
(...innerArgs) => {
|
|
49158
|
-
|
|
49159
|
-
|
|
49160
|
-
|
|
49161
|
-
|
|
49162
|
-
|
|
49163
|
-
debouncers.delete(key);
|
|
49164
|
-
}
|
|
48979
|
+
const result = func.apply(this, innerArgs);
|
|
48980
|
+
if (scrollWrap)
|
|
48981
|
+
scrollWrap.genId = void 0;
|
|
48982
|
+
debouncers.delete(key);
|
|
48983
|
+
return result;
|
|
49165
48984
|
},
|
|
49166
48985
|
wait
|
|
49167
48986
|
));
|
|
49168
48987
|
}
|
|
49169
48988
|
return (_a = debouncers.get(key)) == null ? void 0 : _a.apply(this, args);
|
|
49170
48989
|
};
|
|
49171
|
-
debounced.cancel = (scrollWrap) => {
|
|
49172
|
-
var _a, _b;
|
|
49173
|
-
const target = scrollWrap;
|
|
49174
|
-
const key = target.genId;
|
|
49175
|
-
if (!key)
|
|
49176
|
-
return;
|
|
49177
|
-
(_b = (_a = debouncers.get(key)) == null ? void 0 : _a.cancel) == null ? void 0 : _b.call(_a);
|
|
49178
|
-
debouncers.delete(key);
|
|
49179
|
-
target.genId = void 0;
|
|
49180
|
-
};
|
|
49181
|
-
return debounced;
|
|
49182
48990
|
}
|
|
49183
48991
|
const resetScrollbar = debounceByArgs(resetScrollbarCore, 50);
|
|
49184
48992
|
function resetScrollbarLeft(scrollContainer, scrollbarContainer) {
|
|
@@ -49673,7 +49481,6 @@ ${codeText}
|
|
|
49673
49481
|
}
|
|
49674
49482
|
unbindCore(scrollContainer, scrollWrap) {
|
|
49675
49483
|
var _a, _b, _c, _d, _e, _f;
|
|
49676
|
-
resetScrollbar.cancel(scrollWrap);
|
|
49677
49484
|
if (!this.boundContainers.delete(scrollContainer))
|
|
49678
49485
|
return;
|
|
49679
49486
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
@@ -54606,7 +54413,6 @@ ${codeText}
|
|
|
54606
54413
|
});
|
|
54607
54414
|
__publicField(this, "close", () => {
|
|
54608
54415
|
this.linkPopup.close("cancelBar");
|
|
54609
|
-
this.emit("close");
|
|
54610
54416
|
});
|
|
54611
54417
|
__publicField(this, "createItems", (content) => [{
|
|
54612
54418
|
id: "link-popup",
|
|
@@ -54628,6 +54434,7 @@ ${codeText}
|
|
|
54628
54434
|
this.emit("finished");
|
|
54629
54435
|
});
|
|
54630
54436
|
__publicField(this, "handleClose", () => {
|
|
54437
|
+
this.emit("close");
|
|
54631
54438
|
this.close();
|
|
54632
54439
|
});
|
|
54633
54440
|
__publicField(this, "handleShown", () => {
|
|
@@ -54656,13 +54463,8 @@ ${codeText}
|
|
|
54656
54463
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54657
54464
|
id: "link-popup",
|
|
54658
54465
|
header: this.createHeader(),
|
|
54659
|
-
disableSelectedScroll: true
|
|
54660
|
-
beforeClose: () => {
|
|
54661
|
-
this.handleClose();
|
|
54662
|
-
return true;
|
|
54663
|
-
}
|
|
54466
|
+
disableSelectedScroll: true
|
|
54664
54467
|
});
|
|
54665
|
-
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54666
54468
|
}
|
|
54667
54469
|
destroy() {
|
|
54668
54470
|
var _a, _b;
|
|
@@ -54681,11 +54483,11 @@ ${codeText}
|
|
|
54681
54483
|
this.emit("finished");
|
|
54682
54484
|
});
|
|
54683
54485
|
__publicField(this, "handleClose", () => {
|
|
54486
|
+
this.emit("close");
|
|
54684
54487
|
this.close();
|
|
54685
54488
|
});
|
|
54686
54489
|
__publicField(this, "close", () => {
|
|
54687
54490
|
this.linkPopup.close("cancelBar");
|
|
54688
|
-
this.emit("close");
|
|
54689
54491
|
});
|
|
54690
54492
|
__publicField(this, "disabledSubmit", () => {
|
|
54691
54493
|
var _a;
|
|
@@ -54705,13 +54507,8 @@ ${codeText}
|
|
|
54705
54507
|
this.content = content;
|
|
54706
54508
|
this.options = options;
|
|
54707
54509
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54708
|
-
id: "link-popup"
|
|
54709
|
-
beforeClose: () => {
|
|
54710
|
-
this.handleClose();
|
|
54711
|
-
return true;
|
|
54712
|
-
}
|
|
54510
|
+
id: "link-popup"
|
|
54713
54511
|
});
|
|
54714
|
-
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54715
54512
|
}
|
|
54716
54513
|
createPopupContent() {
|
|
54717
54514
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54744,85 +54541,46 @@ ${codeText}
|
|
|
54744
54541
|
__publicField(this, "onFinished", null);
|
|
54745
54542
|
__publicField(this, "onClose", null);
|
|
54746
54543
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54747
|
-
__publicField(this, "session", 0);
|
|
54748
|
-
__publicField(this, "submitting", false);
|
|
54749
|
-
__publicField(this, "focusTimer");
|
|
54750
|
-
__publicField(this, "releaseFocus");
|
|
54751
54544
|
__publicField(this, "handleOk", async () => {
|
|
54752
|
-
|
|
54753
|
-
return;
|
|
54754
|
-
}
|
|
54755
|
-
const session = this.session;
|
|
54756
|
-
const form = this.form;
|
|
54757
|
-
const onFinished = this.onFinished;
|
|
54758
|
-
const beforeFormatUrl = this.onBeforeFormatUrl;
|
|
54759
|
-
this.submitting = true;
|
|
54545
|
+
var _a;
|
|
54760
54546
|
try {
|
|
54761
|
-
await this.checkValue(
|
|
54762
|
-
|
|
54763
|
-
return;
|
|
54764
|
-
}
|
|
54765
|
-
const { linkText, linkUrl } = form;
|
|
54547
|
+
await this.checkValue();
|
|
54548
|
+
const { linkText, linkUrl } = this.form;
|
|
54766
54549
|
const inputValue = linkUrl.getInputValue();
|
|
54767
|
-
|
|
54768
|
-
|
|
54769
|
-
|
|
54770
|
-
|
|
54771
|
-
|
|
54550
|
+
let link2 = "";
|
|
54551
|
+
if (this.onBeforeFormatUrl && this.onBeforeFormatUrl(inputValue) !== false) {
|
|
54552
|
+
link2 = this.onBeforeFormatUrl(inputValue);
|
|
54553
|
+
} else {
|
|
54554
|
+
link2 = this.formatUrl(inputValue);
|
|
54772
54555
|
}
|
|
54556
|
+
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54773
54557
|
this._destroy();
|
|
54774
|
-
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54775
54558
|
} catch (error2) {
|
|
54776
|
-
if (this.isCurrent(session)) {
|
|
54777
|
-
this.submitting = false;
|
|
54778
|
-
}
|
|
54779
54559
|
}
|
|
54780
54560
|
});
|
|
54781
54561
|
__publicField(this, "handleClose", () => {
|
|
54782
|
-
|
|
54783
|
-
|
|
54784
|
-
}
|
|
54785
|
-
const onClose = this.onClose;
|
|
54562
|
+
var _a;
|
|
54563
|
+
(_a = this.onClose) == null ? void 0 : _a.call(this);
|
|
54786
54564
|
this._destroy();
|
|
54787
|
-
if (!this.editor.destroyed) {
|
|
54788
|
-
onClose == null ? void 0 : onClose();
|
|
54789
|
-
}
|
|
54790
54565
|
});
|
|
54791
54566
|
__publicField(this, "onShow", () => {
|
|
54792
|
-
|
|
54793
|
-
|
|
54794
|
-
|
|
54795
|
-
clearTimeout(this.focusTimer);
|
|
54796
|
-
this.focusTimer = setTimeout(() => {
|
|
54797
|
-
if (this.isCurrent(session) && (field == null ? void 0 : field.isConnected)) {
|
|
54798
|
-
field.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54799
|
-
}
|
|
54567
|
+
setTimeout(() => {
|
|
54568
|
+
var _a;
|
|
54569
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54800
54570
|
}, 400);
|
|
54801
54571
|
});
|
|
54802
54572
|
__publicField(this, "showPopup", (options) => {
|
|
54803
|
-
|
|
54573
|
+
var _a, _b, _c, _d, _e;
|
|
54804
54574
|
if (clientType.isMobile) {
|
|
54805
54575
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54806
54576
|
} else {
|
|
54807
54577
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54808
54578
|
}
|
|
54809
|
-
this.linkPopup.addListener("show",
|
|
54810
|
-
|
|
54811
|
-
|
|
54812
|
-
|
|
54813
|
-
|
|
54814
|
-
this.linkPopup.addListener("finished", () => {
|
|
54815
|
-
if (this.isCurrent(session)) {
|
|
54816
|
-
this.handleOk();
|
|
54817
|
-
}
|
|
54818
|
-
});
|
|
54819
|
-
this.linkPopup.addListener("close", () => {
|
|
54820
|
-
if (this.isCurrent(session)) {
|
|
54821
|
-
this.handleClose();
|
|
54822
|
-
}
|
|
54823
|
-
});
|
|
54824
|
-
this.linkPopup.disabledSubmit();
|
|
54825
|
-
this.linkPopup.manualShow();
|
|
54579
|
+
(_a = this.linkPopup) == null ? void 0 : _a.addListener("show", this.onShow);
|
|
54580
|
+
(_b = this.linkPopup) == null ? void 0 : _b.manualShow();
|
|
54581
|
+
(_c = this.linkPopup) == null ? void 0 : _c.disabledSubmit();
|
|
54582
|
+
(_d = this.linkPopup) == null ? void 0 : _d.addListener("finished", this.handleOk);
|
|
54583
|
+
(_e = this.linkPopup) == null ? void 0 : _e.addListener("close", this.handleClose);
|
|
54826
54584
|
});
|
|
54827
54585
|
__publicField(this, "onChange", () => {
|
|
54828
54586
|
var _a;
|
|
@@ -54834,14 +54592,11 @@ ${codeText}
|
|
|
54834
54592
|
return;
|
|
54835
54593
|
}
|
|
54836
54594
|
if (event.key === "Enter") {
|
|
54837
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(
|
|
54838
|
-
event.preventDefault();
|
|
54595
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54839
54596
|
event.stopPropagation();
|
|
54840
54597
|
return;
|
|
54841
54598
|
}
|
|
54842
54599
|
if (event.key === "Escape") {
|
|
54843
|
-
event.preventDefault();
|
|
54844
|
-
event.stopPropagation();
|
|
54845
54600
|
this.handleClose();
|
|
54846
54601
|
}
|
|
54847
54602
|
});
|
|
@@ -54855,18 +54610,13 @@ ${codeText}
|
|
|
54855
54610
|
return;
|
|
54856
54611
|
}
|
|
54857
54612
|
if (event.key === "Escape") {
|
|
54858
|
-
event.preventDefault();
|
|
54859
|
-
event.stopPropagation();
|
|
54860
54613
|
this.handleClose();
|
|
54861
54614
|
}
|
|
54862
54615
|
});
|
|
54863
54616
|
this.editor = editor;
|
|
54864
54617
|
}
|
|
54865
|
-
|
|
54866
|
-
|
|
54867
|
-
}
|
|
54868
|
-
async checkValue(form) {
|
|
54869
|
-
const { linkUrl } = form;
|
|
54618
|
+
async checkValue() {
|
|
54619
|
+
const { linkUrl } = this.form;
|
|
54870
54620
|
if (!linkUrl.getInputValue()) {
|
|
54871
54621
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54872
54622
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54884,20 +54634,14 @@ ${codeText}
|
|
|
54884
54634
|
return link2;
|
|
54885
54635
|
}
|
|
54886
54636
|
editLink(options) {
|
|
54887
|
-
this.
|
|
54888
|
-
if (this.editor.destroyed) {
|
|
54889
|
-
return;
|
|
54890
|
-
}
|
|
54891
|
-
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54637
|
+
this.showPopup(options);
|
|
54892
54638
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54893
54639
|
this.onFinished = onFinished;
|
|
54894
|
-
|
|
54895
|
-
|
|
54896
|
-
|
|
54897
|
-
|
|
54898
|
-
|
|
54899
|
-
this._destroy();
|
|
54900
|
-
throw error2;
|
|
54640
|
+
if (onClose) {
|
|
54641
|
+
this.onClose = onClose;
|
|
54642
|
+
}
|
|
54643
|
+
if (onBeforeFormatUrl) {
|
|
54644
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl;
|
|
54901
54645
|
}
|
|
54902
54646
|
}
|
|
54903
54647
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54926,21 +54670,12 @@ ${codeText}
|
|
|
54926
54670
|
return content;
|
|
54927
54671
|
}
|
|
54928
54672
|
_destroy() {
|
|
54929
|
-
|
|
54930
|
-
clearTimeout(this.focusTimer);
|
|
54931
|
-
this.focusTimer = void 0;
|
|
54932
|
-
const popup = this.linkPopup;
|
|
54933
|
-
const releaseFocus = this.releaseFocus;
|
|
54934
|
-
this.linkPopup = null;
|
|
54935
|
-
this.releaseFocus = void 0;
|
|
54936
|
-
this.submitting = false;
|
|
54673
|
+
var _a, _b;
|
|
54937
54674
|
this.onFinished = null;
|
|
54938
54675
|
this.onClose = null;
|
|
54939
|
-
this.onBeforeFormatUrl = null;
|
|
54940
54676
|
this.form = {};
|
|
54941
|
-
|
|
54942
|
-
|
|
54943
|
-
releaseFocus == null ? void 0 : releaseFocus();
|
|
54677
|
+
(_a = this.linkPopup) == null ? void 0 : _a.removeAllListeners();
|
|
54678
|
+
(_b = this.linkPopup) == null ? void 0 : _b.destroy();
|
|
54944
54679
|
}
|
|
54945
54680
|
destroy() {
|
|
54946
54681
|
this._destroy();
|
|
@@ -54980,14 +54715,14 @@ ${codeText}
|
|
|
54980
54715
|
const text2 = [op1, op2];
|
|
54981
54716
|
editor.insertTextToBlock(block, 0, text2);
|
|
54982
54717
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54983
|
-
|
|
54718
|
+
editor.focus();
|
|
54984
54719
|
} catch (error2) {
|
|
54985
54720
|
logger$21.error(error2);
|
|
54986
54721
|
}
|
|
54987
54722
|
});
|
|
54988
54723
|
};
|
|
54989
54724
|
const onClose = () => {
|
|
54990
|
-
|
|
54725
|
+
editor.focus();
|
|
54991
54726
|
};
|
|
54992
54727
|
editLink(editor, {
|
|
54993
54728
|
target: block,
|
|
@@ -55019,21 +54754,21 @@ ${codeText}
|
|
|
55019
54754
|
if (isCollapsed) {
|
|
55020
54755
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
55021
54756
|
editor.setBlockText(block, newText);
|
|
55022
|
-
|
|
54757
|
+
editor.focus();
|
|
55023
54758
|
return;
|
|
55024
54759
|
}
|
|
55025
54760
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
55026
54761
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
55027
54762
|
editor.setBlockText(block, newText);
|
|
55028
54763
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
55029
|
-
|
|
54764
|
+
editor.focus();
|
|
55030
54765
|
} catch (error2) {
|
|
55031
54766
|
logger$21.error(error2);
|
|
55032
54767
|
}
|
|
55033
54768
|
});
|
|
55034
54769
|
};
|
|
55035
54770
|
const onClose = () => {
|
|
55036
|
-
|
|
54771
|
+
editor.focus();
|
|
55037
54772
|
};
|
|
55038
54773
|
editLink(editor, {
|
|
55039
54774
|
target: anchor2,
|
|
@@ -55282,14 +55017,14 @@ ${codeText}
|
|
|
55282
55017
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
55283
55018
|
editor.setBlockText(block, newText);
|
|
55284
55019
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
55285
|
-
|
|
55020
|
+
editor.focus();
|
|
55286
55021
|
} catch (error2) {
|
|
55287
55022
|
logger$20.error(error2);
|
|
55288
55023
|
}
|
|
55289
55024
|
};
|
|
55290
55025
|
const onClose = () => {
|
|
55291
55026
|
editor.selection.selectBlock(block, range.end);
|
|
55292
|
-
|
|
55027
|
+
editor.focus();
|
|
55293
55028
|
};
|
|
55294
55029
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
55295
55030
|
if (!rect) {
|
|
@@ -55791,7 +55526,6 @@ ${codeText}
|
|
|
55791
55526
|
__publicField(this, "_disableTextToolbar", false);
|
|
55792
55527
|
__publicField(this, "_lastClickTime", 0);
|
|
55793
55528
|
__publicField(this, "_disabled", false);
|
|
55794
|
-
__publicField(this, "cancelFocus");
|
|
55795
55529
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55796
55530
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55797
55531
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55815,23 +55549,17 @@ ${codeText}
|
|
|
55815
55549
|
}
|
|
55816
55550
|
this._lastClickTime = Date.now();
|
|
55817
55551
|
});
|
|
55818
|
-
__publicField(this, "handleClose", (
|
|
55819
|
-
var _a
|
|
55820
|
-
if (toolbar2.closeReason === "clickBackground" || !this.editor.rootElement.isConnected) {
|
|
55821
|
-
return;
|
|
55822
|
-
}
|
|
55823
|
-
const focusedElement = document.activeElement;
|
|
55824
|
-
if (focusedElement && focusedElement !== document.body && focusedElement !== document.documentElement && !this.editor.rootElement.contains(focusedElement) && !toolbar2.isInCommandBar(focusedElement)) {
|
|
55825
|
-
return;
|
|
55826
|
-
}
|
|
55552
|
+
__publicField(this, "handleClose", () => {
|
|
55553
|
+
var _a;
|
|
55827
55554
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55828
55555
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55829
55556
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55830
55557
|
logger$1_.debug("focus is in block tools, ignore focus");
|
|
55831
55558
|
return;
|
|
55832
55559
|
}
|
|
55833
|
-
|
|
55834
|
-
|
|
55560
|
+
this.editor.focus({
|
|
55561
|
+
preventScroll: true
|
|
55562
|
+
});
|
|
55835
55563
|
}
|
|
55836
55564
|
});
|
|
55837
55565
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55960,10 +55688,8 @@ ${codeText}
|
|
|
55960
55688
|
this.toolbar.close("selectionChange");
|
|
55961
55689
|
}
|
|
55962
55690
|
destroy() {
|
|
55963
|
-
var _a;
|
|
55964
55691
|
this.unbindEvents();
|
|
55965
55692
|
this.toolbar.destroy();
|
|
55966
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55967
55693
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55968
55694
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55969
55695
|
}
|
|
@@ -74528,11 +74254,10 @@ ${codeText}
|
|
|
74528
74254
|
createTableBorderBar(editor, tableBlock);
|
|
74529
74255
|
}
|
|
74530
74256
|
function hideTableBorderBar(editor, tableBlock) {
|
|
74531
|
-
var _a, _b;
|
|
74532
74257
|
assert(logger$14, isTableBlock(tableBlock), "invalid table block");
|
|
74533
|
-
const tools = (
|
|
74258
|
+
const tools = getTableTools(editor, tableBlock);
|
|
74534
74259
|
const blockTools = getBlockTools(tableBlock);
|
|
74535
|
-
const topTableBorderBar =
|
|
74260
|
+
const topTableBorderBar = tools.querySelectorAll(".table-border-bar-container");
|
|
74536
74261
|
const leftTableBorderBar = blockTools.querySelectorAll(".table-border-bar-container");
|
|
74537
74262
|
topTableBorderBar.forEach((elem) => {
|
|
74538
74263
|
editor.domEvents.removeEventListener(elem, "click", handleBorderBarClicked);
|
|
@@ -76891,8 +76616,6 @@ ${codeText}
|
|
|
76891
76616
|
__publicField(this, "item");
|
|
76892
76617
|
__publicField(this, "docs", null);
|
|
76893
76618
|
__publicField(this, "checkedId");
|
|
76894
|
-
__publicField(this, "focusTimer", null);
|
|
76895
|
-
__publicField(this, "destroyed", false);
|
|
76896
76619
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76897
76620
|
if (!item.data) {
|
|
76898
76621
|
return;
|
|
@@ -76903,37 +76626,24 @@ ${codeText}
|
|
|
76903
76626
|
this.checkedId = item.id;
|
|
76904
76627
|
}
|
|
76905
76628
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76906
|
-
|
|
76907
|
-
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
76908
|
-
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
76909
|
-
this.focusTimer = setTimeout(() => {
|
|
76910
|
-
this.clearFocusTimer();
|
|
76911
|
-
if (!this.canRestoreFocus()) {
|
|
76912
|
-
return;
|
|
76913
|
-
}
|
|
76629
|
+
setTimeout(() => {
|
|
76914
76630
|
if (this.docs) {
|
|
76915
76631
|
this.show(this.docs);
|
|
76916
76632
|
}
|
|
76917
76633
|
this.editor.focus();
|
|
76918
76634
|
});
|
|
76919
76635
|
});
|
|
76920
|
-
__publicField(this, "handleClose", (
|
|
76921
|
-
|
|
76922
|
-
|
|
76636
|
+
__publicField(this, "handleClose", () => {
|
|
76637
|
+
const activeElem = document.activeElement;
|
|
76638
|
+
const tagName = activeElem ? activeElem.tagName.toLowerCase() : "";
|
|
76639
|
+
if (tagName === "input" || tagName === "textarea") {
|
|
76923
76640
|
return;
|
|
76924
76641
|
}
|
|
76925
|
-
|
|
76926
|
-
this.editor.focus();
|
|
76927
|
-
}
|
|
76642
|
+
this.editor.focus();
|
|
76928
76643
|
});
|
|
76929
76644
|
__publicField(this, "handleSelectionChange", () => {
|
|
76930
76645
|
if (this.toolbar.isVisible) {
|
|
76931
|
-
this.handleClose(
|
|
76932
|
-
}
|
|
76933
|
-
});
|
|
76934
|
-
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76935
|
-
if (!this.isFocusOwner(event.target)) {
|
|
76936
|
-
this.clearFocusTimer();
|
|
76646
|
+
this.handleClose();
|
|
76937
76647
|
}
|
|
76938
76648
|
});
|
|
76939
76649
|
this.editor = editor;
|
|
@@ -76957,10 +76667,6 @@ ${codeText}
|
|
|
76957
76667
|
this.toolbar.addListener("close", this.handleClose);
|
|
76958
76668
|
}
|
|
76959
76669
|
show(docs) {
|
|
76960
|
-
this.clearFocusTimer();
|
|
76961
|
-
if (this.destroyed || this.editor.destroyed) {
|
|
76962
|
-
return;
|
|
76963
|
-
}
|
|
76964
76670
|
this.docs = docs;
|
|
76965
76671
|
const editor = this.editor;
|
|
76966
76672
|
const range = editor.selection.range;
|
|
@@ -77019,39 +76725,13 @@ ${codeText}
|
|
|
77019
76725
|
return doc2;
|
|
77020
76726
|
}
|
|
77021
76727
|
hide() {
|
|
77022
|
-
this.clearFocusTimer();
|
|
77023
76728
|
this.toolbar.close("selectionChange");
|
|
77024
76729
|
}
|
|
77025
76730
|
clearCheckedState() {
|
|
77026
76731
|
this.checkedId = void 0;
|
|
77027
76732
|
}
|
|
77028
76733
|
destroy() {
|
|
77029
|
-
var _a;
|
|
77030
|
-
this.destroyed = true;
|
|
77031
|
-
this.clearFocusTimer();
|
|
77032
76734
|
this.toolbar.destroy();
|
|
77033
|
-
(_a = this.anchor) == null ? void 0 : _a.remove();
|
|
77034
|
-
this.anchor = null;
|
|
77035
|
-
this.docs = null;
|
|
77036
|
-
}
|
|
77037
|
-
canRestoreFocus() {
|
|
77038
|
-
var _a;
|
|
77039
|
-
if (this.destroyed || this.editor.destroyed || !this.editor.rootElement.isConnected || !((_a = this.anchor) == null ? void 0 : _a.isConnected)) {
|
|
77040
|
-
return false;
|
|
77041
|
-
}
|
|
77042
|
-
const activeElement = document.activeElement;
|
|
77043
|
-
return !activeElement || activeElement === document.body || this.isFocusOwner(activeElement);
|
|
77044
|
-
}
|
|
77045
|
-
isFocusOwner(target) {
|
|
77046
|
-
return target instanceof Node && (this.editor.rootElement.contains(target) || this.toolbar.isInCommandBar(target));
|
|
77047
|
-
}
|
|
77048
|
-
clearFocusTimer() {
|
|
77049
|
-
if (this.focusTimer !== null) {
|
|
77050
|
-
clearTimeout(this.focusTimer);
|
|
77051
|
-
this.focusTimer = null;
|
|
77052
|
-
}
|
|
77053
|
-
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
77054
|
-
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
77055
76735
|
}
|
|
77056
76736
|
getCommandItems(docs) {
|
|
77057
76737
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -83388,7 +83068,7 @@ ${docStr}
|
|
|
83388
83068
|
onSelectVersion(version);
|
|
83389
83069
|
});
|
|
83390
83070
|
__publicField(this, "handleEndEditItemMemo", (value, isCancel) => {
|
|
83391
|
-
var _a, _b, _c, _d;
|
|
83071
|
+
var _a, _b, _c, _d, _e;
|
|
83392
83072
|
const versionItem = (_a = this.memoInput) == null ? void 0 : _a.root.closest(".version-item");
|
|
83393
83073
|
if (this.isVersionElement(versionItem)) {
|
|
83394
83074
|
removeClass(versionItem, "editing");
|
|
@@ -83403,7 +83083,7 @@ ${docStr}
|
|
|
83403
83083
|
}
|
|
83404
83084
|
if (hasChanged) {
|
|
83405
83085
|
version.extra = { memo: filterValue2 };
|
|
83406
|
-
this.options.versionHelper.updateVersionExtra(version.version, version.tagId, version.extra).then(() => {
|
|
83086
|
+
(_d = this.options.versionHelper) == null ? void 0 : _d.updateVersionExtra(version.version, version.tagId, version.extra).then(() => {
|
|
83407
83087
|
var _a2, _b2;
|
|
83408
83088
|
(_b2 = (_a2 = this.options).onMemoChanged) == null ? void 0 : _b2.call(_a2, version);
|
|
83409
83089
|
});
|
|
@@ -83413,7 +83093,7 @@ ${docStr}
|
|
|
83413
83093
|
}
|
|
83414
83094
|
}
|
|
83415
83095
|
}
|
|
83416
|
-
(
|
|
83096
|
+
(_e = this.memoInput) == null ? void 0 : _e.root.remove();
|
|
83417
83097
|
});
|
|
83418
83098
|
__publicField(this, "handleRevert", (version, versionItem) => {
|
|
83419
83099
|
const { onRevert } = this.options;
|
|
@@ -83424,6 +83104,8 @@ ${docStr}
|
|
|
83424
83104
|
onCopyLink == null ? void 0 : onCopyLink(version);
|
|
83425
83105
|
});
|
|
83426
83106
|
__publicField(this, "handleFilterClick", (bar2, item) => {
|
|
83107
|
+
if (item.id === "memoed" && this.options.enableMemo === false)
|
|
83108
|
+
return;
|
|
83427
83109
|
let versions = this.options.versions;
|
|
83428
83110
|
if (item.id === "memoed") {
|
|
83429
83111
|
versions = versions.filter((v) => {
|
|
@@ -83434,7 +83116,7 @@ ${docStr}
|
|
|
83434
83116
|
const fragment = this.createVersionItems(versions, item.id);
|
|
83435
83117
|
this.versionsList.innerHTML = "";
|
|
83436
83118
|
this.versionsList.append(fragment);
|
|
83437
|
-
this.versionFilterToolbar.updateItems(VersionList.getFilterItems(item.id));
|
|
83119
|
+
this.versionFilterToolbar.updateItems(VersionList.getFilterItems(item.id, this.options.enableMemo));
|
|
83438
83120
|
this.updateHeaderCount(versions.length);
|
|
83439
83121
|
});
|
|
83440
83122
|
var _a;
|
|
@@ -83445,7 +83127,7 @@ ${docStr}
|
|
|
83445
83127
|
count: `${versions.length}`
|
|
83446
83128
|
});
|
|
83447
83129
|
createElement("span", ["version-count"], versionsListHeader, headerText);
|
|
83448
|
-
this.versionFilterToolbar = VersionList.createFilterToolbar(versionsListHeader);
|
|
83130
|
+
this.versionFilterToolbar = VersionList.createFilterToolbar(versionsListHeader, options.enableMemo);
|
|
83449
83131
|
this.versionFilterToolbar.addListener("click", this.handleFilterClick);
|
|
83450
83132
|
this.selectedVersion = options.selectedVersion || versions[0];
|
|
83451
83133
|
const versionsList = createElement("div", ["version-list-content"], null);
|
|
@@ -83459,14 +83141,14 @@ ${docStr}
|
|
|
83459
83141
|
(_a = this.options) == null ? void 0 : _a.onSelectVersion(activeVersion);
|
|
83460
83142
|
}
|
|
83461
83143
|
}
|
|
83462
|
-
static createFilterToolbar(parent) {
|
|
83144
|
+
static createFilterToolbar(parent, enableMemo = true) {
|
|
83463
83145
|
const filter = createElement("div", ["version-list-filter"], parent);
|
|
83464
|
-
const versionFilterToolbar = new FixedToolbar(filter, VersionList.getFilterItems("all"), {
|
|
83146
|
+
const versionFilterToolbar = new FixedToolbar(filter, VersionList.getFilterItems("all", enableMemo), {
|
|
83465
83147
|
tooltipId: "version-viewer"
|
|
83466
83148
|
});
|
|
83467
83149
|
return versionFilterToolbar;
|
|
83468
83150
|
}
|
|
83469
|
-
static getFilterItems(id) {
|
|
83151
|
+
static getFilterItems(id, enableMemo = true) {
|
|
83470
83152
|
return [
|
|
83471
83153
|
{
|
|
83472
83154
|
id: "filter",
|
|
@@ -83482,11 +83164,11 @@ ${docStr}
|
|
|
83482
83164
|
states: id === "all" ? ["checked"] : [],
|
|
83483
83165
|
name: t$1("version.filter.allVersions")
|
|
83484
83166
|
},
|
|
83485
|
-
{
|
|
83167
|
+
...enableMemo ? [{
|
|
83486
83168
|
id: "memoed",
|
|
83487
83169
|
states: id === "memoed" ? ["checked"] : [],
|
|
83488
83170
|
name: t$1("version.filter.memoVersions")
|
|
83489
|
-
}
|
|
83171
|
+
}] : []
|
|
83490
83172
|
]
|
|
83491
83173
|
}
|
|
83492
83174
|
];
|
|
@@ -83515,12 +83197,14 @@ ${docStr}
|
|
|
83515
83197
|
}
|
|
83516
83198
|
createElement("div", ["spacer"], title);
|
|
83517
83199
|
const actions2 = createElement("div", ["version-actions"], title);
|
|
83518
|
-
|
|
83519
|
-
|
|
83520
|
-
|
|
83521
|
-
|
|
83522
|
-
|
|
83523
|
-
|
|
83200
|
+
if (this.options.enableMemo !== false) {
|
|
83201
|
+
const addMemo = createIconButton(Edit2Icon, ["add-memo-button"], actions2);
|
|
83202
|
+
addMemo.setAttribute("data-editor-tooltip-common", t$1("version.memo"));
|
|
83203
|
+
if (!this.options.enableEdit) {
|
|
83204
|
+
addClass(addMemo, "disabled");
|
|
83205
|
+
const disabledTip = (_d = (_c = (_b = this.options).getDisabledTip) == null ? void 0 : _c.call(_b)) != null ? _d : i18n$1.t("version.tooltip.auth");
|
|
83206
|
+
addMemo.setAttribute("data-editor-tooltip-common", disabledTip);
|
|
83207
|
+
}
|
|
83524
83208
|
}
|
|
83525
83209
|
if (this.options.onCopyLink) {
|
|
83526
83210
|
const copyLink = createIconButton(LinkIcon, ["copy-link-button"], actions2);
|
|
@@ -83543,18 +83227,22 @@ ${docStr}
|
|
|
83543
83227
|
restoreFrom = t$1("version.restoreFrom", { from: fromVersionName });
|
|
83544
83228
|
}
|
|
83545
83229
|
createElement("div", ["version-item-restore-from"], item, restoreFrom);
|
|
83546
|
-
|
|
83230
|
+
if (this.options.enableMemo !== false) {
|
|
83231
|
+
createElement("div", ["version-item-memo"], item, ((_i = ver.extra) == null ? void 0 : _i.memo) || "");
|
|
83232
|
+
}
|
|
83547
83233
|
const info = createElement("div", ["version-item-info"], item);
|
|
83548
83234
|
createElement("li", ["version-item-time"], info, formatDate(new Date(ver.version), "YYYY-MM-DD hh:mm"));
|
|
83549
83235
|
const authors = createElement("ul", ["version-item-authors"], info);
|
|
83550
83236
|
const addUser = (user) => {
|
|
83237
|
+
var _a2, _b2, _c2;
|
|
83551
83238
|
const author = createElement("li", ["version-item-author"], authors);
|
|
83552
83239
|
const markAuthor = createElement("span", ["version-item-author-mark"], author);
|
|
83553
83240
|
markAuthor.style.background = this.options.getMarkColor(user);
|
|
83554
|
-
const
|
|
83241
|
+
const displayName = (_c2 = (_b2 = (_a2 = this.options).formatUserName) == null ? void 0 : _b2.call(_a2, user.displayName)) != null ? _c2 : user.displayName;
|
|
83242
|
+
const authorName = createElement("span", ["version-item-author-name"], author, displayName);
|
|
83555
83243
|
authorName.setAttribute(
|
|
83556
83244
|
"data-editor-tooltip-common",
|
|
83557
|
-
i18n$1.t("version.tooltip.user", { name:
|
|
83245
|
+
i18n$1.t("version.tooltip.user", { name: displayName })
|
|
83558
83246
|
);
|
|
83559
83247
|
};
|
|
83560
83248
|
if (this.options.useCreatedBy) {
|
|
@@ -83613,8 +83301,9 @@ ${docStr}
|
|
|
83613
83301
|
}
|
|
83614
83302
|
async editItemMemo(versionItem) {
|
|
83615
83303
|
var _a;
|
|
83616
|
-
|
|
83617
|
-
|
|
83304
|
+
if (this.options.enableMemo === false || !this.options.versionHelper)
|
|
83305
|
+
return;
|
|
83306
|
+
if (this.options.onBeforeEditMemo && !await this.options.onBeforeEditMemo()) {
|
|
83618
83307
|
return;
|
|
83619
83308
|
}
|
|
83620
83309
|
if (!this.memoInput) {
|
|
@@ -85084,7 +84773,7 @@ ${docStr}
|
|
|
85084
84773
|
};
|
|
85085
84774
|
}
|
|
85086
84775
|
renderContent(versions) {
|
|
85087
|
-
var _a, _b, _c, _d, _e, _f;
|
|
84776
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
85088
84777
|
const { listContainer: versionsListContainer } = this.components;
|
|
85089
84778
|
versionsListContainer.innerHTML = "";
|
|
85090
84779
|
const versionList2 = new VersionList({
|
|
@@ -85096,12 +84785,13 @@ ${docStr}
|
|
|
85096
84785
|
})),
|
|
85097
84786
|
versionHelper: this.versionHelper,
|
|
85098
84787
|
useCreatedBy: (_c = this.versionOptions) == null ? void 0 : _c.useCreatedBy,
|
|
84788
|
+
formatUserName: (_d = this.versionOptions) == null ? void 0 : _d.formatUserName,
|
|
85099
84789
|
onSelectVersion: this.handleSelectVersion,
|
|
85100
84790
|
onRevert: this.handleRevert,
|
|
85101
|
-
onCopyLink: ((
|
|
84791
|
+
onCopyLink: ((_e = this.versionOptions) == null ? void 0 : _e.onCopyVersionLink) ? this.handleCopyLink : void 0,
|
|
85102
84792
|
onMemoChanged: this.onMemoChanged,
|
|
85103
|
-
decorateItem: (
|
|
85104
|
-
onBeforeEditMemo: ((
|
|
84793
|
+
decorateItem: (_f = this.versionOptions) == null ? void 0 : _f.decorateItem,
|
|
84794
|
+
onBeforeEditMemo: ((_g = this.versionOptions) == null ? void 0 : _g.onBeforeEditMemo) || (async () => true),
|
|
85105
84795
|
getMarkColor: (user) => {
|
|
85106
84796
|
const { flag } = getUserColors(this.server.getRemoteUsers(), user);
|
|
85107
84797
|
return flag;
|
|
@@ -89042,8 +88732,6 @@ ${data2.flowchartText}
|
|
|
89042
88732
|
const SHOW_FULL_SCREEN_IFRAME = "show-full-screen-iframe";
|
|
89043
88733
|
const ERROR_DIALOG_ID = "draw-io-error-alert";
|
|
89044
88734
|
const logger$j = getLogger("embed-block-drawio");
|
|
89045
|
-
let currentAlertDialog = null;
|
|
89046
|
-
let isDirty = false;
|
|
89047
88735
|
function getDrawioOptions(editor) {
|
|
89048
88736
|
const compOptions = editor.options.componentsOptions;
|
|
89049
88737
|
return compOptions.drawIO || {};
|
|
@@ -89118,7 +88806,7 @@ ${data2.flowchartText}
|
|
|
89118
88806
|
exit
|
|
89119
88807
|
};
|
|
89120
88808
|
}
|
|
89121
|
-
async function saveSvgToBlock(editor, block, svg, autoSave) {
|
|
88809
|
+
async function saveSvgToBlock(editor, block, svg, autoSave, isActive) {
|
|
89122
88810
|
var _a, _b;
|
|
89123
88811
|
try {
|
|
89124
88812
|
if (autoSave) {
|
|
@@ -89131,9 +88819,16 @@ ${data2.flowchartText}
|
|
|
89131
88819
|
const file2 = new File([blob], "drawio.svg", {
|
|
89132
88820
|
type: "image/svg+xml"
|
|
89133
88821
|
});
|
|
89134
|
-
|
|
88822
|
+
let targetBlock = editor.findBlockById(getBlockId(block));
|
|
89135
88823
|
if (targetBlock) {
|
|
89136
88824
|
const res = await editor.doc.uploadResource(file2, { resourceType: "graph" });
|
|
88825
|
+
if (!isActive()) {
|
|
88826
|
+
return;
|
|
88827
|
+
}
|
|
88828
|
+
targetBlock = editor.findBlockById(getBlockId(block));
|
|
88829
|
+
if (!targetBlock) {
|
|
88830
|
+
return;
|
|
88831
|
+
}
|
|
89137
88832
|
const { resourceId } = res;
|
|
89138
88833
|
const oldData = editor.getBlockData(targetBlock);
|
|
89139
88834
|
const oldEmbedData = oldData.embedData;
|
|
@@ -89146,6 +88841,9 @@ ${data2.flowchartText}
|
|
|
89146
88841
|
logger$j.error("block has been deleted");
|
|
89147
88842
|
}
|
|
89148
88843
|
} catch (err) {
|
|
88844
|
+
if (!isActive()) {
|
|
88845
|
+
return;
|
|
88846
|
+
}
|
|
89149
88847
|
const message = `failed to save drawio data: ${err.message}`;
|
|
89150
88848
|
const options = getDrawioOptions(editor);
|
|
89151
88849
|
if ((_a = options.callbacks) == null ? void 0 : _a.onError) {
|
|
@@ -89170,8 +88868,25 @@ ${data2.flowchartText}
|
|
|
89170
88868
|
}
|
|
89171
88869
|
}
|
|
89172
88870
|
function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
|
|
89173
|
-
const
|
|
88871
|
+
const originalEmbedData = cloneDeep__default.default(editor.getBlockData(block).embedData);
|
|
88872
|
+
let closed = false;
|
|
88873
|
+
let currentAlertDialog = null;
|
|
88874
|
+
let isDirty = false;
|
|
88875
|
+
const isActive = () => !closed;
|
|
88876
|
+
const destroy = (discard = false) => {
|
|
88877
|
+
if (closed) {
|
|
88878
|
+
return;
|
|
88879
|
+
}
|
|
88880
|
+
closed = true;
|
|
88881
|
+
if (discard) {
|
|
88882
|
+
const targetBlock = editor.findBlockById(getBlockId(block));
|
|
88883
|
+
if (targetBlock) {
|
|
88884
|
+
editor.updateEmbedData(targetBlock, originalEmbedData);
|
|
88885
|
+
}
|
|
88886
|
+
}
|
|
89174
88887
|
window.removeEventListener("message", receive);
|
|
88888
|
+
currentAlertDialog == null ? void 0 : currentAlertDialog.destroy();
|
|
88889
|
+
currentAlertDialog = null;
|
|
89175
88890
|
exit();
|
|
89176
88891
|
};
|
|
89177
88892
|
const loadingHandler = new LoadingHandler();
|
|
@@ -89179,6 +88894,9 @@ ${data2.flowchartText}
|
|
|
89179
88894
|
let exportFlag = "auto";
|
|
89180
88895
|
const receive = async (evt) => {
|
|
89181
88896
|
var _a, _b;
|
|
88897
|
+
if (closed) {
|
|
88898
|
+
return;
|
|
88899
|
+
}
|
|
89182
88900
|
assert(logger$j, iframe.contentWindow, "iframe.contentWindow does not exist");
|
|
89183
88901
|
if (evt.data.length > 0) {
|
|
89184
88902
|
const msg = JSON.parse(evt.data);
|
|
@@ -89226,7 +88944,10 @@ ${data2.flowchartText}
|
|
|
89226
88944
|
}
|
|
89227
88945
|
const svg = fromBase64(msg.data.substring(msg.data.indexOf(",") + 1));
|
|
89228
88946
|
try {
|
|
89229
|
-
await saveSvgToBlock(editor, block, svg, !!((_a = msg.message) == null ? void 0 : _a.autoSave));
|
|
88947
|
+
await saveSvgToBlock(editor, block, svg, !!((_a = msg.message) == null ? void 0 : _a.autoSave), isActive);
|
|
88948
|
+
if (closed) {
|
|
88949
|
+
return;
|
|
88950
|
+
}
|
|
89230
88951
|
if (!((_b = msg.message) == null ? void 0 : _b.autoSave)) {
|
|
89231
88952
|
destroy();
|
|
89232
88953
|
}
|
|
@@ -89234,6 +88955,9 @@ ${data2.flowchartText}
|
|
|
89234
88955
|
currentAlertDialog = null;
|
|
89235
88956
|
isDirty = false;
|
|
89236
88957
|
} catch (error2) {
|
|
88958
|
+
if (closed) {
|
|
88959
|
+
return;
|
|
88960
|
+
}
|
|
89237
88961
|
isDirty = true;
|
|
89238
88962
|
const drawioIframeWindow = iframe.contentWindow;
|
|
89239
88963
|
if (!currentAlertDialog && exportFlag !== "auto") {
|
|
@@ -89244,6 +88968,9 @@ ${data2.flowchartText}
|
|
|
89244
88968
|
allowRetry: true,
|
|
89245
88969
|
onOk: () => {
|
|
89246
88970
|
setTimeout(() => {
|
|
88971
|
+
if (closed) {
|
|
88972
|
+
return;
|
|
88973
|
+
}
|
|
89247
88974
|
drawioIframeWindow.postMessage(
|
|
89248
88975
|
JSON.stringify({
|
|
89249
88976
|
action: "export",
|
|
@@ -89276,13 +89003,13 @@ ${data2.flowchartText}
|
|
|
89276
89003
|
buttons: ["cancel", "ok"],
|
|
89277
89004
|
onOk: () => {
|
|
89278
89005
|
exportFlag = "exit";
|
|
89279
|
-
destroy();
|
|
89006
|
+
destroy(true);
|
|
89280
89007
|
}
|
|
89281
89008
|
});
|
|
89282
89009
|
return;
|
|
89283
89010
|
}
|
|
89284
89011
|
exportFlag = "exit";
|
|
89285
|
-
destroy();
|
|
89012
|
+
destroy(true);
|
|
89286
89013
|
break;
|
|
89287
89014
|
}
|
|
89288
89015
|
}
|
|
@@ -89294,6 +89021,7 @@ ${data2.flowchartText}
|
|
|
89294
89021
|
return;
|
|
89295
89022
|
}
|
|
89296
89023
|
isInitializationCompleted2 = true;
|
|
89024
|
+
data2 = cloneDeep__default.default(data2);
|
|
89297
89025
|
const options = getDrawioOptions(editor) || {};
|
|
89298
89026
|
const { callbacks } = options;
|
|
89299
89027
|
let autoSaveInterval;
|
|
@@ -97573,13 +97301,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97573
97301
|
__publicField(this, "toolbar");
|
|
97574
97302
|
__publicField(this, "toolbarFullScreen");
|
|
97575
97303
|
__publicField(this, "root");
|
|
97576
|
-
__publicField(this, "cancelFocus");
|
|
97577
97304
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
97578
97305
|
const command = item;
|
|
97579
97306
|
if (command.onClick) {
|
|
97580
97307
|
command.onClick(this.editor, command, bar2);
|
|
97581
97308
|
this.handleSelectionChanged();
|
|
97582
|
-
|
|
97309
|
+
setTimeout(() => {
|
|
97310
|
+
this.editor.focus();
|
|
97311
|
+
});
|
|
97583
97312
|
return;
|
|
97584
97313
|
}
|
|
97585
97314
|
const findParent = (item2, id) => {
|
|
@@ -97625,7 +97354,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97625
97354
|
id: "main-toolbar"
|
|
97626
97355
|
});
|
|
97627
97356
|
this.toolbar.addListener("closing", () => {
|
|
97628
|
-
|
|
97357
|
+
setTimeout(() => {
|
|
97358
|
+
editor.focus();
|
|
97359
|
+
}, 100);
|
|
97629
97360
|
return true;
|
|
97630
97361
|
});
|
|
97631
97362
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -97656,18 +97387,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97656
97387
|
});
|
|
97657
97388
|
}
|
|
97658
97389
|
}
|
|
97659
|
-
restoreFocus(delay = 0) {
|
|
97660
|
-
var _a;
|
|
97661
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97662
|
-
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
97663
|
-
}
|
|
97664
97390
|
destroy() {
|
|
97665
|
-
var _a
|
|
97666
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97391
|
+
var _a;
|
|
97667
97392
|
this.toolbar.destroy();
|
|
97668
97393
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
97669
|
-
(
|
|
97670
|
-
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
97394
|
+
(_a = this.toolbarFullScreen) == null ? void 0 : _a.destroy();
|
|
97671
97395
|
this.root.remove();
|
|
97672
97396
|
}
|
|
97673
97397
|
setItems(items) {
|
|
@@ -98390,7 +98114,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98390
98114
|
}
|
|
98391
98115
|
}
|
|
98392
98116
|
});
|
|
98393
|
-
editor.version = "5.0.
|
|
98117
|
+
editor.version = "5.0.9-beta.hotfix-release-7-77-0.1";
|
|
98394
98118
|
return editor;
|
|
98395
98119
|
}
|
|
98396
98120
|
function isDoc(doc2) {
|
|
@@ -98526,7 +98250,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98526
98250
|
OnesEditorDropTarget.register(editor);
|
|
98527
98251
|
OnesEditorTocProvider.register(editor);
|
|
98528
98252
|
OnesEditorExclusiveBlock.register(editor);
|
|
98529
|
-
editor.version = "5.0.
|
|
98253
|
+
editor.version = "5.0.9-beta.hotfix-release-7-77-0.1";
|
|
98530
98254
|
return editor;
|
|
98531
98255
|
} catch (error2) {
|
|
98532
98256
|
try {
|
|
@@ -98669,7 +98393,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98669
98393
|
}
|
|
98670
98394
|
}
|
|
98671
98395
|
});
|
|
98672
|
-
editor.version = "5.0.
|
|
98396
|
+
editor.version = "5.0.9-beta.hotfix-release-7-77-0.1";
|
|
98673
98397
|
return editor;
|
|
98674
98398
|
}
|
|
98675
98399
|
const emojis$1 = {
|
|
@@ -144495,7 +144219,6 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144495
144219
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
144496
144220
|
exports2.FitIcon = FitIcon;
|
|
144497
144221
|
exports2.FixedToolbar = FixedToolbar;
|
|
144498
|
-
exports2.FocusRestoration = FocusRestoration;
|
|
144499
144222
|
exports2.FontBoldItem = FontBoldItem;
|
|
144500
144223
|
exports2.FontItalicItem = FontItalicItem;
|
|
144501
144224
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -144687,6 +144410,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144687
144410
|
exports2.UnorderedIcon = UnorderedIcon;
|
|
144688
144411
|
exports2.UnorderedListIcon = UnorderedListIcon;
|
|
144689
144412
|
exports2.UnorderedListItem = UnorderedListItem;
|
|
144413
|
+
exports2.VersionList = VersionList;
|
|
144690
144414
|
exports2.VideoIcon = VideoIcon;
|
|
144691
144415
|
exports2.WIKI_MACRO_TYPE = WIKI_MACRO_TYPE;
|
|
144692
144416
|
exports2.WarningFilledIcon = WarningFilledIcon;
|
|
@@ -144695,7 +144419,6 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144695
144419
|
exports2.YoukuIcon = YoukuIcon;
|
|
144696
144420
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
144697
144421
|
exports2.abbreviation = abbreviation;
|
|
144698
|
-
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
144699
144422
|
exports2.activeComment = activeComment;
|
|
144700
144423
|
exports2.addAttribute = addAttribute;
|
|
144701
144424
|
exports2.addClass = addClass;
|
|
@@ -145188,8 +144911,6 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
145188
144911
|
exports2.replaceText = replaceText;
|
|
145189
144912
|
exports2.replaceWikiMacroResources = replaceWikiMacroResources;
|
|
145190
144913
|
exports2.requestDownload = requestDownload;
|
|
145191
|
-
exports2.requestEditorFocus = requestEditorFocus;
|
|
145192
|
-
exports2.requestInputFocus = requestInputFocus;
|
|
145193
144914
|
exports2.resetListStart = resetListStart;
|
|
145194
144915
|
exports2.saveAs = saveAs$1;
|
|
145195
144916
|
exports2.scrollBarIntoView = scrollBarIntoView;
|