@ones-editor/editor 5.0.8-beta.hotfix-release-7-77-0.1 → 5.0.8
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 +3 -0
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -0
- package/@ones-editor/core/src/core/composition/focus-restoration.d.ts +25 -0
- package/@ones-editor/core/src/core/composition/index.d.ts +2 -0
- package/@ones-editor/main-toolbar/src/index.d.ts +2 -0
- package/@ones-editor/paste-special/src/paste-special-button.d.ts +7 -1
- package/@ones-editor/scroll-container/src/scroll-bar-handle.d.ts +3 -1
- package/@ones-editor/server-tools/package.json +2 -1
- package/@ones-editor/server-tools/src/to-markdown/embeds/markdown.d.ts +3 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/package.json +3 -0
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +2 -1
- package/@ones-editor/ui-base/src/auto-suggest/editor-auto-suggest-menu.d.ts +2 -0
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +9 -0
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
- package/@ones-editor/versions/src/index.d.ts +0 -2
- package/@ones-editor/versions/src/types.d.ts +0 -2
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +6 -7
- package/dist/index.js +552 -235
- package/package.json +1 -1
- package/@ones-editor/sharedb-doc/src/versions/version-ops.d.ts +0 -5
package/dist/index.js
CHANGED
|
@@ -26555,6 +26555,114 @@ 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
|
+
}
|
|
26558
26666
|
const logger$3W = getLogger("editor-input");
|
|
26559
26667
|
class EditorInput$1 {
|
|
26560
26668
|
constructor(editor, callbacks) {
|
|
@@ -26564,6 +26672,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26564
26672
|
__publicField(this, "callbacks");
|
|
26565
26673
|
__publicField(this, "inputElement");
|
|
26566
26674
|
__publicField(this, "focused", false);
|
|
26675
|
+
__publicField(this, "focusRestoration");
|
|
26567
26676
|
__publicField(this, "handleBlur", () => {
|
|
26568
26677
|
this.editor.emit("blur", this.editor);
|
|
26569
26678
|
this.callbacks.onBlur();
|
|
@@ -26585,12 +26694,20 @@ var __publicField = (obj, key, value) => {
|
|
|
26585
26694
|
const isInDisableScrollMask = this.isInDisableScrollMask(target);
|
|
26586
26695
|
if (target && (isInDisableScrollMask || rootElement === target || rootElement.contains(target))) {
|
|
26587
26696
|
if (!isInDisableScrollMask && !isInBlockTools(target)) {
|
|
26588
|
-
|
|
26697
|
+
const focus = () => {
|
|
26698
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26699
|
+
return;
|
|
26700
|
+
}
|
|
26589
26701
|
this.editor.emit("focus", this.editor);
|
|
26590
26702
|
this.callbacks.onFocus();
|
|
26591
26703
|
this.editor.input.focus({ preventScroll: true });
|
|
26592
26704
|
this.focused = true;
|
|
26593
|
-
}
|
|
26705
|
+
};
|
|
26706
|
+
if (clientType.isMobile) {
|
|
26707
|
+
setTimeout(focus);
|
|
26708
|
+
} else {
|
|
26709
|
+
this.focusRestoration.schedule(focus);
|
|
26710
|
+
}
|
|
26594
26711
|
}
|
|
26595
26712
|
return;
|
|
26596
26713
|
}
|
|
@@ -26725,6 +26842,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26725
26842
|
input2.addEventListener("compositionstart", this.handleCompositionstart);
|
|
26726
26843
|
input2.addEventListener("compositionend", this.handleCompositionend);
|
|
26727
26844
|
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
|
+
});
|
|
26728
26850
|
if (clientType.isMobile) {
|
|
26729
26851
|
document.addEventListener("touchend", this.handleDocumentClick);
|
|
26730
26852
|
} else {
|
|
@@ -26747,6 +26869,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26747
26869
|
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"));
|
|
26748
26870
|
}
|
|
26749
26871
|
destroy() {
|
|
26872
|
+
this.focusRestoration.destroy();
|
|
26750
26873
|
this.callbacks.destroy();
|
|
26751
26874
|
if (clientType.isMobile) {
|
|
26752
26875
|
document.removeEventListener("touchend", this.handleDocumentClick);
|
|
@@ -26771,24 +26894,36 @@ var __publicField = (obj, key, value) => {
|
|
|
26771
26894
|
return this.inputElement;
|
|
26772
26895
|
}
|
|
26773
26896
|
focus(options) {
|
|
26897
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26898
|
+
return;
|
|
26899
|
+
}
|
|
26774
26900
|
if (!this.editor.selection.caret.visible()) {
|
|
26775
26901
|
this.editor.selection.caret.update();
|
|
26776
26902
|
}
|
|
26777
26903
|
if (clientType.isMobile) {
|
|
26778
26904
|
this.inputElement.focus(options);
|
|
26779
26905
|
this.callbacks.onFocus();
|
|
26906
|
+
this.focused = true;
|
|
26780
26907
|
} else {
|
|
26781
|
-
|
|
26908
|
+
this.focusRestoration.schedule(() => {
|
|
26909
|
+
if (this.editor.destroyed) {
|
|
26910
|
+
return;
|
|
26911
|
+
}
|
|
26782
26912
|
if (document.activeElement !== this.inputElement) {
|
|
26783
|
-
|
|
26784
|
-
this.editor.
|
|
26913
|
+
this.focusRestoration.schedule(() => {
|
|
26914
|
+
if (!this.editor.destroyed && document.activeElement === this.inputElement) {
|
|
26915
|
+
this.editor.emit("focus", this.editor);
|
|
26916
|
+
}
|
|
26785
26917
|
});
|
|
26786
26918
|
}
|
|
26787
26919
|
this.inputElement.focus(options);
|
|
26920
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26921
|
+
return;
|
|
26922
|
+
}
|
|
26788
26923
|
this.callbacks.onFocus();
|
|
26789
|
-
|
|
26924
|
+
this.focused = true;
|
|
26925
|
+
}, 0, (options == null ? void 0 : options.preventScroll) === true);
|
|
26790
26926
|
}
|
|
26791
|
-
this.focused = true;
|
|
26792
26927
|
}
|
|
26793
26928
|
isInDisableScrollMask(target) {
|
|
26794
26929
|
let elem = target;
|
|
@@ -29965,7 +30100,7 @@ var __publicField = (obj, key, value) => {
|
|
|
29965
30100
|
});
|
|
29966
30101
|
return true;
|
|
29967
30102
|
}
|
|
29968
|
-
function defaultGetResourceFromBlock(editor,
|
|
30103
|
+
function defaultGetResourceFromBlock(editor, block, resources) {
|
|
29969
30104
|
if (block.type === "embed") {
|
|
29970
30105
|
const embedData = block.embedData;
|
|
29971
30106
|
if (block.embedType === WIKI_MACRO_TYPE) {
|
|
@@ -30006,43 +30141,23 @@ var __publicField = (obj, key, value) => {
|
|
|
30006
30141
|
}
|
|
30007
30142
|
});
|
|
30008
30143
|
}
|
|
30009
|
-
|
|
30010
|
-
|
|
30011
|
-
|
|
30012
|
-
|
|
30013
|
-
|
|
30014
|
-
|
|
30015
|
-
|
|
30016
|
-
|
|
30144
|
+
}
|
|
30145
|
+
function getResourcesFromBlock(editor, doc2, block, resources) {
|
|
30146
|
+
var _a, _b;
|
|
30147
|
+
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
30148
|
+
const declaredResources = (_a = blockClass.getResources) == null ? void 0 : _a.call(blockClass, editor, block);
|
|
30149
|
+
if (declaredResources) {
|
|
30150
|
+
declaredResources.forEach((resource) => resources.add(resource));
|
|
30151
|
+
} else {
|
|
30152
|
+
defaultGetResourceFromBlock(editor, block, resources);
|
|
30017
30153
|
}
|
|
30154
|
+
(_b = block.children) == null ? void 0 : _b.forEach((containerId) => {
|
|
30155
|
+
doc2.blocks[containerId].forEach((child) => getResourcesFromBlock(editor, doc2, child, resources));
|
|
30156
|
+
});
|
|
30018
30157
|
}
|
|
30019
30158
|
function getAllResourcesFromDoc(editor, doc2) {
|
|
30020
30159
|
const resources = /* @__PURE__ */ new Set();
|
|
30021
|
-
|
|
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
|
-
});
|
|
30160
|
+
doc2.blocks.root.forEach((block) => getResourcesFromBlock(editor, doc2, block, resources));
|
|
30046
30161
|
return Array.from(resources);
|
|
30047
30162
|
}
|
|
30048
30163
|
function injectDocToHtmlFragment(htmlFragment, doc2) {
|
|
@@ -30355,8 +30470,14 @@ ${codeText}
|
|
|
30355
30470
|
}
|
|
30356
30471
|
return true;
|
|
30357
30472
|
}
|
|
30358
|
-
function defaultReplaceBlockResources(doc2, block, resources) {
|
|
30473
|
+
function defaultReplaceBlockResources(editor, doc2, block, resources) {
|
|
30474
|
+
var _a;
|
|
30359
30475
|
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
|
+
}
|
|
30360
30481
|
const embedData = block.embedData;
|
|
30361
30482
|
if (block.embedType === WIKI_MACRO_TYPE) {
|
|
30362
30483
|
replaceWikiMacroResources(embedData, resources);
|
|
@@ -30401,23 +30522,26 @@ ${codeText}
|
|
|
30401
30522
|
children.forEach((childContainerId) => {
|
|
30402
30523
|
const blocks = doc2.blocks[childContainerId];
|
|
30403
30524
|
blocks.forEach((b) => {
|
|
30404
|
-
|
|
30525
|
+
replaceBlockResources(editor, doc2, b, resources);
|
|
30405
30526
|
});
|
|
30406
30527
|
});
|
|
30407
30528
|
}
|
|
30408
30529
|
}
|
|
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
|
+
}
|
|
30409
30538
|
function replaceDocResources(editor, doc2, resources) {
|
|
30410
30539
|
if (resources.size === 0) {
|
|
30411
30540
|
return;
|
|
30412
30541
|
}
|
|
30413
30542
|
const blocks = doc2.blocks.root;
|
|
30414
30543
|
blocks.forEach((block) => {
|
|
30415
|
-
|
|
30416
|
-
if (blockClass.replaceResources) {
|
|
30417
|
-
blockClass.replaceResources(block, resources);
|
|
30418
|
-
} else {
|
|
30419
|
-
defaultReplaceBlockResources(doc2, block, resources);
|
|
30420
|
-
}
|
|
30544
|
+
replaceBlockResources(editor, doc2, block, resources);
|
|
30421
30545
|
});
|
|
30422
30546
|
}
|
|
30423
30547
|
async function addLocalResourcesToDoc(editor, resources) {
|
|
@@ -32475,7 +32599,7 @@ ${codeText}
|
|
|
32475
32599
|
editor.doc.endBatchUpdate();
|
|
32476
32600
|
}
|
|
32477
32601
|
if (!clientType.isMobile) {
|
|
32478
|
-
editor
|
|
32602
|
+
requestEditorFocus(editor);
|
|
32479
32603
|
}
|
|
32480
32604
|
return rangeResult;
|
|
32481
32605
|
});
|
|
@@ -38695,57 +38819,6 @@ ${codeText}
|
|
|
38695
38819
|
};
|
|
38696
38820
|
var Connection = connection;
|
|
38697
38821
|
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
|
-
}
|
|
38749
38822
|
const AuthError = {
|
|
38750
38823
|
err: 1001,
|
|
38751
38824
|
msg: "user auth error",
|
|
@@ -39462,7 +39535,27 @@ ${codeText}
|
|
|
39462
39535
|
api += `&from=${from}`;
|
|
39463
39536
|
}
|
|
39464
39537
|
const ret = await this.request(api);
|
|
39465
|
-
|
|
39538
|
+
const ops = ret.data.ops;
|
|
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
|
+
};
|
|
39466
39559
|
}
|
|
39467
39560
|
async updateVersionExtra(version, tagId, extra) {
|
|
39468
39561
|
const server = this.apiServer();
|
|
@@ -41330,7 +41423,27 @@ ${codeText}
|
|
|
41330
41423
|
api += `&from=${from}`;
|
|
41331
41424
|
}
|
|
41332
41425
|
const ret = await this.request(api);
|
|
41333
|
-
|
|
41426
|
+
const ops = ret.data.ops;
|
|
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
|
+
};
|
|
41334
41447
|
}
|
|
41335
41448
|
async updateVersionExtra(version, tagId, extra) {
|
|
41336
41449
|
const server = this.apiServer();
|
|
@@ -42820,8 +42933,13 @@ ${codeText}
|
|
|
42820
42933
|
});
|
|
42821
42934
|
__publicField(this, "tippyInstance", null);
|
|
42822
42935
|
__publicField(this, "_target", null);
|
|
42936
|
+
__publicField(this, "cancelFocus");
|
|
42937
|
+
__publicField(this, "focusTimer", null);
|
|
42938
|
+
__publicField(this, "focusRestoreGeneration", 0);
|
|
42823
42939
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42824
42940
|
var _a;
|
|
42941
|
+
const focusOwner = this.getFocusOwner();
|
|
42942
|
+
focusOwner.clearFocusTimer();
|
|
42825
42943
|
let ret = false;
|
|
42826
42944
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42827
42945
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42829,32 +42947,78 @@ ${codeText}
|
|
|
42829
42947
|
if (ret) {
|
|
42830
42948
|
return ret;
|
|
42831
42949
|
}
|
|
42832
|
-
|
|
42833
|
-
return ret;
|
|
42834
|
-
}
|
|
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);
|
|
42950
|
+
focusOwner.restoreFocusAfterClose(event);
|
|
42848
42951
|
return ret;
|
|
42849
42952
|
});
|
|
42953
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
42954
|
+
if (!this.isFocusOwner(event.target)) {
|
|
42955
|
+
this.clearFocusTimer();
|
|
42956
|
+
}
|
|
42957
|
+
});
|
|
42958
|
+
__publicField(this, "handleWindowBlur", () => {
|
|
42959
|
+
this.clearFocusTimer();
|
|
42960
|
+
});
|
|
42850
42961
|
__publicField(this, "setProps", (props) => {
|
|
42851
42962
|
var _a;
|
|
42852
42963
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
42853
42964
|
});
|
|
42854
42965
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42855
42966
|
}
|
|
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
|
+
}
|
|
42856
43019
|
manualShow(target, options) {
|
|
42857
43020
|
var _a, _b, _c, _d;
|
|
43021
|
+
this.getFocusOwner().clearFocusTimer();
|
|
42858
43022
|
this._target = target;
|
|
42859
43023
|
if (this.isVisible) {
|
|
42860
43024
|
return;
|
|
@@ -42903,6 +43067,9 @@ ${codeText}
|
|
|
42903
43067
|
}
|
|
42904
43068
|
close(reason, e2) {
|
|
42905
43069
|
var _a, _b;
|
|
43070
|
+
if (reason === "clickBackground" || reason && reason !== "cancelBar" && reason !== "clickItem") {
|
|
43071
|
+
this.clearFocusTimer();
|
|
43072
|
+
}
|
|
42906
43073
|
super.close(reason);
|
|
42907
43074
|
if (this.isVisible) {
|
|
42908
43075
|
if (e2) {
|
|
@@ -42913,10 +43080,12 @@ ${codeText}
|
|
|
42913
43080
|
}
|
|
42914
43081
|
}
|
|
42915
43082
|
destroy() {
|
|
42916
|
-
var _a;
|
|
43083
|
+
var _a, _b;
|
|
43084
|
+
this.clearFocusTimer();
|
|
42917
43085
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42918
43086
|
this.tippyInstance = null;
|
|
42919
43087
|
super.destroy();
|
|
43088
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
42920
43089
|
}
|
|
42921
43090
|
getCommandBarRoot() {
|
|
42922
43091
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -45042,19 +45211,22 @@ ${codeText}
|
|
|
45042
45211
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
45043
45212
|
constructor(editor, editorOptions) {
|
|
45044
45213
|
super(editorOptions);
|
|
45214
|
+
__publicField(this, "cancelFocus");
|
|
45045
45215
|
__publicField(this, "handleClose", () => {
|
|
45046
|
-
var _a, _b;
|
|
45216
|
+
var _a, _b, _c;
|
|
45217
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45047
45218
|
if (shouldFocusToEditor(this.editor)) {
|
|
45048
|
-
this.editor
|
|
45219
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
45049
45220
|
}
|
|
45050
|
-
(
|
|
45221
|
+
(_c = (_b = this.options).onClose) == null ? void 0 : _c.call(_b);
|
|
45051
45222
|
});
|
|
45052
45223
|
this.editor = editor;
|
|
45053
45224
|
this.editorOptions = editorOptions;
|
|
45054
45225
|
}
|
|
45055
45226
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
45056
|
-
var _a, _b;
|
|
45057
|
-
|
|
45227
|
+
var _a, _b, _c;
|
|
45228
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45229
|
+
if (((_c = (_b = this.editorOptions).onShow) == null ? void 0 : _c.call(_b, this, containerId, blockIndex, offset)) === false) {
|
|
45058
45230
|
return;
|
|
45059
45231
|
}
|
|
45060
45232
|
if (this.options.showLoading) {
|
|
@@ -45072,6 +45244,11 @@ ${codeText}
|
|
|
45072
45244
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
45073
45245
|
super.popup(anchor2, { noEvent: true });
|
|
45074
45246
|
}
|
|
45247
|
+
destroy() {
|
|
45248
|
+
var _a;
|
|
45249
|
+
super.destroy();
|
|
45250
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45251
|
+
}
|
|
45075
45252
|
}
|
|
45076
45253
|
const logger$2H = getLogger("auto-suggest-menu");
|
|
45077
45254
|
class OnesEditorAutoSuggest {
|
|
@@ -48948,6 +49125,8 @@ ${codeText}
|
|
|
48948
49125
|
}
|
|
48949
49126
|
function resetScrollbarCore(scrollCore, scrollWrap) {
|
|
48950
49127
|
const scrollContainer = getScrollContainer(scrollWrap);
|
|
49128
|
+
if (!scrollContainer || !getContainerOption(scrollCore, getContainer(scrollContainer)))
|
|
49129
|
+
return;
|
|
48951
49130
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
48952
49131
|
const { scrollWidth, clientWidth } = getElementScrollSize(scrollContainer);
|
|
48953
49132
|
const { paddingLeft, paddingRight } = getScrollWrapPaddingSize(scrollWrap);
|
|
@@ -48964,7 +49143,7 @@ ${codeText}
|
|
|
48964
49143
|
}
|
|
48965
49144
|
function debounceByArgs(func, wait) {
|
|
48966
49145
|
const debouncers = /* @__PURE__ */ new Map();
|
|
48967
|
-
|
|
49146
|
+
const debounced = function(...args) {
|
|
48968
49147
|
var _a;
|
|
48969
49148
|
const scrollWrap = args[1];
|
|
48970
49149
|
let key = (scrollWrap == null ? void 0 : scrollWrap.genId) || "";
|
|
@@ -48976,17 +49155,30 @@ ${codeText}
|
|
|
48976
49155
|
if (!debouncers.has(key)) {
|
|
48977
49156
|
debouncers.set(key, debounce__default.default(
|
|
48978
49157
|
(...innerArgs) => {
|
|
48979
|
-
|
|
48980
|
-
|
|
48981
|
-
|
|
48982
|
-
|
|
48983
|
-
|
|
49158
|
+
try {
|
|
49159
|
+
return func.apply(this, innerArgs);
|
|
49160
|
+
} finally {
|
|
49161
|
+
if (scrollWrap)
|
|
49162
|
+
scrollWrap.genId = void 0;
|
|
49163
|
+
debouncers.delete(key);
|
|
49164
|
+
}
|
|
48984
49165
|
},
|
|
48985
49166
|
wait
|
|
48986
49167
|
));
|
|
48987
49168
|
}
|
|
48988
49169
|
return (_a = debouncers.get(key)) == null ? void 0 : _a.apply(this, args);
|
|
48989
49170
|
};
|
|
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;
|
|
48990
49182
|
}
|
|
48991
49183
|
const resetScrollbar = debounceByArgs(resetScrollbarCore, 50);
|
|
48992
49184
|
function resetScrollbarLeft(scrollContainer, scrollbarContainer) {
|
|
@@ -49481,6 +49673,7 @@ ${codeText}
|
|
|
49481
49673
|
}
|
|
49482
49674
|
unbindCore(scrollContainer, scrollWrap) {
|
|
49483
49675
|
var _a, _b, _c, _d, _e, _f;
|
|
49676
|
+
resetScrollbar.cancel(scrollWrap);
|
|
49484
49677
|
if (!this.boundContainers.delete(scrollContainer))
|
|
49485
49678
|
return;
|
|
49486
49679
|
const scrollbarContainer = getScrollbarContainer(scrollContainer);
|
|
@@ -54413,6 +54606,7 @@ ${codeText}
|
|
|
54413
54606
|
});
|
|
54414
54607
|
__publicField(this, "close", () => {
|
|
54415
54608
|
this.linkPopup.close("cancelBar");
|
|
54609
|
+
this.emit("close");
|
|
54416
54610
|
});
|
|
54417
54611
|
__publicField(this, "createItems", (content) => [{
|
|
54418
54612
|
id: "link-popup",
|
|
@@ -54434,7 +54628,6 @@ ${codeText}
|
|
|
54434
54628
|
this.emit("finished");
|
|
54435
54629
|
});
|
|
54436
54630
|
__publicField(this, "handleClose", () => {
|
|
54437
|
-
this.emit("close");
|
|
54438
54631
|
this.close();
|
|
54439
54632
|
});
|
|
54440
54633
|
__publicField(this, "handleShown", () => {
|
|
@@ -54463,8 +54656,13 @@ ${codeText}
|
|
|
54463
54656
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54464
54657
|
id: "link-popup",
|
|
54465
54658
|
header: this.createHeader(),
|
|
54466
|
-
disableSelectedScroll: true
|
|
54659
|
+
disableSelectedScroll: true,
|
|
54660
|
+
beforeClose: () => {
|
|
54661
|
+
this.handleClose();
|
|
54662
|
+
return true;
|
|
54663
|
+
}
|
|
54467
54664
|
});
|
|
54665
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54468
54666
|
}
|
|
54469
54667
|
destroy() {
|
|
54470
54668
|
var _a, _b;
|
|
@@ -54483,11 +54681,11 @@ ${codeText}
|
|
|
54483
54681
|
this.emit("finished");
|
|
54484
54682
|
});
|
|
54485
54683
|
__publicField(this, "handleClose", () => {
|
|
54486
|
-
this.emit("close");
|
|
54487
54684
|
this.close();
|
|
54488
54685
|
});
|
|
54489
54686
|
__publicField(this, "close", () => {
|
|
54490
54687
|
this.linkPopup.close("cancelBar");
|
|
54688
|
+
this.emit("close");
|
|
54491
54689
|
});
|
|
54492
54690
|
__publicField(this, "disabledSubmit", () => {
|
|
54493
54691
|
var _a;
|
|
@@ -54507,8 +54705,13 @@ ${codeText}
|
|
|
54507
54705
|
this.content = content;
|
|
54508
54706
|
this.options = options;
|
|
54509
54707
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54510
|
-
id: "link-popup"
|
|
54708
|
+
id: "link-popup",
|
|
54709
|
+
beforeClose: () => {
|
|
54710
|
+
this.handleClose();
|
|
54711
|
+
return true;
|
|
54712
|
+
}
|
|
54511
54713
|
});
|
|
54714
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54512
54715
|
}
|
|
54513
54716
|
createPopupContent() {
|
|
54514
54717
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54541,46 +54744,85 @@ ${codeText}
|
|
|
54541
54744
|
__publicField(this, "onFinished", null);
|
|
54542
54745
|
__publicField(this, "onClose", null);
|
|
54543
54746
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54747
|
+
__publicField(this, "session", 0);
|
|
54748
|
+
__publicField(this, "submitting", false);
|
|
54749
|
+
__publicField(this, "focusTimer");
|
|
54750
|
+
__publicField(this, "releaseFocus");
|
|
54544
54751
|
__publicField(this, "handleOk", async () => {
|
|
54545
|
-
|
|
54752
|
+
if (!this.linkPopup || this.submitting || this.editor.destroyed) {
|
|
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;
|
|
54546
54760
|
try {
|
|
54547
|
-
await this.checkValue();
|
|
54548
|
-
|
|
54761
|
+
await this.checkValue(form);
|
|
54762
|
+
if (!this.isCurrent(session)) {
|
|
54763
|
+
return;
|
|
54764
|
+
}
|
|
54765
|
+
const { linkText, linkUrl } = form;
|
|
54549
54766
|
const inputValue = linkUrl.getInputValue();
|
|
54550
|
-
|
|
54551
|
-
|
|
54552
|
-
|
|
54553
|
-
|
|
54554
|
-
|
|
54767
|
+
const formatted = beforeFormatUrl == null ? void 0 : beforeFormatUrl(inputValue);
|
|
54768
|
+
const link2 = typeof formatted === "string" ? formatted : this.formatUrl(inputValue);
|
|
54769
|
+
const text2 = linkText.getInputValue() || link2;
|
|
54770
|
+
if (!this.isCurrent(session)) {
|
|
54771
|
+
return;
|
|
54555
54772
|
}
|
|
54556
|
-
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54557
54773
|
this._destroy();
|
|
54774
|
+
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54558
54775
|
} catch (error2) {
|
|
54776
|
+
if (this.isCurrent(session)) {
|
|
54777
|
+
this.submitting = false;
|
|
54778
|
+
}
|
|
54559
54779
|
}
|
|
54560
54780
|
});
|
|
54561
54781
|
__publicField(this, "handleClose", () => {
|
|
54562
|
-
|
|
54563
|
-
|
|
54782
|
+
if (!this.linkPopup) {
|
|
54783
|
+
return;
|
|
54784
|
+
}
|
|
54785
|
+
const onClose = this.onClose;
|
|
54564
54786
|
this._destroy();
|
|
54787
|
+
if (!this.editor.destroyed) {
|
|
54788
|
+
onClose == null ? void 0 : onClose();
|
|
54789
|
+
}
|
|
54565
54790
|
});
|
|
54566
54791
|
__publicField(this, "onShow", () => {
|
|
54567
|
-
|
|
54568
|
-
|
|
54569
|
-
|
|
54792
|
+
var _a;
|
|
54793
|
+
const session = this.session;
|
|
54794
|
+
const field = (_a = this.form.linkUrl) == null ? void 0 : _a.getField();
|
|
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
|
+
}
|
|
54570
54800
|
}, 400);
|
|
54571
54801
|
});
|
|
54572
54802
|
__publicField(this, "showPopup", (options) => {
|
|
54573
|
-
|
|
54803
|
+
const session = this.session;
|
|
54574
54804
|
if (clientType.isMobile) {
|
|
54575
54805
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54576
54806
|
} else {
|
|
54577
54807
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54578
54808
|
}
|
|
54579
|
-
|
|
54580
|
-
|
|
54581
|
-
|
|
54582
|
-
|
|
54583
|
-
|
|
54809
|
+
this.linkPopup.addListener("show", () => {
|
|
54810
|
+
if (this.isCurrent(session)) {
|
|
54811
|
+
this.onShow();
|
|
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();
|
|
54584
54826
|
});
|
|
54585
54827
|
__publicField(this, "onChange", () => {
|
|
54586
54828
|
var _a;
|
|
@@ -54592,11 +54834,14 @@ ${codeText}
|
|
|
54592
54834
|
return;
|
|
54593
54835
|
}
|
|
54594
54836
|
if (event.key === "Enter") {
|
|
54595
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54837
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54838
|
+
event.preventDefault();
|
|
54596
54839
|
event.stopPropagation();
|
|
54597
54840
|
return;
|
|
54598
54841
|
}
|
|
54599
54842
|
if (event.key === "Escape") {
|
|
54843
|
+
event.preventDefault();
|
|
54844
|
+
event.stopPropagation();
|
|
54600
54845
|
this.handleClose();
|
|
54601
54846
|
}
|
|
54602
54847
|
});
|
|
@@ -54610,13 +54855,18 @@ ${codeText}
|
|
|
54610
54855
|
return;
|
|
54611
54856
|
}
|
|
54612
54857
|
if (event.key === "Escape") {
|
|
54858
|
+
event.preventDefault();
|
|
54859
|
+
event.stopPropagation();
|
|
54613
54860
|
this.handleClose();
|
|
54614
54861
|
}
|
|
54615
54862
|
});
|
|
54616
54863
|
this.editor = editor;
|
|
54617
54864
|
}
|
|
54618
|
-
|
|
54619
|
-
|
|
54865
|
+
isCurrent(session) {
|
|
54866
|
+
return session === this.session && !!this.linkPopup && !this.editor.destroyed;
|
|
54867
|
+
}
|
|
54868
|
+
async checkValue(form) {
|
|
54869
|
+
const { linkUrl } = form;
|
|
54620
54870
|
if (!linkUrl.getInputValue()) {
|
|
54621
54871
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54622
54872
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54634,14 +54884,20 @@ ${codeText}
|
|
|
54634
54884
|
return link2;
|
|
54635
54885
|
}
|
|
54636
54886
|
editLink(options) {
|
|
54637
|
-
this.
|
|
54887
|
+
this._destroy();
|
|
54888
|
+
if (this.editor.destroyed) {
|
|
54889
|
+
return;
|
|
54890
|
+
}
|
|
54891
|
+
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54638
54892
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54639
54893
|
this.onFinished = onFinished;
|
|
54640
|
-
|
|
54641
|
-
|
|
54642
|
-
|
|
54643
|
-
|
|
54644
|
-
|
|
54894
|
+
this.onClose = onClose != null ? onClose : null;
|
|
54895
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl != null ? onBeforeFormatUrl : null;
|
|
54896
|
+
try {
|
|
54897
|
+
this.showPopup(options);
|
|
54898
|
+
} catch (error2) {
|
|
54899
|
+
this._destroy();
|
|
54900
|
+
throw error2;
|
|
54645
54901
|
}
|
|
54646
54902
|
}
|
|
54647
54903
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54670,12 +54926,21 @@ ${codeText}
|
|
|
54670
54926
|
return content;
|
|
54671
54927
|
}
|
|
54672
54928
|
_destroy() {
|
|
54673
|
-
|
|
54929
|
+
this.session += 1;
|
|
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;
|
|
54674
54937
|
this.onFinished = null;
|
|
54675
54938
|
this.onClose = null;
|
|
54939
|
+
this.onBeforeFormatUrl = null;
|
|
54676
54940
|
this.form = {};
|
|
54677
|
-
|
|
54678
|
-
|
|
54941
|
+
popup == null ? void 0 : popup.removeAllListeners();
|
|
54942
|
+
popup == null ? void 0 : popup.destroy();
|
|
54943
|
+
releaseFocus == null ? void 0 : releaseFocus();
|
|
54679
54944
|
}
|
|
54680
54945
|
destroy() {
|
|
54681
54946
|
this._destroy();
|
|
@@ -54715,14 +54980,14 @@ ${codeText}
|
|
|
54715
54980
|
const text2 = [op1, op2];
|
|
54716
54981
|
editor.insertTextToBlock(block, 0, text2);
|
|
54717
54982
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54718
|
-
editor
|
|
54983
|
+
requestEditorFocus(editor);
|
|
54719
54984
|
} catch (error2) {
|
|
54720
54985
|
logger$21.error(error2);
|
|
54721
54986
|
}
|
|
54722
54987
|
});
|
|
54723
54988
|
};
|
|
54724
54989
|
const onClose = () => {
|
|
54725
|
-
editor
|
|
54990
|
+
requestEditorFocus(editor);
|
|
54726
54991
|
};
|
|
54727
54992
|
editLink(editor, {
|
|
54728
54993
|
target: block,
|
|
@@ -54754,21 +55019,21 @@ ${codeText}
|
|
|
54754
55019
|
if (isCollapsed) {
|
|
54755
55020
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
54756
55021
|
editor.setBlockText(block, newText);
|
|
54757
|
-
editor
|
|
55022
|
+
requestEditorFocus(editor);
|
|
54758
55023
|
return;
|
|
54759
55024
|
}
|
|
54760
55025
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
54761
55026
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
54762
55027
|
editor.setBlockText(block, newText);
|
|
54763
55028
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
54764
|
-
editor
|
|
55029
|
+
requestEditorFocus(editor);
|
|
54765
55030
|
} catch (error2) {
|
|
54766
55031
|
logger$21.error(error2);
|
|
54767
55032
|
}
|
|
54768
55033
|
});
|
|
54769
55034
|
};
|
|
54770
55035
|
const onClose = () => {
|
|
54771
|
-
editor
|
|
55036
|
+
requestEditorFocus(editor);
|
|
54772
55037
|
};
|
|
54773
55038
|
editLink(editor, {
|
|
54774
55039
|
target: anchor2,
|
|
@@ -55017,14 +55282,14 @@ ${codeText}
|
|
|
55017
55282
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
55018
55283
|
editor.setBlockText(block, newText);
|
|
55019
55284
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
55020
|
-
editor
|
|
55285
|
+
requestEditorFocus(editor);
|
|
55021
55286
|
} catch (error2) {
|
|
55022
55287
|
logger$20.error(error2);
|
|
55023
55288
|
}
|
|
55024
55289
|
};
|
|
55025
55290
|
const onClose = () => {
|
|
55026
55291
|
editor.selection.selectBlock(block, range.end);
|
|
55027
|
-
editor
|
|
55292
|
+
requestEditorFocus(editor);
|
|
55028
55293
|
};
|
|
55029
55294
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
55030
55295
|
if (!rect) {
|
|
@@ -55526,6 +55791,7 @@ ${codeText}
|
|
|
55526
55791
|
__publicField(this, "_disableTextToolbar", false);
|
|
55527
55792
|
__publicField(this, "_lastClickTime", 0);
|
|
55528
55793
|
__publicField(this, "_disabled", false);
|
|
55794
|
+
__publicField(this, "cancelFocus");
|
|
55529
55795
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55530
55796
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55531
55797
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55549,17 +55815,23 @@ ${codeText}
|
|
|
55549
55815
|
}
|
|
55550
55816
|
this._lastClickTime = Date.now();
|
|
55551
55817
|
});
|
|
55552
|
-
__publicField(this, "handleClose", () => {
|
|
55553
|
-
var _a;
|
|
55818
|
+
__publicField(this, "handleClose", (toolbar2) => {
|
|
55819
|
+
var _a, _b;
|
|
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
|
+
}
|
|
55554
55827
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55555
55828
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55556
55829
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55557
55830
|
logger$1_.debug("focus is in block tools, ignore focus");
|
|
55558
55831
|
return;
|
|
55559
55832
|
}
|
|
55560
|
-
this.
|
|
55561
|
-
|
|
55562
|
-
});
|
|
55833
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
55834
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
55563
55835
|
}
|
|
55564
55836
|
});
|
|
55565
55837
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55688,8 +55960,10 @@ ${codeText}
|
|
|
55688
55960
|
this.toolbar.close("selectionChange");
|
|
55689
55961
|
}
|
|
55690
55962
|
destroy() {
|
|
55963
|
+
var _a;
|
|
55691
55964
|
this.unbindEvents();
|
|
55692
55965
|
this.toolbar.destroy();
|
|
55966
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55693
55967
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55694
55968
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55695
55969
|
}
|
|
@@ -74254,10 +74528,11 @@ ${codeText}
|
|
|
74254
74528
|
createTableBorderBar(editor, tableBlock);
|
|
74255
74529
|
}
|
|
74256
74530
|
function hideTableBorderBar(editor, tableBlock) {
|
|
74531
|
+
var _a, _b;
|
|
74257
74532
|
assert(logger$14, isTableBlock(tableBlock), "invalid table block");
|
|
74258
|
-
const tools =
|
|
74533
|
+
const tools = (_a = getBlockContent(tableBlock).querySelector("div[data-type=table-content]")) == null ? void 0 : _a.querySelector(":scope >div[data-type=table-tools]");
|
|
74259
74534
|
const blockTools = getBlockTools(tableBlock);
|
|
74260
|
-
const topTableBorderBar = tools.querySelectorAll(".table-border-bar-container");
|
|
74535
|
+
const topTableBorderBar = (_b = tools == null ? void 0 : tools.querySelectorAll(".table-border-bar-container")) != null ? _b : [];
|
|
74261
74536
|
const leftTableBorderBar = blockTools.querySelectorAll(".table-border-bar-container");
|
|
74262
74537
|
topTableBorderBar.forEach((elem) => {
|
|
74263
74538
|
editor.domEvents.removeEventListener(elem, "click", handleBorderBarClicked);
|
|
@@ -76616,6 +76891,8 @@ ${codeText}
|
|
|
76616
76891
|
__publicField(this, "item");
|
|
76617
76892
|
__publicField(this, "docs", null);
|
|
76618
76893
|
__publicField(this, "checkedId");
|
|
76894
|
+
__publicField(this, "focusTimer", null);
|
|
76895
|
+
__publicField(this, "destroyed", false);
|
|
76619
76896
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76620
76897
|
if (!item.data) {
|
|
76621
76898
|
return;
|
|
@@ -76626,24 +76903,37 @@ ${codeText}
|
|
|
76626
76903
|
this.checkedId = item.id;
|
|
76627
76904
|
}
|
|
76628
76905
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76629
|
-
|
|
76906
|
+
this.clearFocusTimer();
|
|
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
|
+
}
|
|
76630
76914
|
if (this.docs) {
|
|
76631
76915
|
this.show(this.docs);
|
|
76632
76916
|
}
|
|
76633
76917
|
this.editor.focus();
|
|
76634
76918
|
});
|
|
76635
76919
|
});
|
|
76636
|
-
__publicField(this, "handleClose", () => {
|
|
76637
|
-
|
|
76638
|
-
|
|
76639
|
-
if (tagName === "input" || tagName === "textarea") {
|
|
76920
|
+
__publicField(this, "handleClose", (bar2) => {
|
|
76921
|
+
if (bar2.closeReason === "clickBackground") {
|
|
76922
|
+
this.clearFocusTimer();
|
|
76640
76923
|
return;
|
|
76641
76924
|
}
|
|
76642
|
-
this.
|
|
76925
|
+
if (bar2.closeReason === "cancelBar" && this.canRestoreFocus()) {
|
|
76926
|
+
this.editor.focus();
|
|
76927
|
+
}
|
|
76643
76928
|
});
|
|
76644
76929
|
__publicField(this, "handleSelectionChange", () => {
|
|
76645
76930
|
if (this.toolbar.isVisible) {
|
|
76646
|
-
this.handleClose();
|
|
76931
|
+
this.handleClose(this.toolbar);
|
|
76932
|
+
}
|
|
76933
|
+
});
|
|
76934
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76935
|
+
if (!this.isFocusOwner(event.target)) {
|
|
76936
|
+
this.clearFocusTimer();
|
|
76647
76937
|
}
|
|
76648
76938
|
});
|
|
76649
76939
|
this.editor = editor;
|
|
@@ -76667,6 +76957,10 @@ ${codeText}
|
|
|
76667
76957
|
this.toolbar.addListener("close", this.handleClose);
|
|
76668
76958
|
}
|
|
76669
76959
|
show(docs) {
|
|
76960
|
+
this.clearFocusTimer();
|
|
76961
|
+
if (this.destroyed || this.editor.destroyed) {
|
|
76962
|
+
return;
|
|
76963
|
+
}
|
|
76670
76964
|
this.docs = docs;
|
|
76671
76965
|
const editor = this.editor;
|
|
76672
76966
|
const range = editor.selection.range;
|
|
@@ -76725,13 +77019,39 @@ ${codeText}
|
|
|
76725
77019
|
return doc2;
|
|
76726
77020
|
}
|
|
76727
77021
|
hide() {
|
|
77022
|
+
this.clearFocusTimer();
|
|
76728
77023
|
this.toolbar.close("selectionChange");
|
|
76729
77024
|
}
|
|
76730
77025
|
clearCheckedState() {
|
|
76731
77026
|
this.checkedId = void 0;
|
|
76732
77027
|
}
|
|
76733
77028
|
destroy() {
|
|
77029
|
+
var _a;
|
|
77030
|
+
this.destroyed = true;
|
|
77031
|
+
this.clearFocusTimer();
|
|
76734
77032
|
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);
|
|
76735
77055
|
}
|
|
76736
77056
|
getCommandItems(docs) {
|
|
76737
77057
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -83068,7 +83388,7 @@ ${docStr}
|
|
|
83068
83388
|
onSelectVersion(version);
|
|
83069
83389
|
});
|
|
83070
83390
|
__publicField(this, "handleEndEditItemMemo", (value, isCancel) => {
|
|
83071
|
-
var _a, _b, _c, _d
|
|
83391
|
+
var _a, _b, _c, _d;
|
|
83072
83392
|
const versionItem = (_a = this.memoInput) == null ? void 0 : _a.root.closest(".version-item");
|
|
83073
83393
|
if (this.isVersionElement(versionItem)) {
|
|
83074
83394
|
removeClass(versionItem, "editing");
|
|
@@ -83083,7 +83403,7 @@ ${docStr}
|
|
|
83083
83403
|
}
|
|
83084
83404
|
if (hasChanged) {
|
|
83085
83405
|
version.extra = { memo: filterValue2 };
|
|
83086
|
-
|
|
83406
|
+
this.options.versionHelper.updateVersionExtra(version.version, version.tagId, version.extra).then(() => {
|
|
83087
83407
|
var _a2, _b2;
|
|
83088
83408
|
(_b2 = (_a2 = this.options).onMemoChanged) == null ? void 0 : _b2.call(_a2, version);
|
|
83089
83409
|
});
|
|
@@ -83093,7 +83413,7 @@ ${docStr}
|
|
|
83093
83413
|
}
|
|
83094
83414
|
}
|
|
83095
83415
|
}
|
|
83096
|
-
(
|
|
83416
|
+
(_d = this.memoInput) == null ? void 0 : _d.root.remove();
|
|
83097
83417
|
});
|
|
83098
83418
|
__publicField(this, "handleRevert", (version, versionItem) => {
|
|
83099
83419
|
const { onRevert } = this.options;
|
|
@@ -83104,8 +83424,6 @@ ${docStr}
|
|
|
83104
83424
|
onCopyLink == null ? void 0 : onCopyLink(version);
|
|
83105
83425
|
});
|
|
83106
83426
|
__publicField(this, "handleFilterClick", (bar2, item) => {
|
|
83107
|
-
if (item.id === "memoed" && this.options.enableMemo === false)
|
|
83108
|
-
return;
|
|
83109
83427
|
let versions = this.options.versions;
|
|
83110
83428
|
if (item.id === "memoed") {
|
|
83111
83429
|
versions = versions.filter((v) => {
|
|
@@ -83116,7 +83434,7 @@ ${docStr}
|
|
|
83116
83434
|
const fragment = this.createVersionItems(versions, item.id);
|
|
83117
83435
|
this.versionsList.innerHTML = "";
|
|
83118
83436
|
this.versionsList.append(fragment);
|
|
83119
|
-
this.versionFilterToolbar.updateItems(VersionList.getFilterItems(item.id
|
|
83437
|
+
this.versionFilterToolbar.updateItems(VersionList.getFilterItems(item.id));
|
|
83120
83438
|
this.updateHeaderCount(versions.length);
|
|
83121
83439
|
});
|
|
83122
83440
|
var _a;
|
|
@@ -83127,7 +83445,7 @@ ${docStr}
|
|
|
83127
83445
|
count: `${versions.length}`
|
|
83128
83446
|
});
|
|
83129
83447
|
createElement("span", ["version-count"], versionsListHeader, headerText);
|
|
83130
|
-
this.versionFilterToolbar = VersionList.createFilterToolbar(versionsListHeader
|
|
83448
|
+
this.versionFilterToolbar = VersionList.createFilterToolbar(versionsListHeader);
|
|
83131
83449
|
this.versionFilterToolbar.addListener("click", this.handleFilterClick);
|
|
83132
83450
|
this.selectedVersion = options.selectedVersion || versions[0];
|
|
83133
83451
|
const versionsList = createElement("div", ["version-list-content"], null);
|
|
@@ -83141,14 +83459,14 @@ ${docStr}
|
|
|
83141
83459
|
(_a = this.options) == null ? void 0 : _a.onSelectVersion(activeVersion);
|
|
83142
83460
|
}
|
|
83143
83461
|
}
|
|
83144
|
-
static createFilterToolbar(parent
|
|
83462
|
+
static createFilterToolbar(parent) {
|
|
83145
83463
|
const filter = createElement("div", ["version-list-filter"], parent);
|
|
83146
|
-
const versionFilterToolbar = new FixedToolbar(filter, VersionList.getFilterItems("all"
|
|
83464
|
+
const versionFilterToolbar = new FixedToolbar(filter, VersionList.getFilterItems("all"), {
|
|
83147
83465
|
tooltipId: "version-viewer"
|
|
83148
83466
|
});
|
|
83149
83467
|
return versionFilterToolbar;
|
|
83150
83468
|
}
|
|
83151
|
-
static getFilterItems(id
|
|
83469
|
+
static getFilterItems(id) {
|
|
83152
83470
|
return [
|
|
83153
83471
|
{
|
|
83154
83472
|
id: "filter",
|
|
@@ -83164,11 +83482,11 @@ ${docStr}
|
|
|
83164
83482
|
states: id === "all" ? ["checked"] : [],
|
|
83165
83483
|
name: t$1("version.filter.allVersions")
|
|
83166
83484
|
},
|
|
83167
|
-
|
|
83485
|
+
{
|
|
83168
83486
|
id: "memoed",
|
|
83169
83487
|
states: id === "memoed" ? ["checked"] : [],
|
|
83170
83488
|
name: t$1("version.filter.memoVersions")
|
|
83171
|
-
}
|
|
83489
|
+
}
|
|
83172
83490
|
]
|
|
83173
83491
|
}
|
|
83174
83492
|
];
|
|
@@ -83197,14 +83515,12 @@ ${docStr}
|
|
|
83197
83515
|
}
|
|
83198
83516
|
createElement("div", ["spacer"], title);
|
|
83199
83517
|
const actions2 = createElement("div", ["version-actions"], title);
|
|
83200
|
-
|
|
83201
|
-
|
|
83202
|
-
|
|
83203
|
-
|
|
83204
|
-
|
|
83205
|
-
|
|
83206
|
-
addMemo.setAttribute("data-editor-tooltip-common", disabledTip);
|
|
83207
|
-
}
|
|
83518
|
+
const addMemo = createIconButton(Edit2Icon, ["add-memo-button"], actions2);
|
|
83519
|
+
addMemo.setAttribute("data-editor-tooltip-common", t$1("version.memo"));
|
|
83520
|
+
if (!this.options.enableEdit) {
|
|
83521
|
+
addClass(addMemo, "disabled");
|
|
83522
|
+
const disabledTip = (_d = (_c = (_b = this.options).getDisabledTip) == null ? void 0 : _c.call(_b)) != null ? _d : i18n$1.t("version.tooltip.auth");
|
|
83523
|
+
addMemo.setAttribute("data-editor-tooltip-common", disabledTip);
|
|
83208
83524
|
}
|
|
83209
83525
|
if (this.options.onCopyLink) {
|
|
83210
83526
|
const copyLink = createIconButton(LinkIcon, ["copy-link-button"], actions2);
|
|
@@ -83227,22 +83543,18 @@ ${docStr}
|
|
|
83227
83543
|
restoreFrom = t$1("version.restoreFrom", { from: fromVersionName });
|
|
83228
83544
|
}
|
|
83229
83545
|
createElement("div", ["version-item-restore-from"], item, restoreFrom);
|
|
83230
|
-
|
|
83231
|
-
createElement("div", ["version-item-memo"], item, ((_i = ver.extra) == null ? void 0 : _i.memo) || "");
|
|
83232
|
-
}
|
|
83546
|
+
createElement("div", ["version-item-memo"], item, ((_i = ver.extra) == null ? void 0 : _i.memo) || "");
|
|
83233
83547
|
const info = createElement("div", ["version-item-info"], item);
|
|
83234
83548
|
createElement("li", ["version-item-time"], info, formatDate(new Date(ver.version), "YYYY-MM-DD hh:mm"));
|
|
83235
83549
|
const authors = createElement("ul", ["version-item-authors"], info);
|
|
83236
83550
|
const addUser = (user) => {
|
|
83237
|
-
var _a2, _b2, _c2;
|
|
83238
83551
|
const author = createElement("li", ["version-item-author"], authors);
|
|
83239
83552
|
const markAuthor = createElement("span", ["version-item-author-mark"], author);
|
|
83240
83553
|
markAuthor.style.background = this.options.getMarkColor(user);
|
|
83241
|
-
const
|
|
83242
|
-
const authorName = createElement("span", ["version-item-author-name"], author, displayName);
|
|
83554
|
+
const authorName = createElement("span", ["version-item-author-name"], author, user.displayName);
|
|
83243
83555
|
authorName.setAttribute(
|
|
83244
83556
|
"data-editor-tooltip-common",
|
|
83245
|
-
i18n$1.t("version.tooltip.user", { name: displayName })
|
|
83557
|
+
i18n$1.t("version.tooltip.user", { name: user.displayName })
|
|
83246
83558
|
);
|
|
83247
83559
|
};
|
|
83248
83560
|
if (this.options.useCreatedBy) {
|
|
@@ -83301,9 +83613,8 @@ ${docStr}
|
|
|
83301
83613
|
}
|
|
83302
83614
|
async editItemMemo(versionItem) {
|
|
83303
83615
|
var _a;
|
|
83304
|
-
|
|
83305
|
-
|
|
83306
|
-
if (this.options.onBeforeEditMemo && !await this.options.onBeforeEditMemo()) {
|
|
83616
|
+
const allowEditMemo = await this.options.onBeforeEditMemo();
|
|
83617
|
+
if (!allowEditMemo) {
|
|
83307
83618
|
return;
|
|
83308
83619
|
}
|
|
83309
83620
|
if (!this.memoInput) {
|
|
@@ -84773,7 +85084,7 @@ ${docStr}
|
|
|
84773
85084
|
};
|
|
84774
85085
|
}
|
|
84775
85086
|
renderContent(versions) {
|
|
84776
|
-
var _a, _b, _c, _d, _e, _f
|
|
85087
|
+
var _a, _b, _c, _d, _e, _f;
|
|
84777
85088
|
const { listContainer: versionsListContainer } = this.components;
|
|
84778
85089
|
versionsListContainer.innerHTML = "";
|
|
84779
85090
|
const versionList2 = new VersionList({
|
|
@@ -84785,13 +85096,12 @@ ${docStr}
|
|
|
84785
85096
|
})),
|
|
84786
85097
|
versionHelper: this.versionHelper,
|
|
84787
85098
|
useCreatedBy: (_c = this.versionOptions) == null ? void 0 : _c.useCreatedBy,
|
|
84788
|
-
formatUserName: (_d = this.versionOptions) == null ? void 0 : _d.formatUserName,
|
|
84789
85099
|
onSelectVersion: this.handleSelectVersion,
|
|
84790
85100
|
onRevert: this.handleRevert,
|
|
84791
|
-
onCopyLink: ((
|
|
85101
|
+
onCopyLink: ((_d = this.versionOptions) == null ? void 0 : _d.onCopyVersionLink) ? this.handleCopyLink : void 0,
|
|
84792
85102
|
onMemoChanged: this.onMemoChanged,
|
|
84793
|
-
decorateItem: (
|
|
84794
|
-
onBeforeEditMemo: ((
|
|
85103
|
+
decorateItem: (_e = this.versionOptions) == null ? void 0 : _e.decorateItem,
|
|
85104
|
+
onBeforeEditMemo: ((_f = this.versionOptions) == null ? void 0 : _f.onBeforeEditMemo) || (async () => true),
|
|
84795
85105
|
getMarkColor: (user) => {
|
|
84796
85106
|
const { flag } = getUserColors(this.server.getRemoteUsers(), user);
|
|
84797
85107
|
return flag;
|
|
@@ -97263,14 +97573,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97263
97573
|
__publicField(this, "toolbar");
|
|
97264
97574
|
__publicField(this, "toolbarFullScreen");
|
|
97265
97575
|
__publicField(this, "root");
|
|
97576
|
+
__publicField(this, "cancelFocus");
|
|
97266
97577
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
97267
97578
|
const command = item;
|
|
97268
97579
|
if (command.onClick) {
|
|
97269
97580
|
command.onClick(this.editor, command, bar2);
|
|
97270
97581
|
this.handleSelectionChanged();
|
|
97271
|
-
|
|
97272
|
-
this.editor.focus();
|
|
97273
|
-
});
|
|
97582
|
+
this.restoreFocus();
|
|
97274
97583
|
return;
|
|
97275
97584
|
}
|
|
97276
97585
|
const findParent = (item2, id) => {
|
|
@@ -97316,9 +97625,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97316
97625
|
id: "main-toolbar"
|
|
97317
97626
|
});
|
|
97318
97627
|
this.toolbar.addListener("closing", () => {
|
|
97319
|
-
|
|
97320
|
-
editor.focus();
|
|
97321
|
-
}, 100);
|
|
97628
|
+
this.restoreFocus(100);
|
|
97322
97629
|
return true;
|
|
97323
97630
|
});
|
|
97324
97631
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -97349,11 +97656,18 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97349
97656
|
});
|
|
97350
97657
|
}
|
|
97351
97658
|
}
|
|
97352
|
-
|
|
97659
|
+
restoreFocus(delay = 0) {
|
|
97353
97660
|
var _a;
|
|
97661
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97662
|
+
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
97663
|
+
}
|
|
97664
|
+
destroy() {
|
|
97665
|
+
var _a, _b, _c;
|
|
97666
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97354
97667
|
this.toolbar.destroy();
|
|
97355
97668
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
97356
|
-
(
|
|
97669
|
+
(_b = this.toolbarFullScreen) == null ? void 0 : _b.destroy();
|
|
97670
|
+
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
97357
97671
|
this.root.remove();
|
|
97358
97672
|
}
|
|
97359
97673
|
setItems(items) {
|
|
@@ -98076,7 +98390,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98076
98390
|
}
|
|
98077
98391
|
}
|
|
98078
98392
|
});
|
|
98079
|
-
editor.version = "5.0.8
|
|
98393
|
+
editor.version = "5.0.8";
|
|
98080
98394
|
return editor;
|
|
98081
98395
|
}
|
|
98082
98396
|
function isDoc(doc2) {
|
|
@@ -98212,7 +98526,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98212
98526
|
OnesEditorDropTarget.register(editor);
|
|
98213
98527
|
OnesEditorTocProvider.register(editor);
|
|
98214
98528
|
OnesEditorExclusiveBlock.register(editor);
|
|
98215
|
-
editor.version = "5.0.8
|
|
98529
|
+
editor.version = "5.0.8";
|
|
98216
98530
|
return editor;
|
|
98217
98531
|
} catch (error2) {
|
|
98218
98532
|
try {
|
|
@@ -98355,7 +98669,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98355
98669
|
}
|
|
98356
98670
|
}
|
|
98357
98671
|
});
|
|
98358
|
-
editor.version = "5.0.8
|
|
98672
|
+
editor.version = "5.0.8";
|
|
98359
98673
|
return editor;
|
|
98360
98674
|
}
|
|
98361
98675
|
const emojis$1 = {
|
|
@@ -144181,6 +144495,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144181
144495
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
144182
144496
|
exports2.FitIcon = FitIcon;
|
|
144183
144497
|
exports2.FixedToolbar = FixedToolbar;
|
|
144498
|
+
exports2.FocusRestoration = FocusRestoration;
|
|
144184
144499
|
exports2.FontBoldItem = FontBoldItem;
|
|
144185
144500
|
exports2.FontItalicItem = FontItalicItem;
|
|
144186
144501
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -144372,7 +144687,6 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144372
144687
|
exports2.UnorderedIcon = UnorderedIcon;
|
|
144373
144688
|
exports2.UnorderedListIcon = UnorderedListIcon;
|
|
144374
144689
|
exports2.UnorderedListItem = UnorderedListItem;
|
|
144375
|
-
exports2.VersionList = VersionList;
|
|
144376
144690
|
exports2.VideoIcon = VideoIcon;
|
|
144377
144691
|
exports2.WIKI_MACRO_TYPE = WIKI_MACRO_TYPE;
|
|
144378
144692
|
exports2.WarningFilledIcon = WarningFilledIcon;
|
|
@@ -144381,6 +144695,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144381
144695
|
exports2.YoukuIcon = YoukuIcon;
|
|
144382
144696
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
144383
144697
|
exports2.abbreviation = abbreviation;
|
|
144698
|
+
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
144384
144699
|
exports2.activeComment = activeComment;
|
|
144385
144700
|
exports2.addAttribute = addAttribute;
|
|
144386
144701
|
exports2.addClass = addClass;
|
|
@@ -144873,6 +145188,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144873
145188
|
exports2.replaceText = replaceText;
|
|
144874
145189
|
exports2.replaceWikiMacroResources = replaceWikiMacroResources;
|
|
144875
145190
|
exports2.requestDownload = requestDownload;
|
|
145191
|
+
exports2.requestEditorFocus = requestEditorFocus;
|
|
145192
|
+
exports2.requestInputFocus = requestInputFocus;
|
|
144876
145193
|
exports2.resetListStart = resetListStart;
|
|
144877
145194
|
exports2.saveAs = saveAs$1;
|
|
144878
145195
|
exports2.scrollBarIntoView = scrollBarIntoView;
|