@ones-editor/editor 5.0.7 → 5.0.8-beta.ONES22302172.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 +1 -0
- 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 +7 -0
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
- package/dist/index.js +410 -95
- 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,12 @@ ${codeText}
|
|
|
42798
42933
|
});
|
|
42799
42934
|
__publicField(this, "tippyInstance", null);
|
|
42800
42935
|
__publicField(this, "_target", null);
|
|
42936
|
+
__publicField(this, "cancelFocus");
|
|
42937
|
+
__publicField(this, "focusTimer", null);
|
|
42801
42938
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42802
42939
|
var _a;
|
|
42940
|
+
const focusOwner = this.getFocusOwner();
|
|
42941
|
+
focusOwner.clearFocusTimer();
|
|
42803
42942
|
let ret = false;
|
|
42804
42943
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42805
42944
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42807,32 +42946,68 @@ ${codeText}
|
|
|
42807
42946
|
if (ret) {
|
|
42808
42947
|
return ret;
|
|
42809
42948
|
}
|
|
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);
|
|
42949
|
+
focusOwner.restoreFocusAfterClose(event);
|
|
42826
42950
|
return ret;
|
|
42827
42951
|
});
|
|
42952
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
42953
|
+
if (!this.isFocusOwner(event.target)) {
|
|
42954
|
+
this.clearFocusTimer();
|
|
42955
|
+
}
|
|
42956
|
+
});
|
|
42828
42957
|
__publicField(this, "setProps", (props) => {
|
|
42829
42958
|
var _a;
|
|
42830
42959
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
42831
42960
|
});
|
|
42832
42961
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42833
42962
|
}
|
|
42963
|
+
getFocusOwner() {
|
|
42964
|
+
return this.closeable instanceof ManualCommandBar ? this.closeable.getFocusOwner() : this;
|
|
42965
|
+
}
|
|
42966
|
+
restoreFocusAfterClose(event) {
|
|
42967
|
+
if (!this._target) {
|
|
42968
|
+
return;
|
|
42969
|
+
}
|
|
42970
|
+
const target = this._target;
|
|
42971
|
+
const parentEditor = target.closest(".editor-root");
|
|
42972
|
+
if (!parentEditor || event && !this.isFocusOwner(event.target)) {
|
|
42973
|
+
return;
|
|
42974
|
+
}
|
|
42975
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
42976
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
42977
|
+
this.focusTimer = setTimeout(() => {
|
|
42978
|
+
this.clearFocusTimer();
|
|
42979
|
+
const input2 = parentEditor.querySelector(".editor-input");
|
|
42980
|
+
if (!target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected)) {
|
|
42981
|
+
return;
|
|
42982
|
+
}
|
|
42983
|
+
const activeElement = document.activeElement;
|
|
42984
|
+
if (parentEditor.contains(activeElement)) {
|
|
42985
|
+
return;
|
|
42986
|
+
}
|
|
42987
|
+
if (!activeElement || activeElement === document.body || this.isInCommandBar(activeElement)) {
|
|
42988
|
+
this.cancelFocus = requestInputFocus(input2);
|
|
42989
|
+
}
|
|
42990
|
+
}, 100);
|
|
42991
|
+
}
|
|
42992
|
+
isFocusOwner(target) {
|
|
42993
|
+
var _a;
|
|
42994
|
+
const parentEditor = (_a = this._target) == null ? void 0 : _a.closest(".editor-root");
|
|
42995
|
+
return target instanceof Node && (!!(parentEditor == null ? void 0 : parentEditor.contains(target)) || this.isInCommandBar(target));
|
|
42996
|
+
}
|
|
42997
|
+
clearFocusTimer() {
|
|
42998
|
+
var _a;
|
|
42999
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
43000
|
+
this.cancelFocus = void 0;
|
|
43001
|
+
if (this.focusTimer !== null) {
|
|
43002
|
+
clearTimeout(this.focusTimer);
|
|
43003
|
+
this.focusTimer = null;
|
|
43004
|
+
}
|
|
43005
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
43006
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
43007
|
+
}
|
|
42834
43008
|
manualShow(target, options) {
|
|
42835
43009
|
var _a, _b, _c, _d;
|
|
43010
|
+
this.getFocusOwner().clearFocusTimer();
|
|
42836
43011
|
this._target = target;
|
|
42837
43012
|
if (this.isVisible) {
|
|
42838
43013
|
return;
|
|
@@ -42881,6 +43056,9 @@ ${codeText}
|
|
|
42881
43056
|
}
|
|
42882
43057
|
close(reason, e2) {
|
|
42883
43058
|
var _a, _b;
|
|
43059
|
+
if (reason && reason !== "clickBackground" && reason !== "cancelBar" && reason !== "clickItem") {
|
|
43060
|
+
this.clearFocusTimer();
|
|
43061
|
+
}
|
|
42884
43062
|
super.close(reason);
|
|
42885
43063
|
if (this.isVisible) {
|
|
42886
43064
|
if (e2) {
|
|
@@ -42891,10 +43069,12 @@ ${codeText}
|
|
|
42891
43069
|
}
|
|
42892
43070
|
}
|
|
42893
43071
|
destroy() {
|
|
42894
|
-
var _a;
|
|
43072
|
+
var _a, _b;
|
|
43073
|
+
this.clearFocusTimer();
|
|
42895
43074
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42896
43075
|
this.tippyInstance = null;
|
|
42897
43076
|
super.destroy();
|
|
43077
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
42898
43078
|
}
|
|
42899
43079
|
getCommandBarRoot() {
|
|
42900
43080
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -45020,19 +45200,22 @@ ${codeText}
|
|
|
45020
45200
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
45021
45201
|
constructor(editor, editorOptions) {
|
|
45022
45202
|
super(editorOptions);
|
|
45203
|
+
__publicField(this, "cancelFocus");
|
|
45023
45204
|
__publicField(this, "handleClose", () => {
|
|
45024
|
-
var _a, _b;
|
|
45205
|
+
var _a, _b, _c;
|
|
45206
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45025
45207
|
if (shouldFocusToEditor(this.editor)) {
|
|
45026
|
-
this.editor
|
|
45208
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
45027
45209
|
}
|
|
45028
|
-
(
|
|
45210
|
+
(_c = (_b = this.options).onClose) == null ? void 0 : _c.call(_b);
|
|
45029
45211
|
});
|
|
45030
45212
|
this.editor = editor;
|
|
45031
45213
|
this.editorOptions = editorOptions;
|
|
45032
45214
|
}
|
|
45033
45215
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
45034
|
-
var _a, _b;
|
|
45035
|
-
|
|
45216
|
+
var _a, _b, _c;
|
|
45217
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45218
|
+
if (((_c = (_b = this.editorOptions).onShow) == null ? void 0 : _c.call(_b, this, containerId, blockIndex, offset)) === false) {
|
|
45036
45219
|
return;
|
|
45037
45220
|
}
|
|
45038
45221
|
if (this.options.showLoading) {
|
|
@@ -45050,6 +45233,11 @@ ${codeText}
|
|
|
45050
45233
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
45051
45234
|
super.popup(anchor2, { noEvent: true });
|
|
45052
45235
|
}
|
|
45236
|
+
destroy() {
|
|
45237
|
+
var _a;
|
|
45238
|
+
super.destroy();
|
|
45239
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45240
|
+
}
|
|
45053
45241
|
}
|
|
45054
45242
|
const logger$2H = getLogger("auto-suggest-menu");
|
|
45055
45243
|
class OnesEditorAutoSuggest {
|
|
@@ -54391,6 +54579,7 @@ ${codeText}
|
|
|
54391
54579
|
});
|
|
54392
54580
|
__publicField(this, "close", () => {
|
|
54393
54581
|
this.linkPopup.close("cancelBar");
|
|
54582
|
+
this.emit("close");
|
|
54394
54583
|
});
|
|
54395
54584
|
__publicField(this, "createItems", (content) => [{
|
|
54396
54585
|
id: "link-popup",
|
|
@@ -54412,7 +54601,6 @@ ${codeText}
|
|
|
54412
54601
|
this.emit("finished");
|
|
54413
54602
|
});
|
|
54414
54603
|
__publicField(this, "handleClose", () => {
|
|
54415
|
-
this.emit("close");
|
|
54416
54604
|
this.close();
|
|
54417
54605
|
});
|
|
54418
54606
|
__publicField(this, "handleShown", () => {
|
|
@@ -54441,8 +54629,13 @@ ${codeText}
|
|
|
54441
54629
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54442
54630
|
id: "link-popup",
|
|
54443
54631
|
header: this.createHeader(),
|
|
54444
|
-
disableSelectedScroll: true
|
|
54632
|
+
disableSelectedScroll: true,
|
|
54633
|
+
beforeClose: () => {
|
|
54634
|
+
this.handleClose();
|
|
54635
|
+
return true;
|
|
54636
|
+
}
|
|
54445
54637
|
});
|
|
54638
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54446
54639
|
}
|
|
54447
54640
|
destroy() {
|
|
54448
54641
|
var _a, _b;
|
|
@@ -54461,11 +54654,11 @@ ${codeText}
|
|
|
54461
54654
|
this.emit("finished");
|
|
54462
54655
|
});
|
|
54463
54656
|
__publicField(this, "handleClose", () => {
|
|
54464
|
-
this.emit("close");
|
|
54465
54657
|
this.close();
|
|
54466
54658
|
});
|
|
54467
54659
|
__publicField(this, "close", () => {
|
|
54468
54660
|
this.linkPopup.close("cancelBar");
|
|
54661
|
+
this.emit("close");
|
|
54469
54662
|
});
|
|
54470
54663
|
__publicField(this, "disabledSubmit", () => {
|
|
54471
54664
|
var _a;
|
|
@@ -54485,8 +54678,13 @@ ${codeText}
|
|
|
54485
54678
|
this.content = content;
|
|
54486
54679
|
this.options = options;
|
|
54487
54680
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54488
|
-
id: "link-popup"
|
|
54681
|
+
id: "link-popup",
|
|
54682
|
+
beforeClose: () => {
|
|
54683
|
+
this.handleClose();
|
|
54684
|
+
return true;
|
|
54685
|
+
}
|
|
54489
54686
|
});
|
|
54687
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54490
54688
|
}
|
|
54491
54689
|
createPopupContent() {
|
|
54492
54690
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54519,46 +54717,85 @@ ${codeText}
|
|
|
54519
54717
|
__publicField(this, "onFinished", null);
|
|
54520
54718
|
__publicField(this, "onClose", null);
|
|
54521
54719
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54720
|
+
__publicField(this, "session", 0);
|
|
54721
|
+
__publicField(this, "submitting", false);
|
|
54722
|
+
__publicField(this, "focusTimer");
|
|
54723
|
+
__publicField(this, "releaseFocus");
|
|
54522
54724
|
__publicField(this, "handleOk", async () => {
|
|
54523
|
-
|
|
54725
|
+
if (!this.linkPopup || this.submitting || this.editor.destroyed) {
|
|
54726
|
+
return;
|
|
54727
|
+
}
|
|
54728
|
+
const session = this.session;
|
|
54729
|
+
const form = this.form;
|
|
54730
|
+
const onFinished = this.onFinished;
|
|
54731
|
+
const beforeFormatUrl = this.onBeforeFormatUrl;
|
|
54732
|
+
this.submitting = true;
|
|
54524
54733
|
try {
|
|
54525
|
-
await this.checkValue();
|
|
54526
|
-
|
|
54734
|
+
await this.checkValue(form);
|
|
54735
|
+
if (!this.isCurrent(session)) {
|
|
54736
|
+
return;
|
|
54737
|
+
}
|
|
54738
|
+
const { linkText, linkUrl } = form;
|
|
54527
54739
|
const inputValue = linkUrl.getInputValue();
|
|
54528
|
-
|
|
54529
|
-
|
|
54530
|
-
|
|
54531
|
-
|
|
54532
|
-
|
|
54740
|
+
const formatted = beforeFormatUrl == null ? void 0 : beforeFormatUrl(inputValue);
|
|
54741
|
+
const link2 = typeof formatted === "string" ? formatted : this.formatUrl(inputValue);
|
|
54742
|
+
const text2 = linkText.getInputValue() || link2;
|
|
54743
|
+
if (!this.isCurrent(session)) {
|
|
54744
|
+
return;
|
|
54533
54745
|
}
|
|
54534
|
-
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54535
54746
|
this._destroy();
|
|
54747
|
+
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54536
54748
|
} catch (error2) {
|
|
54749
|
+
if (this.isCurrent(session)) {
|
|
54750
|
+
this.submitting = false;
|
|
54751
|
+
}
|
|
54537
54752
|
}
|
|
54538
54753
|
});
|
|
54539
54754
|
__publicField(this, "handleClose", () => {
|
|
54540
|
-
|
|
54541
|
-
|
|
54755
|
+
if (!this.linkPopup) {
|
|
54756
|
+
return;
|
|
54757
|
+
}
|
|
54758
|
+
const onClose = this.onClose;
|
|
54542
54759
|
this._destroy();
|
|
54760
|
+
if (!this.editor.destroyed) {
|
|
54761
|
+
onClose == null ? void 0 : onClose();
|
|
54762
|
+
}
|
|
54543
54763
|
});
|
|
54544
54764
|
__publicField(this, "onShow", () => {
|
|
54545
|
-
|
|
54546
|
-
|
|
54547
|
-
|
|
54765
|
+
var _a;
|
|
54766
|
+
const session = this.session;
|
|
54767
|
+
const field = (_a = this.form.linkUrl) == null ? void 0 : _a.getField();
|
|
54768
|
+
clearTimeout(this.focusTimer);
|
|
54769
|
+
this.focusTimer = setTimeout(() => {
|
|
54770
|
+
if (this.isCurrent(session) && (field == null ? void 0 : field.isConnected)) {
|
|
54771
|
+
field.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54772
|
+
}
|
|
54548
54773
|
}, 400);
|
|
54549
54774
|
});
|
|
54550
54775
|
__publicField(this, "showPopup", (options) => {
|
|
54551
|
-
|
|
54776
|
+
const session = this.session;
|
|
54552
54777
|
if (clientType.isMobile) {
|
|
54553
54778
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54554
54779
|
} else {
|
|
54555
54780
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54556
54781
|
}
|
|
54557
|
-
|
|
54558
|
-
|
|
54559
|
-
|
|
54560
|
-
|
|
54561
|
-
|
|
54782
|
+
this.linkPopup.addListener("show", () => {
|
|
54783
|
+
if (this.isCurrent(session)) {
|
|
54784
|
+
this.onShow();
|
|
54785
|
+
}
|
|
54786
|
+
});
|
|
54787
|
+
this.linkPopup.addListener("finished", () => {
|
|
54788
|
+
if (this.isCurrent(session)) {
|
|
54789
|
+
this.handleOk();
|
|
54790
|
+
}
|
|
54791
|
+
});
|
|
54792
|
+
this.linkPopup.addListener("close", () => {
|
|
54793
|
+
if (this.isCurrent(session)) {
|
|
54794
|
+
this.handleClose();
|
|
54795
|
+
}
|
|
54796
|
+
});
|
|
54797
|
+
this.linkPopup.disabledSubmit();
|
|
54798
|
+
this.linkPopup.manualShow();
|
|
54562
54799
|
});
|
|
54563
54800
|
__publicField(this, "onChange", () => {
|
|
54564
54801
|
var _a;
|
|
@@ -54570,11 +54807,14 @@ ${codeText}
|
|
|
54570
54807
|
return;
|
|
54571
54808
|
}
|
|
54572
54809
|
if (event.key === "Enter") {
|
|
54573
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54810
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54811
|
+
event.preventDefault();
|
|
54574
54812
|
event.stopPropagation();
|
|
54575
54813
|
return;
|
|
54576
54814
|
}
|
|
54577
54815
|
if (event.key === "Escape") {
|
|
54816
|
+
event.preventDefault();
|
|
54817
|
+
event.stopPropagation();
|
|
54578
54818
|
this.handleClose();
|
|
54579
54819
|
}
|
|
54580
54820
|
});
|
|
@@ -54588,13 +54828,18 @@ ${codeText}
|
|
|
54588
54828
|
return;
|
|
54589
54829
|
}
|
|
54590
54830
|
if (event.key === "Escape") {
|
|
54831
|
+
event.preventDefault();
|
|
54832
|
+
event.stopPropagation();
|
|
54591
54833
|
this.handleClose();
|
|
54592
54834
|
}
|
|
54593
54835
|
});
|
|
54594
54836
|
this.editor = editor;
|
|
54595
54837
|
}
|
|
54596
|
-
|
|
54597
|
-
|
|
54838
|
+
isCurrent(session) {
|
|
54839
|
+
return session === this.session && !!this.linkPopup && !this.editor.destroyed;
|
|
54840
|
+
}
|
|
54841
|
+
async checkValue(form) {
|
|
54842
|
+
const { linkUrl } = form;
|
|
54598
54843
|
if (!linkUrl.getInputValue()) {
|
|
54599
54844
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54600
54845
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54612,14 +54857,20 @@ ${codeText}
|
|
|
54612
54857
|
return link2;
|
|
54613
54858
|
}
|
|
54614
54859
|
editLink(options) {
|
|
54615
|
-
this.
|
|
54860
|
+
this._destroy();
|
|
54861
|
+
if (this.editor.destroyed) {
|
|
54862
|
+
return;
|
|
54863
|
+
}
|
|
54864
|
+
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54616
54865
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54617
54866
|
this.onFinished = onFinished;
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54867
|
+
this.onClose = onClose != null ? onClose : null;
|
|
54868
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl != null ? onBeforeFormatUrl : null;
|
|
54869
|
+
try {
|
|
54870
|
+
this.showPopup(options);
|
|
54871
|
+
} catch (error2) {
|
|
54872
|
+
this._destroy();
|
|
54873
|
+
throw error2;
|
|
54623
54874
|
}
|
|
54624
54875
|
}
|
|
54625
54876
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54648,12 +54899,21 @@ ${codeText}
|
|
|
54648
54899
|
return content;
|
|
54649
54900
|
}
|
|
54650
54901
|
_destroy() {
|
|
54651
|
-
|
|
54902
|
+
this.session += 1;
|
|
54903
|
+
clearTimeout(this.focusTimer);
|
|
54904
|
+
this.focusTimer = void 0;
|
|
54905
|
+
const popup = this.linkPopup;
|
|
54906
|
+
const releaseFocus = this.releaseFocus;
|
|
54907
|
+
this.linkPopup = null;
|
|
54908
|
+
this.releaseFocus = void 0;
|
|
54909
|
+
this.submitting = false;
|
|
54652
54910
|
this.onFinished = null;
|
|
54653
54911
|
this.onClose = null;
|
|
54912
|
+
this.onBeforeFormatUrl = null;
|
|
54654
54913
|
this.form = {};
|
|
54655
|
-
|
|
54656
|
-
|
|
54914
|
+
popup == null ? void 0 : popup.removeAllListeners();
|
|
54915
|
+
popup == null ? void 0 : popup.destroy();
|
|
54916
|
+
releaseFocus == null ? void 0 : releaseFocus();
|
|
54657
54917
|
}
|
|
54658
54918
|
destroy() {
|
|
54659
54919
|
this._destroy();
|
|
@@ -54693,14 +54953,14 @@ ${codeText}
|
|
|
54693
54953
|
const text2 = [op1, op2];
|
|
54694
54954
|
editor.insertTextToBlock(block, 0, text2);
|
|
54695
54955
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54696
|
-
editor
|
|
54956
|
+
requestEditorFocus(editor);
|
|
54697
54957
|
} catch (error2) {
|
|
54698
54958
|
logger$21.error(error2);
|
|
54699
54959
|
}
|
|
54700
54960
|
});
|
|
54701
54961
|
};
|
|
54702
54962
|
const onClose = () => {
|
|
54703
|
-
editor
|
|
54963
|
+
requestEditorFocus(editor);
|
|
54704
54964
|
};
|
|
54705
54965
|
editLink(editor, {
|
|
54706
54966
|
target: block,
|
|
@@ -54732,21 +54992,21 @@ ${codeText}
|
|
|
54732
54992
|
if (isCollapsed) {
|
|
54733
54993
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
54734
54994
|
editor.setBlockText(block, newText);
|
|
54735
|
-
editor
|
|
54995
|
+
requestEditorFocus(editor);
|
|
54736
54996
|
return;
|
|
54737
54997
|
}
|
|
54738
54998
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
54739
54999
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
54740
55000
|
editor.setBlockText(block, newText);
|
|
54741
55001
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
54742
|
-
editor
|
|
55002
|
+
requestEditorFocus(editor);
|
|
54743
55003
|
} catch (error2) {
|
|
54744
55004
|
logger$21.error(error2);
|
|
54745
55005
|
}
|
|
54746
55006
|
});
|
|
54747
55007
|
};
|
|
54748
55008
|
const onClose = () => {
|
|
54749
|
-
editor
|
|
55009
|
+
requestEditorFocus(editor);
|
|
54750
55010
|
};
|
|
54751
55011
|
editLink(editor, {
|
|
54752
55012
|
target: anchor2,
|
|
@@ -54995,14 +55255,14 @@ ${codeText}
|
|
|
54995
55255
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
54996
55256
|
editor.setBlockText(block, newText);
|
|
54997
55257
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
54998
|
-
editor
|
|
55258
|
+
requestEditorFocus(editor);
|
|
54999
55259
|
} catch (error2) {
|
|
55000
55260
|
logger$20.error(error2);
|
|
55001
55261
|
}
|
|
55002
55262
|
};
|
|
55003
55263
|
const onClose = () => {
|
|
55004
55264
|
editor.selection.selectBlock(block, range.end);
|
|
55005
|
-
editor
|
|
55265
|
+
requestEditorFocus(editor);
|
|
55006
55266
|
};
|
|
55007
55267
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
55008
55268
|
if (!rect) {
|
|
@@ -55504,6 +55764,7 @@ ${codeText}
|
|
|
55504
55764
|
__publicField(this, "_disableTextToolbar", false);
|
|
55505
55765
|
__publicField(this, "_lastClickTime", 0);
|
|
55506
55766
|
__publicField(this, "_disabled", false);
|
|
55767
|
+
__publicField(this, "cancelFocus");
|
|
55507
55768
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55508
55769
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55509
55770
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55528,16 +55789,15 @@ ${codeText}
|
|
|
55528
55789
|
this._lastClickTime = Date.now();
|
|
55529
55790
|
});
|
|
55530
55791
|
__publicField(this, "handleClose", () => {
|
|
55531
|
-
var _a;
|
|
55792
|
+
var _a, _b;
|
|
55532
55793
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55533
55794
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55534
55795
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55535
55796
|
logger$1_.debug("focus is in block tools, ignore focus");
|
|
55536
55797
|
return;
|
|
55537
55798
|
}
|
|
55538
|
-
this.
|
|
55539
|
-
|
|
55540
|
-
});
|
|
55799
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
55800
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
55541
55801
|
}
|
|
55542
55802
|
});
|
|
55543
55803
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55666,8 +55926,10 @@ ${codeText}
|
|
|
55666
55926
|
this.toolbar.close("selectionChange");
|
|
55667
55927
|
}
|
|
55668
55928
|
destroy() {
|
|
55929
|
+
var _a;
|
|
55669
55930
|
this.unbindEvents();
|
|
55670
55931
|
this.toolbar.destroy();
|
|
55932
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55671
55933
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55672
55934
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55673
55935
|
}
|
|
@@ -76594,6 +76856,8 @@ ${codeText}
|
|
|
76594
76856
|
__publicField(this, "item");
|
|
76595
76857
|
__publicField(this, "docs", null);
|
|
76596
76858
|
__publicField(this, "checkedId");
|
|
76859
|
+
__publicField(this, "focusTimer", null);
|
|
76860
|
+
__publicField(this, "destroyed", false);
|
|
76597
76861
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76598
76862
|
if (!item.data) {
|
|
76599
76863
|
return;
|
|
@@ -76604,24 +76868,37 @@ ${codeText}
|
|
|
76604
76868
|
this.checkedId = item.id;
|
|
76605
76869
|
}
|
|
76606
76870
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76607
|
-
|
|
76871
|
+
this.clearFocusTimer();
|
|
76872
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
76873
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
76874
|
+
this.focusTimer = setTimeout(() => {
|
|
76875
|
+
this.clearFocusTimer();
|
|
76876
|
+
if (!this.canRestoreFocus()) {
|
|
76877
|
+
return;
|
|
76878
|
+
}
|
|
76608
76879
|
if (this.docs) {
|
|
76609
76880
|
this.show(this.docs);
|
|
76610
76881
|
}
|
|
76611
76882
|
this.editor.focus();
|
|
76612
76883
|
});
|
|
76613
76884
|
});
|
|
76614
|
-
__publicField(this, "handleClose", () => {
|
|
76615
|
-
|
|
76616
|
-
|
|
76617
|
-
if (tagName === "input" || tagName === "textarea") {
|
|
76885
|
+
__publicField(this, "handleClose", (bar2) => {
|
|
76886
|
+
if (bar2.closeReason === "clickBackground") {
|
|
76887
|
+
this.clearFocusTimer();
|
|
76618
76888
|
return;
|
|
76619
76889
|
}
|
|
76620
|
-
this.
|
|
76890
|
+
if (bar2.closeReason === "cancelBar" && this.canRestoreFocus()) {
|
|
76891
|
+
this.editor.focus();
|
|
76892
|
+
}
|
|
76621
76893
|
});
|
|
76622
76894
|
__publicField(this, "handleSelectionChange", () => {
|
|
76623
76895
|
if (this.toolbar.isVisible) {
|
|
76624
|
-
this.handleClose();
|
|
76896
|
+
this.handleClose(this.toolbar);
|
|
76897
|
+
}
|
|
76898
|
+
});
|
|
76899
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76900
|
+
if (!this.isFocusOwner(event.target)) {
|
|
76901
|
+
this.clearFocusTimer();
|
|
76625
76902
|
}
|
|
76626
76903
|
});
|
|
76627
76904
|
this.editor = editor;
|
|
@@ -76645,6 +76922,10 @@ ${codeText}
|
|
|
76645
76922
|
this.toolbar.addListener("close", this.handleClose);
|
|
76646
76923
|
}
|
|
76647
76924
|
show(docs) {
|
|
76925
|
+
this.clearFocusTimer();
|
|
76926
|
+
if (this.destroyed || this.editor.destroyed) {
|
|
76927
|
+
return;
|
|
76928
|
+
}
|
|
76648
76929
|
this.docs = docs;
|
|
76649
76930
|
const editor = this.editor;
|
|
76650
76931
|
const range = editor.selection.range;
|
|
@@ -76703,13 +76984,39 @@ ${codeText}
|
|
|
76703
76984
|
return doc2;
|
|
76704
76985
|
}
|
|
76705
76986
|
hide() {
|
|
76987
|
+
this.clearFocusTimer();
|
|
76706
76988
|
this.toolbar.close("selectionChange");
|
|
76707
76989
|
}
|
|
76708
76990
|
clearCheckedState() {
|
|
76709
76991
|
this.checkedId = void 0;
|
|
76710
76992
|
}
|
|
76711
76993
|
destroy() {
|
|
76994
|
+
var _a;
|
|
76995
|
+
this.destroyed = true;
|
|
76996
|
+
this.clearFocusTimer();
|
|
76712
76997
|
this.toolbar.destroy();
|
|
76998
|
+
(_a = this.anchor) == null ? void 0 : _a.remove();
|
|
76999
|
+
this.anchor = null;
|
|
77000
|
+
this.docs = null;
|
|
77001
|
+
}
|
|
77002
|
+
canRestoreFocus() {
|
|
77003
|
+
var _a;
|
|
77004
|
+
if (this.destroyed || this.editor.destroyed || !this.editor.rootElement.isConnected || !((_a = this.anchor) == null ? void 0 : _a.isConnected)) {
|
|
77005
|
+
return false;
|
|
77006
|
+
}
|
|
77007
|
+
const activeElement = document.activeElement;
|
|
77008
|
+
return !activeElement || activeElement === document.body || this.isFocusOwner(activeElement);
|
|
77009
|
+
}
|
|
77010
|
+
isFocusOwner(target) {
|
|
77011
|
+
return target instanceof Node && (this.editor.rootElement.contains(target) || this.toolbar.isInCommandBar(target));
|
|
77012
|
+
}
|
|
77013
|
+
clearFocusTimer() {
|
|
77014
|
+
if (this.focusTimer !== null) {
|
|
77015
|
+
clearTimeout(this.focusTimer);
|
|
77016
|
+
this.focusTimer = null;
|
|
77017
|
+
}
|
|
77018
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
77019
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
76713
77020
|
}
|
|
76714
77021
|
getCommandItems(docs) {
|
|
76715
77022
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -97231,14 +97538,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97231
97538
|
__publicField(this, "toolbar");
|
|
97232
97539
|
__publicField(this, "toolbarFullScreen");
|
|
97233
97540
|
__publicField(this, "root");
|
|
97541
|
+
__publicField(this, "cancelFocus");
|
|
97234
97542
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
97235
97543
|
const command = item;
|
|
97236
97544
|
if (command.onClick) {
|
|
97237
97545
|
command.onClick(this.editor, command, bar2);
|
|
97238
97546
|
this.handleSelectionChanged();
|
|
97239
|
-
|
|
97240
|
-
this.editor.focus();
|
|
97241
|
-
});
|
|
97547
|
+
this.restoreFocus();
|
|
97242
97548
|
return;
|
|
97243
97549
|
}
|
|
97244
97550
|
const findParent = (item2, id) => {
|
|
@@ -97284,9 +97590,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97284
97590
|
id: "main-toolbar"
|
|
97285
97591
|
});
|
|
97286
97592
|
this.toolbar.addListener("closing", () => {
|
|
97287
|
-
|
|
97288
|
-
editor.focus();
|
|
97289
|
-
}, 100);
|
|
97593
|
+
this.restoreFocus(100);
|
|
97290
97594
|
return true;
|
|
97291
97595
|
});
|
|
97292
97596
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -97317,11 +97621,18 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97317
97621
|
});
|
|
97318
97622
|
}
|
|
97319
97623
|
}
|
|
97320
|
-
|
|
97624
|
+
restoreFocus(delay = 0) {
|
|
97321
97625
|
var _a;
|
|
97626
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97627
|
+
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
97628
|
+
}
|
|
97629
|
+
destroy() {
|
|
97630
|
+
var _a, _b, _c;
|
|
97631
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97322
97632
|
this.toolbar.destroy();
|
|
97323
97633
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
97324
|
-
(
|
|
97634
|
+
(_b = this.toolbarFullScreen) == null ? void 0 : _b.destroy();
|
|
97635
|
+
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
97325
97636
|
this.root.remove();
|
|
97326
97637
|
}
|
|
97327
97638
|
setItems(items) {
|
|
@@ -98044,7 +98355,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98044
98355
|
}
|
|
98045
98356
|
}
|
|
98046
98357
|
});
|
|
98047
|
-
editor.version = "5.0.
|
|
98358
|
+
editor.version = "5.0.8-beta.ONES22302172.1";
|
|
98048
98359
|
return editor;
|
|
98049
98360
|
}
|
|
98050
98361
|
function isDoc(doc2) {
|
|
@@ -98180,7 +98491,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98180
98491
|
OnesEditorDropTarget.register(editor);
|
|
98181
98492
|
OnesEditorTocProvider.register(editor);
|
|
98182
98493
|
OnesEditorExclusiveBlock.register(editor);
|
|
98183
|
-
editor.version = "5.0.
|
|
98494
|
+
editor.version = "5.0.8-beta.ONES22302172.1";
|
|
98184
98495
|
return editor;
|
|
98185
98496
|
} catch (error2) {
|
|
98186
98497
|
try {
|
|
@@ -98323,7 +98634,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98323
98634
|
}
|
|
98324
98635
|
}
|
|
98325
98636
|
});
|
|
98326
|
-
editor.version = "5.0.
|
|
98637
|
+
editor.version = "5.0.8-beta.ONES22302172.1";
|
|
98327
98638
|
return editor;
|
|
98328
98639
|
}
|
|
98329
98640
|
const emojis$1 = {
|
|
@@ -144149,6 +144460,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144149
144460
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
144150
144461
|
exports2.FitIcon = FitIcon;
|
|
144151
144462
|
exports2.FixedToolbar = FixedToolbar;
|
|
144463
|
+
exports2.FocusRestoration = FocusRestoration;
|
|
144152
144464
|
exports2.FontBoldItem = FontBoldItem;
|
|
144153
144465
|
exports2.FontItalicItem = FontItalicItem;
|
|
144154
144466
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -144348,6 +144660,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144348
144660
|
exports2.YoukuIcon = YoukuIcon;
|
|
144349
144661
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
144350
144662
|
exports2.abbreviation = abbreviation;
|
|
144663
|
+
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
144351
144664
|
exports2.activeComment = activeComment;
|
|
144352
144665
|
exports2.addAttribute = addAttribute;
|
|
144353
144666
|
exports2.addClass = addClass;
|
|
@@ -144840,6 +145153,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144840
145153
|
exports2.replaceText = replaceText;
|
|
144841
145154
|
exports2.replaceWikiMacroResources = replaceWikiMacroResources;
|
|
144842
145155
|
exports2.requestDownload = requestDownload;
|
|
145156
|
+
exports2.requestEditorFocus = requestEditorFocus;
|
|
145157
|
+
exports2.requestInputFocus = requestInputFocus;
|
|
144843
145158
|
exports2.resetListStart = resetListStart;
|
|
144844
145159
|
exports2.saveAs = saveAs$1;
|
|
144845
145160
|
exports2.scrollBarIntoView = scrollBarIntoView;
|