@ones-editor/editor 5.0.7 → 5.0.8-beta.ONES22302592.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/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/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/dist/index.js +429 -96
- package/package.json +1 -1
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;
|
|
@@ -32464,7 +32599,7 @@ ${codeText}
|
|
|
32464
32599
|
editor.doc.endBatchUpdate();
|
|
32465
32600
|
}
|
|
32466
32601
|
if (!clientType.isMobile) {
|
|
32467
|
-
editor
|
|
32602
|
+
requestEditorFocus(editor);
|
|
32468
32603
|
}
|
|
32469
32604
|
return rangeResult;
|
|
32470
32605
|
});
|
|
@@ -42798,8 +42933,13 @@ ${codeText}
|
|
|
42798
42933
|
});
|
|
42799
42934
|
__publicField(this, "tippyInstance", null);
|
|
42800
42935
|
__publicField(this, "_target", null);
|
|
42936
|
+
__publicField(this, "cancelFocus");
|
|
42937
|
+
__publicField(this, "focusTimer", null);
|
|
42938
|
+
__publicField(this, "focusRestoreGeneration", 0);
|
|
42801
42939
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42802
42940
|
var _a;
|
|
42941
|
+
const focusOwner = this.getFocusOwner();
|
|
42942
|
+
focusOwner.clearFocusTimer();
|
|
42803
42943
|
let ret = false;
|
|
42804
42944
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42805
42945
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42807,32 +42947,78 @@ ${codeText}
|
|
|
42807
42947
|
if (ret) {
|
|
42808
42948
|
return ret;
|
|
42809
42949
|
}
|
|
42810
|
-
|
|
42811
|
-
return ret;
|
|
42812
|
-
}
|
|
42813
|
-
const target = this._target;
|
|
42814
|
-
setTimeout(() => {
|
|
42815
|
-
const parentEditor = target.closest(".editor-root");
|
|
42816
|
-
if (parentEditor) {
|
|
42817
|
-
const input2 = parentEditor.querySelector(".editor-input");
|
|
42818
|
-
if (input2) {
|
|
42819
|
-
if (parentEditor.contains(document.activeElement)) {
|
|
42820
|
-
return;
|
|
42821
|
-
}
|
|
42822
|
-
input2.focus();
|
|
42823
|
-
}
|
|
42824
|
-
}
|
|
42825
|
-
}, 100);
|
|
42950
|
+
focusOwner.restoreFocusAfterClose(event);
|
|
42826
42951
|
return ret;
|
|
42827
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
|
+
});
|
|
42828
42961
|
__publicField(this, "setProps", (props) => {
|
|
42829
42962
|
var _a;
|
|
42830
42963
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
42831
42964
|
});
|
|
42832
42965
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42833
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
|
+
}
|
|
42834
43019
|
manualShow(target, options) {
|
|
42835
43020
|
var _a, _b, _c, _d;
|
|
43021
|
+
this.getFocusOwner().clearFocusTimer();
|
|
42836
43022
|
this._target = target;
|
|
42837
43023
|
if (this.isVisible) {
|
|
42838
43024
|
return;
|
|
@@ -42881,6 +43067,9 @@ ${codeText}
|
|
|
42881
43067
|
}
|
|
42882
43068
|
close(reason, e2) {
|
|
42883
43069
|
var _a, _b;
|
|
43070
|
+
if (reason === "clickBackground" || reason && reason !== "cancelBar" && reason !== "clickItem") {
|
|
43071
|
+
this.clearFocusTimer();
|
|
43072
|
+
}
|
|
42884
43073
|
super.close(reason);
|
|
42885
43074
|
if (this.isVisible) {
|
|
42886
43075
|
if (e2) {
|
|
@@ -42891,10 +43080,12 @@ ${codeText}
|
|
|
42891
43080
|
}
|
|
42892
43081
|
}
|
|
42893
43082
|
destroy() {
|
|
42894
|
-
var _a;
|
|
43083
|
+
var _a, _b;
|
|
43084
|
+
this.clearFocusTimer();
|
|
42895
43085
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42896
43086
|
this.tippyInstance = null;
|
|
42897
43087
|
super.destroy();
|
|
43088
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
42898
43089
|
}
|
|
42899
43090
|
getCommandBarRoot() {
|
|
42900
43091
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -45020,19 +45211,22 @@ ${codeText}
|
|
|
45020
45211
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
45021
45212
|
constructor(editor, editorOptions) {
|
|
45022
45213
|
super(editorOptions);
|
|
45214
|
+
__publicField(this, "cancelFocus");
|
|
45023
45215
|
__publicField(this, "handleClose", () => {
|
|
45024
|
-
var _a, _b;
|
|
45216
|
+
var _a, _b, _c;
|
|
45217
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45025
45218
|
if (shouldFocusToEditor(this.editor)) {
|
|
45026
|
-
this.editor
|
|
45219
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
45027
45220
|
}
|
|
45028
|
-
(
|
|
45221
|
+
(_c = (_b = this.options).onClose) == null ? void 0 : _c.call(_b);
|
|
45029
45222
|
});
|
|
45030
45223
|
this.editor = editor;
|
|
45031
45224
|
this.editorOptions = editorOptions;
|
|
45032
45225
|
}
|
|
45033
45226
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
45034
|
-
var _a, _b;
|
|
45035
|
-
|
|
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) {
|
|
45036
45230
|
return;
|
|
45037
45231
|
}
|
|
45038
45232
|
if (this.options.showLoading) {
|
|
@@ -45050,6 +45244,11 @@ ${codeText}
|
|
|
45050
45244
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
45051
45245
|
super.popup(anchor2, { noEvent: true });
|
|
45052
45246
|
}
|
|
45247
|
+
destroy() {
|
|
45248
|
+
var _a;
|
|
45249
|
+
super.destroy();
|
|
45250
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45251
|
+
}
|
|
45053
45252
|
}
|
|
45054
45253
|
const logger$2H = getLogger("auto-suggest-menu");
|
|
45055
45254
|
class OnesEditorAutoSuggest {
|
|
@@ -54391,6 +54590,7 @@ ${codeText}
|
|
|
54391
54590
|
});
|
|
54392
54591
|
__publicField(this, "close", () => {
|
|
54393
54592
|
this.linkPopup.close("cancelBar");
|
|
54593
|
+
this.emit("close");
|
|
54394
54594
|
});
|
|
54395
54595
|
__publicField(this, "createItems", (content) => [{
|
|
54396
54596
|
id: "link-popup",
|
|
@@ -54412,7 +54612,6 @@ ${codeText}
|
|
|
54412
54612
|
this.emit("finished");
|
|
54413
54613
|
});
|
|
54414
54614
|
__publicField(this, "handleClose", () => {
|
|
54415
|
-
this.emit("close");
|
|
54416
54615
|
this.close();
|
|
54417
54616
|
});
|
|
54418
54617
|
__publicField(this, "handleShown", () => {
|
|
@@ -54441,8 +54640,13 @@ ${codeText}
|
|
|
54441
54640
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54442
54641
|
id: "link-popup",
|
|
54443
54642
|
header: this.createHeader(),
|
|
54444
|
-
disableSelectedScroll: true
|
|
54643
|
+
disableSelectedScroll: true,
|
|
54644
|
+
beforeClose: () => {
|
|
54645
|
+
this.handleClose();
|
|
54646
|
+
return true;
|
|
54647
|
+
}
|
|
54445
54648
|
});
|
|
54649
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54446
54650
|
}
|
|
54447
54651
|
destroy() {
|
|
54448
54652
|
var _a, _b;
|
|
@@ -54461,11 +54665,11 @@ ${codeText}
|
|
|
54461
54665
|
this.emit("finished");
|
|
54462
54666
|
});
|
|
54463
54667
|
__publicField(this, "handleClose", () => {
|
|
54464
|
-
this.emit("close");
|
|
54465
54668
|
this.close();
|
|
54466
54669
|
});
|
|
54467
54670
|
__publicField(this, "close", () => {
|
|
54468
54671
|
this.linkPopup.close("cancelBar");
|
|
54672
|
+
this.emit("close");
|
|
54469
54673
|
});
|
|
54470
54674
|
__publicField(this, "disabledSubmit", () => {
|
|
54471
54675
|
var _a;
|
|
@@ -54485,8 +54689,13 @@ ${codeText}
|
|
|
54485
54689
|
this.content = content;
|
|
54486
54690
|
this.options = options;
|
|
54487
54691
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54488
|
-
id: "link-popup"
|
|
54692
|
+
id: "link-popup",
|
|
54693
|
+
beforeClose: () => {
|
|
54694
|
+
this.handleClose();
|
|
54695
|
+
return true;
|
|
54696
|
+
}
|
|
54489
54697
|
});
|
|
54698
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54490
54699
|
}
|
|
54491
54700
|
createPopupContent() {
|
|
54492
54701
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54519,46 +54728,85 @@ ${codeText}
|
|
|
54519
54728
|
__publicField(this, "onFinished", null);
|
|
54520
54729
|
__publicField(this, "onClose", null);
|
|
54521
54730
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54731
|
+
__publicField(this, "session", 0);
|
|
54732
|
+
__publicField(this, "submitting", false);
|
|
54733
|
+
__publicField(this, "focusTimer");
|
|
54734
|
+
__publicField(this, "releaseFocus");
|
|
54522
54735
|
__publicField(this, "handleOk", async () => {
|
|
54523
|
-
|
|
54736
|
+
if (!this.linkPopup || this.submitting || this.editor.destroyed) {
|
|
54737
|
+
return;
|
|
54738
|
+
}
|
|
54739
|
+
const session = this.session;
|
|
54740
|
+
const form = this.form;
|
|
54741
|
+
const onFinished = this.onFinished;
|
|
54742
|
+
const beforeFormatUrl = this.onBeforeFormatUrl;
|
|
54743
|
+
this.submitting = true;
|
|
54524
54744
|
try {
|
|
54525
|
-
await this.checkValue();
|
|
54526
|
-
|
|
54745
|
+
await this.checkValue(form);
|
|
54746
|
+
if (!this.isCurrent(session)) {
|
|
54747
|
+
return;
|
|
54748
|
+
}
|
|
54749
|
+
const { linkText, linkUrl } = form;
|
|
54527
54750
|
const inputValue = linkUrl.getInputValue();
|
|
54528
|
-
|
|
54529
|
-
|
|
54530
|
-
|
|
54531
|
-
|
|
54532
|
-
|
|
54751
|
+
const formatted = beforeFormatUrl == null ? void 0 : beforeFormatUrl(inputValue);
|
|
54752
|
+
const link2 = typeof formatted === "string" ? formatted : this.formatUrl(inputValue);
|
|
54753
|
+
const text2 = linkText.getInputValue() || link2;
|
|
54754
|
+
if (!this.isCurrent(session)) {
|
|
54755
|
+
return;
|
|
54533
54756
|
}
|
|
54534
|
-
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54535
54757
|
this._destroy();
|
|
54758
|
+
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54536
54759
|
} catch (error2) {
|
|
54760
|
+
if (this.isCurrent(session)) {
|
|
54761
|
+
this.submitting = false;
|
|
54762
|
+
}
|
|
54537
54763
|
}
|
|
54538
54764
|
});
|
|
54539
54765
|
__publicField(this, "handleClose", () => {
|
|
54540
|
-
|
|
54541
|
-
|
|
54766
|
+
if (!this.linkPopup) {
|
|
54767
|
+
return;
|
|
54768
|
+
}
|
|
54769
|
+
const onClose = this.onClose;
|
|
54542
54770
|
this._destroy();
|
|
54771
|
+
if (!this.editor.destroyed) {
|
|
54772
|
+
onClose == null ? void 0 : onClose();
|
|
54773
|
+
}
|
|
54543
54774
|
});
|
|
54544
54775
|
__publicField(this, "onShow", () => {
|
|
54545
|
-
|
|
54546
|
-
|
|
54547
|
-
|
|
54776
|
+
var _a;
|
|
54777
|
+
const session = this.session;
|
|
54778
|
+
const field = (_a = this.form.linkUrl) == null ? void 0 : _a.getField();
|
|
54779
|
+
clearTimeout(this.focusTimer);
|
|
54780
|
+
this.focusTimer = setTimeout(() => {
|
|
54781
|
+
if (this.isCurrent(session) && (field == null ? void 0 : field.isConnected)) {
|
|
54782
|
+
field.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54783
|
+
}
|
|
54548
54784
|
}, 400);
|
|
54549
54785
|
});
|
|
54550
54786
|
__publicField(this, "showPopup", (options) => {
|
|
54551
|
-
|
|
54787
|
+
const session = this.session;
|
|
54552
54788
|
if (clientType.isMobile) {
|
|
54553
54789
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54554
54790
|
} else {
|
|
54555
54791
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54556
54792
|
}
|
|
54557
|
-
|
|
54558
|
-
|
|
54559
|
-
|
|
54560
|
-
|
|
54561
|
-
|
|
54793
|
+
this.linkPopup.addListener("show", () => {
|
|
54794
|
+
if (this.isCurrent(session)) {
|
|
54795
|
+
this.onShow();
|
|
54796
|
+
}
|
|
54797
|
+
});
|
|
54798
|
+
this.linkPopup.addListener("finished", () => {
|
|
54799
|
+
if (this.isCurrent(session)) {
|
|
54800
|
+
this.handleOk();
|
|
54801
|
+
}
|
|
54802
|
+
});
|
|
54803
|
+
this.linkPopup.addListener("close", () => {
|
|
54804
|
+
if (this.isCurrent(session)) {
|
|
54805
|
+
this.handleClose();
|
|
54806
|
+
}
|
|
54807
|
+
});
|
|
54808
|
+
this.linkPopup.disabledSubmit();
|
|
54809
|
+
this.linkPopup.manualShow();
|
|
54562
54810
|
});
|
|
54563
54811
|
__publicField(this, "onChange", () => {
|
|
54564
54812
|
var _a;
|
|
@@ -54570,11 +54818,14 @@ ${codeText}
|
|
|
54570
54818
|
return;
|
|
54571
54819
|
}
|
|
54572
54820
|
if (event.key === "Enter") {
|
|
54573
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54821
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54822
|
+
event.preventDefault();
|
|
54574
54823
|
event.stopPropagation();
|
|
54575
54824
|
return;
|
|
54576
54825
|
}
|
|
54577
54826
|
if (event.key === "Escape") {
|
|
54827
|
+
event.preventDefault();
|
|
54828
|
+
event.stopPropagation();
|
|
54578
54829
|
this.handleClose();
|
|
54579
54830
|
}
|
|
54580
54831
|
});
|
|
@@ -54588,13 +54839,18 @@ ${codeText}
|
|
|
54588
54839
|
return;
|
|
54589
54840
|
}
|
|
54590
54841
|
if (event.key === "Escape") {
|
|
54842
|
+
event.preventDefault();
|
|
54843
|
+
event.stopPropagation();
|
|
54591
54844
|
this.handleClose();
|
|
54592
54845
|
}
|
|
54593
54846
|
});
|
|
54594
54847
|
this.editor = editor;
|
|
54595
54848
|
}
|
|
54596
|
-
|
|
54597
|
-
|
|
54849
|
+
isCurrent(session) {
|
|
54850
|
+
return session === this.session && !!this.linkPopup && !this.editor.destroyed;
|
|
54851
|
+
}
|
|
54852
|
+
async checkValue(form) {
|
|
54853
|
+
const { linkUrl } = form;
|
|
54598
54854
|
if (!linkUrl.getInputValue()) {
|
|
54599
54855
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54600
54856
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54612,14 +54868,20 @@ ${codeText}
|
|
|
54612
54868
|
return link2;
|
|
54613
54869
|
}
|
|
54614
54870
|
editLink(options) {
|
|
54615
|
-
this.
|
|
54871
|
+
this._destroy();
|
|
54872
|
+
if (this.editor.destroyed) {
|
|
54873
|
+
return;
|
|
54874
|
+
}
|
|
54875
|
+
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54616
54876
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54617
54877
|
this.onFinished = onFinished;
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54878
|
+
this.onClose = onClose != null ? onClose : null;
|
|
54879
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl != null ? onBeforeFormatUrl : null;
|
|
54880
|
+
try {
|
|
54881
|
+
this.showPopup(options);
|
|
54882
|
+
} catch (error2) {
|
|
54883
|
+
this._destroy();
|
|
54884
|
+
throw error2;
|
|
54623
54885
|
}
|
|
54624
54886
|
}
|
|
54625
54887
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54648,12 +54910,21 @@ ${codeText}
|
|
|
54648
54910
|
return content;
|
|
54649
54911
|
}
|
|
54650
54912
|
_destroy() {
|
|
54651
|
-
|
|
54913
|
+
this.session += 1;
|
|
54914
|
+
clearTimeout(this.focusTimer);
|
|
54915
|
+
this.focusTimer = void 0;
|
|
54916
|
+
const popup = this.linkPopup;
|
|
54917
|
+
const releaseFocus = this.releaseFocus;
|
|
54918
|
+
this.linkPopup = null;
|
|
54919
|
+
this.releaseFocus = void 0;
|
|
54920
|
+
this.submitting = false;
|
|
54652
54921
|
this.onFinished = null;
|
|
54653
54922
|
this.onClose = null;
|
|
54923
|
+
this.onBeforeFormatUrl = null;
|
|
54654
54924
|
this.form = {};
|
|
54655
|
-
|
|
54656
|
-
|
|
54925
|
+
popup == null ? void 0 : popup.removeAllListeners();
|
|
54926
|
+
popup == null ? void 0 : popup.destroy();
|
|
54927
|
+
releaseFocus == null ? void 0 : releaseFocus();
|
|
54657
54928
|
}
|
|
54658
54929
|
destroy() {
|
|
54659
54930
|
this._destroy();
|
|
@@ -54693,14 +54964,14 @@ ${codeText}
|
|
|
54693
54964
|
const text2 = [op1, op2];
|
|
54694
54965
|
editor.insertTextToBlock(block, 0, text2);
|
|
54695
54966
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54696
|
-
editor
|
|
54967
|
+
requestEditorFocus(editor);
|
|
54697
54968
|
} catch (error2) {
|
|
54698
54969
|
logger$21.error(error2);
|
|
54699
54970
|
}
|
|
54700
54971
|
});
|
|
54701
54972
|
};
|
|
54702
54973
|
const onClose = () => {
|
|
54703
|
-
editor
|
|
54974
|
+
requestEditorFocus(editor);
|
|
54704
54975
|
};
|
|
54705
54976
|
editLink(editor, {
|
|
54706
54977
|
target: block,
|
|
@@ -54732,21 +55003,21 @@ ${codeText}
|
|
|
54732
55003
|
if (isCollapsed) {
|
|
54733
55004
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
54734
55005
|
editor.setBlockText(block, newText);
|
|
54735
|
-
editor
|
|
55006
|
+
requestEditorFocus(editor);
|
|
54736
55007
|
return;
|
|
54737
55008
|
}
|
|
54738
55009
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
54739
55010
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
54740
55011
|
editor.setBlockText(block, newText);
|
|
54741
55012
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
54742
|
-
editor
|
|
55013
|
+
requestEditorFocus(editor);
|
|
54743
55014
|
} catch (error2) {
|
|
54744
55015
|
logger$21.error(error2);
|
|
54745
55016
|
}
|
|
54746
55017
|
});
|
|
54747
55018
|
};
|
|
54748
55019
|
const onClose = () => {
|
|
54749
|
-
editor
|
|
55020
|
+
requestEditorFocus(editor);
|
|
54750
55021
|
};
|
|
54751
55022
|
editLink(editor, {
|
|
54752
55023
|
target: anchor2,
|
|
@@ -54995,14 +55266,14 @@ ${codeText}
|
|
|
54995
55266
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
54996
55267
|
editor.setBlockText(block, newText);
|
|
54997
55268
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
54998
|
-
editor
|
|
55269
|
+
requestEditorFocus(editor);
|
|
54999
55270
|
} catch (error2) {
|
|
55000
55271
|
logger$20.error(error2);
|
|
55001
55272
|
}
|
|
55002
55273
|
};
|
|
55003
55274
|
const onClose = () => {
|
|
55004
55275
|
editor.selection.selectBlock(block, range.end);
|
|
55005
|
-
editor
|
|
55276
|
+
requestEditorFocus(editor);
|
|
55006
55277
|
};
|
|
55007
55278
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
55008
55279
|
if (!rect) {
|
|
@@ -55504,6 +55775,7 @@ ${codeText}
|
|
|
55504
55775
|
__publicField(this, "_disableTextToolbar", false);
|
|
55505
55776
|
__publicField(this, "_lastClickTime", 0);
|
|
55506
55777
|
__publicField(this, "_disabled", false);
|
|
55778
|
+
__publicField(this, "cancelFocus");
|
|
55507
55779
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55508
55780
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55509
55781
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55527,17 +55799,23 @@ ${codeText}
|
|
|
55527
55799
|
}
|
|
55528
55800
|
this._lastClickTime = Date.now();
|
|
55529
55801
|
});
|
|
55530
|
-
__publicField(this, "handleClose", () => {
|
|
55531
|
-
var _a;
|
|
55802
|
+
__publicField(this, "handleClose", (toolbar2) => {
|
|
55803
|
+
var _a, _b;
|
|
55804
|
+
if (toolbar2.closeReason === "clickBackground" || !this.editor.rootElement.isConnected) {
|
|
55805
|
+
return;
|
|
55806
|
+
}
|
|
55807
|
+
const focusedElement = document.activeElement;
|
|
55808
|
+
if (focusedElement && focusedElement !== document.body && focusedElement !== document.documentElement && !this.editor.rootElement.contains(focusedElement) && !toolbar2.isInCommandBar(focusedElement)) {
|
|
55809
|
+
return;
|
|
55810
|
+
}
|
|
55532
55811
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55533
55812
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55534
55813
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55535
55814
|
logger$1_.debug("focus is in block tools, ignore focus");
|
|
55536
55815
|
return;
|
|
55537
55816
|
}
|
|
55538
|
-
this.
|
|
55539
|
-
|
|
55540
|
-
});
|
|
55817
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
55818
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
55541
55819
|
}
|
|
55542
55820
|
});
|
|
55543
55821
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55666,8 +55944,10 @@ ${codeText}
|
|
|
55666
55944
|
this.toolbar.close("selectionChange");
|
|
55667
55945
|
}
|
|
55668
55946
|
destroy() {
|
|
55947
|
+
var _a;
|
|
55669
55948
|
this.unbindEvents();
|
|
55670
55949
|
this.toolbar.destroy();
|
|
55950
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55671
55951
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55672
55952
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55673
55953
|
}
|
|
@@ -76594,6 +76874,8 @@ ${codeText}
|
|
|
76594
76874
|
__publicField(this, "item");
|
|
76595
76875
|
__publicField(this, "docs", null);
|
|
76596
76876
|
__publicField(this, "checkedId");
|
|
76877
|
+
__publicField(this, "focusTimer", null);
|
|
76878
|
+
__publicField(this, "destroyed", false);
|
|
76597
76879
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76598
76880
|
if (!item.data) {
|
|
76599
76881
|
return;
|
|
@@ -76604,24 +76886,37 @@ ${codeText}
|
|
|
76604
76886
|
this.checkedId = item.id;
|
|
76605
76887
|
}
|
|
76606
76888
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76607
|
-
|
|
76889
|
+
this.clearFocusTimer();
|
|
76890
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
76891
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
76892
|
+
this.focusTimer = setTimeout(() => {
|
|
76893
|
+
this.clearFocusTimer();
|
|
76894
|
+
if (!this.canRestoreFocus()) {
|
|
76895
|
+
return;
|
|
76896
|
+
}
|
|
76608
76897
|
if (this.docs) {
|
|
76609
76898
|
this.show(this.docs);
|
|
76610
76899
|
}
|
|
76611
76900
|
this.editor.focus();
|
|
76612
76901
|
});
|
|
76613
76902
|
});
|
|
76614
|
-
__publicField(this, "handleClose", () => {
|
|
76615
|
-
|
|
76616
|
-
|
|
76617
|
-
if (tagName === "input" || tagName === "textarea") {
|
|
76903
|
+
__publicField(this, "handleClose", (bar2) => {
|
|
76904
|
+
if (bar2.closeReason === "clickBackground") {
|
|
76905
|
+
this.clearFocusTimer();
|
|
76618
76906
|
return;
|
|
76619
76907
|
}
|
|
76620
|
-
this.
|
|
76908
|
+
if (bar2.closeReason === "cancelBar" && this.canRestoreFocus()) {
|
|
76909
|
+
this.editor.focus();
|
|
76910
|
+
}
|
|
76621
76911
|
});
|
|
76622
76912
|
__publicField(this, "handleSelectionChange", () => {
|
|
76623
76913
|
if (this.toolbar.isVisible) {
|
|
76624
|
-
this.handleClose();
|
|
76914
|
+
this.handleClose(this.toolbar);
|
|
76915
|
+
}
|
|
76916
|
+
});
|
|
76917
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76918
|
+
if (!this.isFocusOwner(event.target)) {
|
|
76919
|
+
this.clearFocusTimer();
|
|
76625
76920
|
}
|
|
76626
76921
|
});
|
|
76627
76922
|
this.editor = editor;
|
|
@@ -76645,6 +76940,10 @@ ${codeText}
|
|
|
76645
76940
|
this.toolbar.addListener("close", this.handleClose);
|
|
76646
76941
|
}
|
|
76647
76942
|
show(docs) {
|
|
76943
|
+
this.clearFocusTimer();
|
|
76944
|
+
if (this.destroyed || this.editor.destroyed) {
|
|
76945
|
+
return;
|
|
76946
|
+
}
|
|
76648
76947
|
this.docs = docs;
|
|
76649
76948
|
const editor = this.editor;
|
|
76650
76949
|
const range = editor.selection.range;
|
|
@@ -76703,13 +77002,39 @@ ${codeText}
|
|
|
76703
77002
|
return doc2;
|
|
76704
77003
|
}
|
|
76705
77004
|
hide() {
|
|
77005
|
+
this.clearFocusTimer();
|
|
76706
77006
|
this.toolbar.close("selectionChange");
|
|
76707
77007
|
}
|
|
76708
77008
|
clearCheckedState() {
|
|
76709
77009
|
this.checkedId = void 0;
|
|
76710
77010
|
}
|
|
76711
77011
|
destroy() {
|
|
77012
|
+
var _a;
|
|
77013
|
+
this.destroyed = true;
|
|
77014
|
+
this.clearFocusTimer();
|
|
76712
77015
|
this.toolbar.destroy();
|
|
77016
|
+
(_a = this.anchor) == null ? void 0 : _a.remove();
|
|
77017
|
+
this.anchor = null;
|
|
77018
|
+
this.docs = null;
|
|
77019
|
+
}
|
|
77020
|
+
canRestoreFocus() {
|
|
77021
|
+
var _a;
|
|
77022
|
+
if (this.destroyed || this.editor.destroyed || !this.editor.rootElement.isConnected || !((_a = this.anchor) == null ? void 0 : _a.isConnected)) {
|
|
77023
|
+
return false;
|
|
77024
|
+
}
|
|
77025
|
+
const activeElement = document.activeElement;
|
|
77026
|
+
return !activeElement || activeElement === document.body || this.isFocusOwner(activeElement);
|
|
77027
|
+
}
|
|
77028
|
+
isFocusOwner(target) {
|
|
77029
|
+
return target instanceof Node && (this.editor.rootElement.contains(target) || this.toolbar.isInCommandBar(target));
|
|
77030
|
+
}
|
|
77031
|
+
clearFocusTimer() {
|
|
77032
|
+
if (this.focusTimer !== null) {
|
|
77033
|
+
clearTimeout(this.focusTimer);
|
|
77034
|
+
this.focusTimer = null;
|
|
77035
|
+
}
|
|
77036
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
77037
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
76713
77038
|
}
|
|
76714
77039
|
getCommandItems(docs) {
|
|
76715
77040
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -97231,14 +97556,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97231
97556
|
__publicField(this, "toolbar");
|
|
97232
97557
|
__publicField(this, "toolbarFullScreen");
|
|
97233
97558
|
__publicField(this, "root");
|
|
97559
|
+
__publicField(this, "cancelFocus");
|
|
97234
97560
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
97235
97561
|
const command = item;
|
|
97236
97562
|
if (command.onClick) {
|
|
97237
97563
|
command.onClick(this.editor, command, bar2);
|
|
97238
97564
|
this.handleSelectionChanged();
|
|
97239
|
-
|
|
97240
|
-
this.editor.focus();
|
|
97241
|
-
});
|
|
97565
|
+
this.restoreFocus();
|
|
97242
97566
|
return;
|
|
97243
97567
|
}
|
|
97244
97568
|
const findParent = (item2, id) => {
|
|
@@ -97284,9 +97608,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97284
97608
|
id: "main-toolbar"
|
|
97285
97609
|
});
|
|
97286
97610
|
this.toolbar.addListener("closing", () => {
|
|
97287
|
-
|
|
97288
|
-
editor.focus();
|
|
97289
|
-
}, 100);
|
|
97611
|
+
this.restoreFocus(100);
|
|
97290
97612
|
return true;
|
|
97291
97613
|
});
|
|
97292
97614
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -97317,11 +97639,18 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97317
97639
|
});
|
|
97318
97640
|
}
|
|
97319
97641
|
}
|
|
97320
|
-
|
|
97642
|
+
restoreFocus(delay = 0) {
|
|
97321
97643
|
var _a;
|
|
97644
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97645
|
+
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
97646
|
+
}
|
|
97647
|
+
destroy() {
|
|
97648
|
+
var _a, _b, _c;
|
|
97649
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97322
97650
|
this.toolbar.destroy();
|
|
97323
97651
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
97324
|
-
(
|
|
97652
|
+
(_b = this.toolbarFullScreen) == null ? void 0 : _b.destroy();
|
|
97653
|
+
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
97325
97654
|
this.root.remove();
|
|
97326
97655
|
}
|
|
97327
97656
|
setItems(items) {
|
|
@@ -98044,7 +98373,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98044
98373
|
}
|
|
98045
98374
|
}
|
|
98046
98375
|
});
|
|
98047
|
-
editor.version = "5.0.
|
|
98376
|
+
editor.version = "5.0.8-beta.ONES22302592.1";
|
|
98048
98377
|
return editor;
|
|
98049
98378
|
}
|
|
98050
98379
|
function isDoc(doc2) {
|
|
@@ -98180,7 +98509,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98180
98509
|
OnesEditorDropTarget.register(editor);
|
|
98181
98510
|
OnesEditorTocProvider.register(editor);
|
|
98182
98511
|
OnesEditorExclusiveBlock.register(editor);
|
|
98183
|
-
editor.version = "5.0.
|
|
98512
|
+
editor.version = "5.0.8-beta.ONES22302592.1";
|
|
98184
98513
|
return editor;
|
|
98185
98514
|
} catch (error2) {
|
|
98186
98515
|
try {
|
|
@@ -98323,7 +98652,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98323
98652
|
}
|
|
98324
98653
|
}
|
|
98325
98654
|
});
|
|
98326
|
-
editor.version = "5.0.
|
|
98655
|
+
editor.version = "5.0.8-beta.ONES22302592.1";
|
|
98327
98656
|
return editor;
|
|
98328
98657
|
}
|
|
98329
98658
|
const emojis$1 = {
|
|
@@ -144149,6 +144478,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144149
144478
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
144150
144479
|
exports2.FitIcon = FitIcon;
|
|
144151
144480
|
exports2.FixedToolbar = FixedToolbar;
|
|
144481
|
+
exports2.FocusRestoration = FocusRestoration;
|
|
144152
144482
|
exports2.FontBoldItem = FontBoldItem;
|
|
144153
144483
|
exports2.FontItalicItem = FontItalicItem;
|
|
144154
144484
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -144348,6 +144678,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144348
144678
|
exports2.YoukuIcon = YoukuIcon;
|
|
144349
144679
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
144350
144680
|
exports2.abbreviation = abbreviation;
|
|
144681
|
+
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
144351
144682
|
exports2.activeComment = activeComment;
|
|
144352
144683
|
exports2.addAttribute = addAttribute;
|
|
144353
144684
|
exports2.addClass = addClass;
|
|
@@ -144840,6 +145171,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144840
145171
|
exports2.replaceText = replaceText;
|
|
144841
145172
|
exports2.replaceWikiMacroResources = replaceWikiMacroResources;
|
|
144842
145173
|
exports2.requestDownload = requestDownload;
|
|
145174
|
+
exports2.requestEditorFocus = requestEditorFocus;
|
|
145175
|
+
exports2.requestInputFocus = requestInputFocus;
|
|
144843
145176
|
exports2.resetListStart = resetListStart;
|
|
144844
145177
|
exports2.saveAs = saveAs$1;
|
|
144845
145178
|
exports2.scrollBarIntoView = scrollBarIntoView;
|