@ones-editor/editor 4.0.6 → 4.0.7-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
|
@@ -26485,6 +26485,114 @@ var __publicField = (obj, key, value) => {
|
|
|
26485
26485
|
};
|
|
26486
26486
|
}
|
|
26487
26487
|
}
|
|
26488
|
+
const controllers = /* @__PURE__ */ new WeakMap();
|
|
26489
|
+
const noop$1 = () => {
|
|
26490
|
+
};
|
|
26491
|
+
class FocusRestoration {
|
|
26492
|
+
constructor(input2, restore) {
|
|
26493
|
+
__publicField(this, "generation", 0);
|
|
26494
|
+
__publicField(this, "owner", null);
|
|
26495
|
+
__publicField(this, "destroyed", false);
|
|
26496
|
+
__publicField(this, "activeScope");
|
|
26497
|
+
__publicField(this, "timers", /* @__PURE__ */ new Set());
|
|
26498
|
+
this.input = input2;
|
|
26499
|
+
this.restore = restore;
|
|
26500
|
+
controllers.set(input2, this);
|
|
26501
|
+
}
|
|
26502
|
+
canFocus() {
|
|
26503
|
+
var _a;
|
|
26504
|
+
return !this.destroyed && !this.owner && !((_a = this.activeScope) == null ? void 0 : _a.cancelled) && this.input.isConnected;
|
|
26505
|
+
}
|
|
26506
|
+
hasOtherInput() {
|
|
26507
|
+
const active = this.input.ownerDocument.activeElement;
|
|
26508
|
+
return active !== this.input && !!(active == null ? void 0 : active.matches('input, textarea, select, [contenteditable="true"], [contenteditable=""]'));
|
|
26509
|
+
}
|
|
26510
|
+
schedule(callback, delay = 0, protectUserFocus = false) {
|
|
26511
|
+
var _a;
|
|
26512
|
+
return this.scheduleInScope(callback, delay, protectUserFocus, (_a = this.activeScope) != null ? _a : this.createScope());
|
|
26513
|
+
}
|
|
26514
|
+
createScope() {
|
|
26515
|
+
return { cancelled: false, timers: /* @__PURE__ */ new Set() };
|
|
26516
|
+
}
|
|
26517
|
+
scheduleInScope(callback, delay, protectUserFocus, scope) {
|
|
26518
|
+
if (scope.cancelled || !this.canFocus()) {
|
|
26519
|
+
return noop$1;
|
|
26520
|
+
}
|
|
26521
|
+
const generation = this.generation;
|
|
26522
|
+
const timer = setTimeout(() => {
|
|
26523
|
+
this.timers.delete(timer);
|
|
26524
|
+
scope.timers.delete(timer);
|
|
26525
|
+
if (!scope.cancelled && generation === this.generation && this.canFocus() && (!protectUserFocus || !this.hasOtherInput())) {
|
|
26526
|
+
const previousScope = this.activeScope;
|
|
26527
|
+
this.activeScope = scope;
|
|
26528
|
+
try {
|
|
26529
|
+
callback();
|
|
26530
|
+
} finally {
|
|
26531
|
+
this.activeScope = previousScope;
|
|
26532
|
+
}
|
|
26533
|
+
}
|
|
26534
|
+
}, delay);
|
|
26535
|
+
this.timers.add(timer);
|
|
26536
|
+
scope.timers.add(timer);
|
|
26537
|
+
return () => {
|
|
26538
|
+
scope.cancelled = true;
|
|
26539
|
+
scope.timers.forEach((pending) => {
|
|
26540
|
+
clearTimeout(pending);
|
|
26541
|
+
this.timers.delete(pending);
|
|
26542
|
+
});
|
|
26543
|
+
scope.timers.clear();
|
|
26544
|
+
};
|
|
26545
|
+
}
|
|
26546
|
+
request(delay = 0) {
|
|
26547
|
+
return this.scheduleInScope(this.restore, delay, !clientType.isMobile, this.createScope());
|
|
26548
|
+
}
|
|
26549
|
+
cancelPending() {
|
|
26550
|
+
if (this.activeScope) {
|
|
26551
|
+
this.activeScope.cancelled = true;
|
|
26552
|
+
}
|
|
26553
|
+
this.generation += 1;
|
|
26554
|
+
this.timers.forEach((timer) => clearTimeout(timer));
|
|
26555
|
+
this.timers.clear();
|
|
26556
|
+
}
|
|
26557
|
+
acquire() {
|
|
26558
|
+
this.cancelPending();
|
|
26559
|
+
const owner = {};
|
|
26560
|
+
this.owner = owner;
|
|
26561
|
+
return () => {
|
|
26562
|
+
if (this.owner === owner) {
|
|
26563
|
+
this.cancelPending();
|
|
26564
|
+
this.owner = null;
|
|
26565
|
+
}
|
|
26566
|
+
};
|
|
26567
|
+
}
|
|
26568
|
+
destroy() {
|
|
26569
|
+
this.destroyed = true;
|
|
26570
|
+
this.cancelPending();
|
|
26571
|
+
this.owner = null;
|
|
26572
|
+
controllers.delete(this.input);
|
|
26573
|
+
}
|
|
26574
|
+
}
|
|
26575
|
+
function requestInputFocus(input2, delay = 0) {
|
|
26576
|
+
var _a, _b;
|
|
26577
|
+
return (_b = (_a = controllers.get(input2)) == null ? void 0 : _a.request(delay)) != null ? _b : noop$1;
|
|
26578
|
+
}
|
|
26579
|
+
function requestEditorFocus(editor, delay = 0) {
|
|
26580
|
+
if (editor.destroyed) {
|
|
26581
|
+
return noop$1;
|
|
26582
|
+
}
|
|
26583
|
+
if (clientType.isMobile && delay === 0) {
|
|
26584
|
+
editor.focus();
|
|
26585
|
+
return noop$1;
|
|
26586
|
+
}
|
|
26587
|
+
return requestInputFocus(editor.input.inputElement, delay);
|
|
26588
|
+
}
|
|
26589
|
+
function acquireEditorFocus(editor) {
|
|
26590
|
+
var _a, _b;
|
|
26591
|
+
if (clientType.isMobile || editor.destroyed) {
|
|
26592
|
+
return noop$1;
|
|
26593
|
+
}
|
|
26594
|
+
return (_b = (_a = controllers.get(editor.input.inputElement)) == null ? void 0 : _a.acquire()) != null ? _b : noop$1;
|
|
26595
|
+
}
|
|
26488
26596
|
const logger$3V = getLogger("editor-input");
|
|
26489
26597
|
class EditorInput$1 {
|
|
26490
26598
|
constructor(editor, callbacks) {
|
|
@@ -26494,6 +26602,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26494
26602
|
__publicField(this, "callbacks");
|
|
26495
26603
|
__publicField(this, "inputElement");
|
|
26496
26604
|
__publicField(this, "focused", false);
|
|
26605
|
+
__publicField(this, "focusRestoration");
|
|
26497
26606
|
__publicField(this, "handleBlur", () => {
|
|
26498
26607
|
this.editor.emit("blur", this.editor);
|
|
26499
26608
|
this.callbacks.onBlur();
|
|
@@ -26515,12 +26624,20 @@ var __publicField = (obj, key, value) => {
|
|
|
26515
26624
|
const isInDisableScrollMask = this.isInDisableScrollMask(target);
|
|
26516
26625
|
if (target && (isInDisableScrollMask || rootElement === target || rootElement.contains(target))) {
|
|
26517
26626
|
if (!isInDisableScrollMask && !isInBlockTools(target)) {
|
|
26518
|
-
|
|
26627
|
+
const focus = () => {
|
|
26628
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26629
|
+
return;
|
|
26630
|
+
}
|
|
26519
26631
|
this.editor.emit("focus", this.editor);
|
|
26520
26632
|
this.callbacks.onFocus();
|
|
26521
26633
|
this.editor.input.focus();
|
|
26522
26634
|
this.focused = true;
|
|
26523
|
-
}
|
|
26635
|
+
};
|
|
26636
|
+
if (clientType.isMobile) {
|
|
26637
|
+
setTimeout(focus);
|
|
26638
|
+
} else {
|
|
26639
|
+
this.focusRestoration.schedule(focus);
|
|
26640
|
+
}
|
|
26524
26641
|
}
|
|
26525
26642
|
return;
|
|
26526
26643
|
}
|
|
@@ -26655,6 +26772,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26655
26772
|
input2.addEventListener("compositionstart", this.handleCompositionstart);
|
|
26656
26773
|
input2.addEventListener("compositionend", this.handleCompositionend);
|
|
26657
26774
|
this.inputElement = input2;
|
|
26775
|
+
this.focusRestoration = new FocusRestoration(input2, () => {
|
|
26776
|
+
if (!this.editor.destroyed) {
|
|
26777
|
+
this.editor.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
26778
|
+
}
|
|
26779
|
+
});
|
|
26658
26780
|
if (clientType.isMobile) {
|
|
26659
26781
|
document.addEventListener("touchend", this.handleDocumentClick);
|
|
26660
26782
|
} else {
|
|
@@ -26677,6 +26799,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26677
26799
|
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"));
|
|
26678
26800
|
}
|
|
26679
26801
|
destroy() {
|
|
26802
|
+
this.focusRestoration.destroy();
|
|
26680
26803
|
this.callbacks.destroy();
|
|
26681
26804
|
if (clientType.isMobile) {
|
|
26682
26805
|
document.removeEventListener("touchend", this.handleDocumentClick);
|
|
@@ -26701,24 +26824,36 @@ var __publicField = (obj, key, value) => {
|
|
|
26701
26824
|
return this.inputElement;
|
|
26702
26825
|
}
|
|
26703
26826
|
focus(options) {
|
|
26827
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26828
|
+
return;
|
|
26829
|
+
}
|
|
26704
26830
|
if (!this.editor.selection.caret.visible()) {
|
|
26705
26831
|
this.editor.selection.caret.update();
|
|
26706
26832
|
}
|
|
26707
26833
|
if (clientType.isMobile) {
|
|
26708
26834
|
this.inputElement.focus(options);
|
|
26709
26835
|
this.callbacks.onFocus();
|
|
26836
|
+
this.focused = true;
|
|
26710
26837
|
} else {
|
|
26711
|
-
|
|
26838
|
+
this.focusRestoration.schedule(() => {
|
|
26839
|
+
if (this.editor.destroyed) {
|
|
26840
|
+
return;
|
|
26841
|
+
}
|
|
26712
26842
|
if (document.activeElement !== this.inputElement) {
|
|
26713
|
-
|
|
26714
|
-
this.editor.
|
|
26843
|
+
this.focusRestoration.schedule(() => {
|
|
26844
|
+
if (!this.editor.destroyed && document.activeElement === this.inputElement) {
|
|
26845
|
+
this.editor.emit("focus", this.editor);
|
|
26846
|
+
}
|
|
26715
26847
|
});
|
|
26716
26848
|
}
|
|
26717
26849
|
this.inputElement.focus(options);
|
|
26850
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26851
|
+
return;
|
|
26852
|
+
}
|
|
26718
26853
|
this.callbacks.onFocus();
|
|
26719
|
-
|
|
26854
|
+
this.focused = true;
|
|
26855
|
+
}, 0, (options == null ? void 0 : options.preventScroll) === true);
|
|
26720
26856
|
}
|
|
26721
|
-
this.focused = true;
|
|
26722
26857
|
}
|
|
26723
26858
|
isInDisableScrollMask(target) {
|
|
26724
26859
|
let elem = target;
|
|
@@ -32282,7 +32417,7 @@ ${codeText}
|
|
|
32282
32417
|
editor.doc.endBatchUpdate();
|
|
32283
32418
|
}
|
|
32284
32419
|
if (!clientType.isMobile) {
|
|
32285
|
-
editor
|
|
32420
|
+
requestEditorFocus(editor);
|
|
32286
32421
|
}
|
|
32287
32422
|
return rangeResult;
|
|
32288
32423
|
});
|
|
@@ -42594,8 +42729,13 @@ ${codeText}
|
|
|
42594
42729
|
});
|
|
42595
42730
|
__publicField(this, "tippyInstance", null);
|
|
42596
42731
|
__publicField(this, "_target", null);
|
|
42732
|
+
__publicField(this, "cancelFocus");
|
|
42733
|
+
__publicField(this, "focusTimer", null);
|
|
42734
|
+
__publicField(this, "focusRestoreGeneration", 0);
|
|
42597
42735
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42598
42736
|
var _a;
|
|
42737
|
+
const focusOwner = this.getFocusOwner();
|
|
42738
|
+
focusOwner.clearFocusTimer();
|
|
42599
42739
|
let ret = false;
|
|
42600
42740
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42601
42741
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42603,32 +42743,78 @@ ${codeText}
|
|
|
42603
42743
|
if (ret) {
|
|
42604
42744
|
return ret;
|
|
42605
42745
|
}
|
|
42606
|
-
|
|
42607
|
-
return ret;
|
|
42608
|
-
}
|
|
42609
|
-
const target = this._target;
|
|
42610
|
-
setTimeout(() => {
|
|
42611
|
-
const parentEditor = target.closest(".editor-root");
|
|
42612
|
-
if (parentEditor) {
|
|
42613
|
-
const input2 = parentEditor.querySelector(".editor-input");
|
|
42614
|
-
if (input2) {
|
|
42615
|
-
if (parentEditor.contains(document.activeElement)) {
|
|
42616
|
-
return;
|
|
42617
|
-
}
|
|
42618
|
-
input2.focus();
|
|
42619
|
-
}
|
|
42620
|
-
}
|
|
42621
|
-
}, 100);
|
|
42746
|
+
focusOwner.restoreFocusAfterClose(event);
|
|
42622
42747
|
return ret;
|
|
42623
42748
|
});
|
|
42749
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
42750
|
+
if (!this.isFocusOwner(event.target)) {
|
|
42751
|
+
this.clearFocusTimer();
|
|
42752
|
+
}
|
|
42753
|
+
});
|
|
42754
|
+
__publicField(this, "handleWindowBlur", () => {
|
|
42755
|
+
this.clearFocusTimer();
|
|
42756
|
+
});
|
|
42624
42757
|
__publicField(this, "setProps", (props) => {
|
|
42625
42758
|
var _a;
|
|
42626
42759
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
42627
42760
|
});
|
|
42628
42761
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42629
42762
|
}
|
|
42763
|
+
getFocusOwner() {
|
|
42764
|
+
return this.closeable instanceof ManualCommandBar ? this.closeable.getFocusOwner() : this;
|
|
42765
|
+
}
|
|
42766
|
+
restoreFocusAfterClose(event) {
|
|
42767
|
+
if (!this._target) {
|
|
42768
|
+
return;
|
|
42769
|
+
}
|
|
42770
|
+
const target = this._target;
|
|
42771
|
+
const parentEditor = target.closest(".editor-root");
|
|
42772
|
+
if (!parentEditor || event && !this.isFocusOwner(event.target)) {
|
|
42773
|
+
return;
|
|
42774
|
+
}
|
|
42775
|
+
const generation = this.focusRestoreGeneration;
|
|
42776
|
+
document.addEventListener("mousedown", this.handleFocusInteraction, true);
|
|
42777
|
+
document.addEventListener("focusin", this.handleFocusInteraction, true);
|
|
42778
|
+
window.addEventListener("blur", this.handleWindowBlur);
|
|
42779
|
+
this.focusTimer = setTimeout(() => {
|
|
42780
|
+
if (generation !== this.focusRestoreGeneration) {
|
|
42781
|
+
return;
|
|
42782
|
+
}
|
|
42783
|
+
this.clearFocusTimer();
|
|
42784
|
+
const input2 = parentEditor.querySelector(".editor-input");
|
|
42785
|
+
if (this._target !== target || !target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected) || !document.hasFocus()) {
|
|
42786
|
+
return;
|
|
42787
|
+
}
|
|
42788
|
+
const activeElement = document.activeElement;
|
|
42789
|
+
if (parentEditor.contains(activeElement)) {
|
|
42790
|
+
return;
|
|
42791
|
+
}
|
|
42792
|
+
if (!activeElement || activeElement === document.body || activeElement === document.documentElement || this.isInCommandBar(activeElement)) {
|
|
42793
|
+
this.cancelFocus = requestInputFocus(input2);
|
|
42794
|
+
}
|
|
42795
|
+
}, 100);
|
|
42796
|
+
}
|
|
42797
|
+
isFocusOwner(target) {
|
|
42798
|
+
var _a;
|
|
42799
|
+
const parentEditor = (_a = this._target) == null ? void 0 : _a.closest(".editor-root");
|
|
42800
|
+
return target instanceof Node && (!!(parentEditor == null ? void 0 : parentEditor.contains(target)) || this.isInCommandBar(target));
|
|
42801
|
+
}
|
|
42802
|
+
clearFocusTimer() {
|
|
42803
|
+
var _a;
|
|
42804
|
+
this.focusRestoreGeneration += 1;
|
|
42805
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
42806
|
+
this.cancelFocus = void 0;
|
|
42807
|
+
if (this.focusTimer !== null) {
|
|
42808
|
+
clearTimeout(this.focusTimer);
|
|
42809
|
+
this.focusTimer = null;
|
|
42810
|
+
}
|
|
42811
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction, true);
|
|
42812
|
+
document.removeEventListener("focusin", this.handleFocusInteraction, true);
|
|
42813
|
+
window.removeEventListener("blur", this.handleWindowBlur);
|
|
42814
|
+
}
|
|
42630
42815
|
manualShow(target, options) {
|
|
42631
42816
|
var _a, _b, _c, _d;
|
|
42817
|
+
this.getFocusOwner().clearFocusTimer();
|
|
42632
42818
|
this._target = target;
|
|
42633
42819
|
if (this.isVisible) {
|
|
42634
42820
|
return;
|
|
@@ -42677,6 +42863,9 @@ ${codeText}
|
|
|
42677
42863
|
}
|
|
42678
42864
|
close(reason, e2) {
|
|
42679
42865
|
var _a, _b;
|
|
42866
|
+
if (reason === "clickBackground" || reason && reason !== "cancelBar" && reason !== "clickItem") {
|
|
42867
|
+
this.clearFocusTimer();
|
|
42868
|
+
}
|
|
42680
42869
|
super.close(reason);
|
|
42681
42870
|
if (this.isVisible) {
|
|
42682
42871
|
if (e2) {
|
|
@@ -42687,10 +42876,12 @@ ${codeText}
|
|
|
42687
42876
|
}
|
|
42688
42877
|
}
|
|
42689
42878
|
destroy() {
|
|
42690
|
-
var _a;
|
|
42879
|
+
var _a, _b;
|
|
42880
|
+
this.clearFocusTimer();
|
|
42691
42881
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42692
42882
|
this.tippyInstance = null;
|
|
42693
42883
|
super.destroy();
|
|
42884
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
42694
42885
|
}
|
|
42695
42886
|
getCommandBarRoot() {
|
|
42696
42887
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -44816,19 +45007,22 @@ ${codeText}
|
|
|
44816
45007
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
44817
45008
|
constructor(editor, editorOptions) {
|
|
44818
45009
|
super(editorOptions);
|
|
45010
|
+
__publicField(this, "cancelFocus");
|
|
44819
45011
|
__publicField(this, "handleClose", () => {
|
|
44820
|
-
var _a, _b;
|
|
45012
|
+
var _a, _b, _c;
|
|
45013
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
44821
45014
|
if (shouldFocusToEditor(this.editor)) {
|
|
44822
|
-
this.editor
|
|
45015
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
44823
45016
|
}
|
|
44824
|
-
(
|
|
45017
|
+
(_c = (_b = this.options).onClose) == null ? void 0 : _c.call(_b);
|
|
44825
45018
|
});
|
|
44826
45019
|
this.editor = editor;
|
|
44827
45020
|
this.editorOptions = editorOptions;
|
|
44828
45021
|
}
|
|
44829
45022
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
44830
|
-
var _a, _b;
|
|
44831
|
-
|
|
45023
|
+
var _a, _b, _c;
|
|
45024
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45025
|
+
if (((_c = (_b = this.editorOptions).onShow) == null ? void 0 : _c.call(_b, this, containerId, blockIndex, offset)) === false) {
|
|
44832
45026
|
return;
|
|
44833
45027
|
}
|
|
44834
45028
|
if (this.options.showLoading) {
|
|
@@ -44846,6 +45040,11 @@ ${codeText}
|
|
|
44846
45040
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
44847
45041
|
super.popup(anchor2, { noEvent: true });
|
|
44848
45042
|
}
|
|
45043
|
+
destroy() {
|
|
45044
|
+
var _a;
|
|
45045
|
+
super.destroy();
|
|
45046
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45047
|
+
}
|
|
44849
45048
|
}
|
|
44850
45049
|
const logger$2G = getLogger("auto-suggest-menu");
|
|
44851
45050
|
class OnesEditorAutoSuggest {
|
|
@@ -54187,6 +54386,7 @@ ${codeText}
|
|
|
54187
54386
|
});
|
|
54188
54387
|
__publicField(this, "close", () => {
|
|
54189
54388
|
this.linkPopup.close("cancelBar");
|
|
54389
|
+
this.emit("close");
|
|
54190
54390
|
});
|
|
54191
54391
|
__publicField(this, "createItems", (content) => [{
|
|
54192
54392
|
id: "link-popup",
|
|
@@ -54208,7 +54408,6 @@ ${codeText}
|
|
|
54208
54408
|
this.emit("finished");
|
|
54209
54409
|
});
|
|
54210
54410
|
__publicField(this, "handleClose", () => {
|
|
54211
|
-
this.emit("close");
|
|
54212
54411
|
this.close();
|
|
54213
54412
|
});
|
|
54214
54413
|
__publicField(this, "handleShown", () => {
|
|
@@ -54237,8 +54436,13 @@ ${codeText}
|
|
|
54237
54436
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54238
54437
|
id: "link-popup",
|
|
54239
54438
|
header: this.createHeader(),
|
|
54240
|
-
disableSelectedScroll: true
|
|
54439
|
+
disableSelectedScroll: true,
|
|
54440
|
+
beforeClose: () => {
|
|
54441
|
+
this.handleClose();
|
|
54442
|
+
return true;
|
|
54443
|
+
}
|
|
54241
54444
|
});
|
|
54445
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54242
54446
|
}
|
|
54243
54447
|
destroy() {
|
|
54244
54448
|
var _a, _b;
|
|
@@ -54257,11 +54461,11 @@ ${codeText}
|
|
|
54257
54461
|
this.emit("finished");
|
|
54258
54462
|
});
|
|
54259
54463
|
__publicField(this, "handleClose", () => {
|
|
54260
|
-
this.emit("close");
|
|
54261
54464
|
this.close();
|
|
54262
54465
|
});
|
|
54263
54466
|
__publicField(this, "close", () => {
|
|
54264
54467
|
this.linkPopup.close("cancelBar");
|
|
54468
|
+
this.emit("close");
|
|
54265
54469
|
});
|
|
54266
54470
|
__publicField(this, "disabledSubmit", () => {
|
|
54267
54471
|
var _a;
|
|
@@ -54281,8 +54485,13 @@ ${codeText}
|
|
|
54281
54485
|
this.content = content;
|
|
54282
54486
|
this.options = options;
|
|
54283
54487
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54284
|
-
id: "link-popup"
|
|
54488
|
+
id: "link-popup",
|
|
54489
|
+
beforeClose: () => {
|
|
54490
|
+
this.handleClose();
|
|
54491
|
+
return true;
|
|
54492
|
+
}
|
|
54285
54493
|
});
|
|
54494
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54286
54495
|
}
|
|
54287
54496
|
createPopupContent() {
|
|
54288
54497
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54315,46 +54524,85 @@ ${codeText}
|
|
|
54315
54524
|
__publicField(this, "onFinished", null);
|
|
54316
54525
|
__publicField(this, "onClose", null);
|
|
54317
54526
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54527
|
+
__publicField(this, "session", 0);
|
|
54528
|
+
__publicField(this, "submitting", false);
|
|
54529
|
+
__publicField(this, "focusTimer");
|
|
54530
|
+
__publicField(this, "releaseFocus");
|
|
54318
54531
|
__publicField(this, "handleOk", async () => {
|
|
54319
|
-
|
|
54532
|
+
if (!this.linkPopup || this.submitting || this.editor.destroyed) {
|
|
54533
|
+
return;
|
|
54534
|
+
}
|
|
54535
|
+
const session = this.session;
|
|
54536
|
+
const form = this.form;
|
|
54537
|
+
const onFinished = this.onFinished;
|
|
54538
|
+
const beforeFormatUrl = this.onBeforeFormatUrl;
|
|
54539
|
+
this.submitting = true;
|
|
54320
54540
|
try {
|
|
54321
|
-
await this.checkValue();
|
|
54322
|
-
|
|
54541
|
+
await this.checkValue(form);
|
|
54542
|
+
if (!this.isCurrent(session)) {
|
|
54543
|
+
return;
|
|
54544
|
+
}
|
|
54545
|
+
const { linkText, linkUrl } = form;
|
|
54323
54546
|
const inputValue = linkUrl.getInputValue();
|
|
54324
|
-
|
|
54325
|
-
|
|
54326
|
-
|
|
54327
|
-
|
|
54328
|
-
|
|
54547
|
+
const formatted = beforeFormatUrl == null ? void 0 : beforeFormatUrl(inputValue);
|
|
54548
|
+
const link2 = typeof formatted === "string" ? formatted : this.formatUrl(inputValue);
|
|
54549
|
+
const text2 = linkText.getInputValue() || link2;
|
|
54550
|
+
if (!this.isCurrent(session)) {
|
|
54551
|
+
return;
|
|
54329
54552
|
}
|
|
54330
|
-
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54331
54553
|
this._destroy();
|
|
54554
|
+
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54332
54555
|
} catch (error2) {
|
|
54556
|
+
if (this.isCurrent(session)) {
|
|
54557
|
+
this.submitting = false;
|
|
54558
|
+
}
|
|
54333
54559
|
}
|
|
54334
54560
|
});
|
|
54335
54561
|
__publicField(this, "handleClose", () => {
|
|
54336
|
-
|
|
54337
|
-
|
|
54562
|
+
if (!this.linkPopup) {
|
|
54563
|
+
return;
|
|
54564
|
+
}
|
|
54565
|
+
const onClose = this.onClose;
|
|
54338
54566
|
this._destroy();
|
|
54567
|
+
if (!this.editor.destroyed) {
|
|
54568
|
+
onClose == null ? void 0 : onClose();
|
|
54569
|
+
}
|
|
54339
54570
|
});
|
|
54340
54571
|
__publicField(this, "onShow", () => {
|
|
54341
|
-
|
|
54342
|
-
|
|
54343
|
-
|
|
54572
|
+
var _a;
|
|
54573
|
+
const session = this.session;
|
|
54574
|
+
const field = (_a = this.form.linkUrl) == null ? void 0 : _a.getField();
|
|
54575
|
+
clearTimeout(this.focusTimer);
|
|
54576
|
+
this.focusTimer = setTimeout(() => {
|
|
54577
|
+
if (this.isCurrent(session) && (field == null ? void 0 : field.isConnected)) {
|
|
54578
|
+
field.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54579
|
+
}
|
|
54344
54580
|
}, 400);
|
|
54345
54581
|
});
|
|
54346
54582
|
__publicField(this, "showPopup", (options) => {
|
|
54347
|
-
|
|
54583
|
+
const session = this.session;
|
|
54348
54584
|
if (clientType.isMobile) {
|
|
54349
54585
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54350
54586
|
} else {
|
|
54351
54587
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54352
54588
|
}
|
|
54353
|
-
|
|
54354
|
-
|
|
54355
|
-
|
|
54356
|
-
|
|
54357
|
-
|
|
54589
|
+
this.linkPopup.addListener("show", () => {
|
|
54590
|
+
if (this.isCurrent(session)) {
|
|
54591
|
+
this.onShow();
|
|
54592
|
+
}
|
|
54593
|
+
});
|
|
54594
|
+
this.linkPopup.addListener("finished", () => {
|
|
54595
|
+
if (this.isCurrent(session)) {
|
|
54596
|
+
this.handleOk();
|
|
54597
|
+
}
|
|
54598
|
+
});
|
|
54599
|
+
this.linkPopup.addListener("close", () => {
|
|
54600
|
+
if (this.isCurrent(session)) {
|
|
54601
|
+
this.handleClose();
|
|
54602
|
+
}
|
|
54603
|
+
});
|
|
54604
|
+
this.linkPopup.disabledSubmit();
|
|
54605
|
+
this.linkPopup.manualShow();
|
|
54358
54606
|
});
|
|
54359
54607
|
__publicField(this, "onChange", () => {
|
|
54360
54608
|
var _a;
|
|
@@ -54366,11 +54614,14 @@ ${codeText}
|
|
|
54366
54614
|
return;
|
|
54367
54615
|
}
|
|
54368
54616
|
if (event.key === "Enter") {
|
|
54369
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54617
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54618
|
+
event.preventDefault();
|
|
54370
54619
|
event.stopPropagation();
|
|
54371
54620
|
return;
|
|
54372
54621
|
}
|
|
54373
54622
|
if (event.key === "Escape") {
|
|
54623
|
+
event.preventDefault();
|
|
54624
|
+
event.stopPropagation();
|
|
54374
54625
|
this.handleClose();
|
|
54375
54626
|
}
|
|
54376
54627
|
});
|
|
@@ -54384,13 +54635,18 @@ ${codeText}
|
|
|
54384
54635
|
return;
|
|
54385
54636
|
}
|
|
54386
54637
|
if (event.key === "Escape") {
|
|
54638
|
+
event.preventDefault();
|
|
54639
|
+
event.stopPropagation();
|
|
54387
54640
|
this.handleClose();
|
|
54388
54641
|
}
|
|
54389
54642
|
});
|
|
54390
54643
|
this.editor = editor;
|
|
54391
54644
|
}
|
|
54392
|
-
|
|
54393
|
-
|
|
54645
|
+
isCurrent(session) {
|
|
54646
|
+
return session === this.session && !!this.linkPopup && !this.editor.destroyed;
|
|
54647
|
+
}
|
|
54648
|
+
async checkValue(form) {
|
|
54649
|
+
const { linkUrl } = form;
|
|
54394
54650
|
if (!linkUrl.getInputValue()) {
|
|
54395
54651
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54396
54652
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54408,14 +54664,20 @@ ${codeText}
|
|
|
54408
54664
|
return link2;
|
|
54409
54665
|
}
|
|
54410
54666
|
editLink(options) {
|
|
54411
|
-
this.
|
|
54667
|
+
this._destroy();
|
|
54668
|
+
if (this.editor.destroyed) {
|
|
54669
|
+
return;
|
|
54670
|
+
}
|
|
54671
|
+
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54412
54672
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54413
54673
|
this.onFinished = onFinished;
|
|
54414
|
-
|
|
54415
|
-
|
|
54416
|
-
|
|
54417
|
-
|
|
54418
|
-
|
|
54674
|
+
this.onClose = onClose != null ? onClose : null;
|
|
54675
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl != null ? onBeforeFormatUrl : null;
|
|
54676
|
+
try {
|
|
54677
|
+
this.showPopup(options);
|
|
54678
|
+
} catch (error2) {
|
|
54679
|
+
this._destroy();
|
|
54680
|
+
throw error2;
|
|
54419
54681
|
}
|
|
54420
54682
|
}
|
|
54421
54683
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54444,12 +54706,21 @@ ${codeText}
|
|
|
54444
54706
|
return content;
|
|
54445
54707
|
}
|
|
54446
54708
|
_destroy() {
|
|
54447
|
-
|
|
54709
|
+
this.session += 1;
|
|
54710
|
+
clearTimeout(this.focusTimer);
|
|
54711
|
+
this.focusTimer = void 0;
|
|
54712
|
+
const popup = this.linkPopup;
|
|
54713
|
+
const releaseFocus = this.releaseFocus;
|
|
54714
|
+
this.linkPopup = null;
|
|
54715
|
+
this.releaseFocus = void 0;
|
|
54716
|
+
this.submitting = false;
|
|
54448
54717
|
this.onFinished = null;
|
|
54449
54718
|
this.onClose = null;
|
|
54719
|
+
this.onBeforeFormatUrl = null;
|
|
54450
54720
|
this.form = {};
|
|
54451
|
-
|
|
54452
|
-
|
|
54721
|
+
popup == null ? void 0 : popup.removeAllListeners();
|
|
54722
|
+
popup == null ? void 0 : popup.destroy();
|
|
54723
|
+
releaseFocus == null ? void 0 : releaseFocus();
|
|
54453
54724
|
}
|
|
54454
54725
|
destroy() {
|
|
54455
54726
|
this._destroy();
|
|
@@ -54489,14 +54760,14 @@ ${codeText}
|
|
|
54489
54760
|
const text2 = [op1, op2];
|
|
54490
54761
|
editor.insertTextToBlock(block, 0, text2);
|
|
54491
54762
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54492
|
-
editor
|
|
54763
|
+
requestEditorFocus(editor);
|
|
54493
54764
|
} catch (error2) {
|
|
54494
54765
|
logger$20.error(error2);
|
|
54495
54766
|
}
|
|
54496
54767
|
});
|
|
54497
54768
|
};
|
|
54498
54769
|
const onClose = () => {
|
|
54499
|
-
editor
|
|
54770
|
+
requestEditorFocus(editor);
|
|
54500
54771
|
};
|
|
54501
54772
|
editLink(editor, {
|
|
54502
54773
|
target: block,
|
|
@@ -54528,21 +54799,21 @@ ${codeText}
|
|
|
54528
54799
|
if (isCollapsed) {
|
|
54529
54800
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
54530
54801
|
editor.setBlockText(block, newText);
|
|
54531
|
-
editor
|
|
54802
|
+
requestEditorFocus(editor);
|
|
54532
54803
|
return;
|
|
54533
54804
|
}
|
|
54534
54805
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
54535
54806
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
54536
54807
|
editor.setBlockText(block, newText);
|
|
54537
54808
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
54538
|
-
editor
|
|
54809
|
+
requestEditorFocus(editor);
|
|
54539
54810
|
} catch (error2) {
|
|
54540
54811
|
logger$20.error(error2);
|
|
54541
54812
|
}
|
|
54542
54813
|
});
|
|
54543
54814
|
};
|
|
54544
54815
|
const onClose = () => {
|
|
54545
|
-
editor
|
|
54816
|
+
requestEditorFocus(editor);
|
|
54546
54817
|
};
|
|
54547
54818
|
editLink(editor, {
|
|
54548
54819
|
target: anchor2,
|
|
@@ -54791,14 +55062,14 @@ ${codeText}
|
|
|
54791
55062
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
54792
55063
|
editor.setBlockText(block, newText);
|
|
54793
55064
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
54794
|
-
editor
|
|
55065
|
+
requestEditorFocus(editor);
|
|
54795
55066
|
} catch (error2) {
|
|
54796
55067
|
logger$1$.error(error2);
|
|
54797
55068
|
}
|
|
54798
55069
|
};
|
|
54799
55070
|
const onClose = () => {
|
|
54800
55071
|
editor.selection.selectBlock(block, range.end);
|
|
54801
|
-
editor
|
|
55072
|
+
requestEditorFocus(editor);
|
|
54802
55073
|
};
|
|
54803
55074
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
54804
55075
|
if (!rect) {
|
|
@@ -55300,6 +55571,7 @@ ${codeText}
|
|
|
55300
55571
|
__publicField(this, "_disableTextToolbar", false);
|
|
55301
55572
|
__publicField(this, "_lastClickTime", 0);
|
|
55302
55573
|
__publicField(this, "_disabled", false);
|
|
55574
|
+
__publicField(this, "cancelFocus");
|
|
55303
55575
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55304
55576
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55305
55577
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55323,17 +55595,23 @@ ${codeText}
|
|
|
55323
55595
|
}
|
|
55324
55596
|
this._lastClickTime = Date.now();
|
|
55325
55597
|
});
|
|
55326
|
-
__publicField(this, "handleClose", () => {
|
|
55327
|
-
var _a;
|
|
55598
|
+
__publicField(this, "handleClose", (toolbar2) => {
|
|
55599
|
+
var _a, _b;
|
|
55600
|
+
if (toolbar2.closeReason === "clickBackground" || !this.editor.rootElement.isConnected) {
|
|
55601
|
+
return;
|
|
55602
|
+
}
|
|
55603
|
+
const focusedElement = document.activeElement;
|
|
55604
|
+
if (focusedElement && focusedElement !== document.body && focusedElement !== document.documentElement && !this.editor.rootElement.contains(focusedElement) && !toolbar2.isInCommandBar(focusedElement)) {
|
|
55605
|
+
return;
|
|
55606
|
+
}
|
|
55328
55607
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55329
55608
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55330
55609
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55331
55610
|
logger$1Z.debug("focus is in block tools, ignore focus");
|
|
55332
55611
|
return;
|
|
55333
55612
|
}
|
|
55334
|
-
this.
|
|
55335
|
-
|
|
55336
|
-
});
|
|
55613
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
55614
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
55337
55615
|
}
|
|
55338
55616
|
});
|
|
55339
55617
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55462,8 +55740,10 @@ ${codeText}
|
|
|
55462
55740
|
this.toolbar.close("selectionChange");
|
|
55463
55741
|
}
|
|
55464
55742
|
destroy() {
|
|
55743
|
+
var _a;
|
|
55465
55744
|
this.unbindEvents();
|
|
55466
55745
|
this.toolbar.destroy();
|
|
55746
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55467
55747
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55468
55748
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55469
55749
|
}
|
|
@@ -76307,6 +76587,8 @@ ${codeText}
|
|
|
76307
76587
|
__publicField(this, "item");
|
|
76308
76588
|
__publicField(this, "docs", null);
|
|
76309
76589
|
__publicField(this, "checkedId");
|
|
76590
|
+
__publicField(this, "focusTimer", null);
|
|
76591
|
+
__publicField(this, "destroyed", false);
|
|
76310
76592
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76311
76593
|
if (!item.data) {
|
|
76312
76594
|
return;
|
|
@@ -76317,24 +76599,37 @@ ${codeText}
|
|
|
76317
76599
|
this.checkedId = item.id;
|
|
76318
76600
|
}
|
|
76319
76601
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76320
|
-
|
|
76602
|
+
this.clearFocusTimer();
|
|
76603
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
76604
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
76605
|
+
this.focusTimer = setTimeout(() => {
|
|
76606
|
+
this.clearFocusTimer();
|
|
76607
|
+
if (!this.canRestoreFocus()) {
|
|
76608
|
+
return;
|
|
76609
|
+
}
|
|
76321
76610
|
if (this.docs) {
|
|
76322
76611
|
this.show(this.docs);
|
|
76323
76612
|
}
|
|
76324
76613
|
this.editor.focus();
|
|
76325
76614
|
});
|
|
76326
76615
|
});
|
|
76327
|
-
__publicField(this, "handleClose", () => {
|
|
76328
|
-
|
|
76329
|
-
|
|
76330
|
-
if (tagName === "input" || tagName === "textarea") {
|
|
76616
|
+
__publicField(this, "handleClose", (bar2) => {
|
|
76617
|
+
if (bar2.closeReason === "clickBackground") {
|
|
76618
|
+
this.clearFocusTimer();
|
|
76331
76619
|
return;
|
|
76332
76620
|
}
|
|
76333
|
-
this.
|
|
76621
|
+
if (bar2.closeReason === "cancelBar" && this.canRestoreFocus()) {
|
|
76622
|
+
this.editor.focus();
|
|
76623
|
+
}
|
|
76334
76624
|
});
|
|
76335
76625
|
__publicField(this, "handleSelectionChange", () => {
|
|
76336
76626
|
if (this.toolbar.isVisible) {
|
|
76337
|
-
this.handleClose();
|
|
76627
|
+
this.handleClose(this.toolbar);
|
|
76628
|
+
}
|
|
76629
|
+
});
|
|
76630
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76631
|
+
if (!this.isFocusOwner(event.target)) {
|
|
76632
|
+
this.clearFocusTimer();
|
|
76338
76633
|
}
|
|
76339
76634
|
});
|
|
76340
76635
|
this.editor = editor;
|
|
@@ -76358,6 +76653,10 @@ ${codeText}
|
|
|
76358
76653
|
this.toolbar.addListener("close", this.handleClose);
|
|
76359
76654
|
}
|
|
76360
76655
|
show(docs) {
|
|
76656
|
+
this.clearFocusTimer();
|
|
76657
|
+
if (this.destroyed || this.editor.destroyed) {
|
|
76658
|
+
return;
|
|
76659
|
+
}
|
|
76361
76660
|
this.docs = docs;
|
|
76362
76661
|
const editor = this.editor;
|
|
76363
76662
|
const range = editor.selection.range;
|
|
@@ -76416,13 +76715,39 @@ ${codeText}
|
|
|
76416
76715
|
return doc2;
|
|
76417
76716
|
}
|
|
76418
76717
|
hide() {
|
|
76718
|
+
this.clearFocusTimer();
|
|
76419
76719
|
this.toolbar.close("selectionChange");
|
|
76420
76720
|
}
|
|
76421
76721
|
clearCheckedState() {
|
|
76422
76722
|
this.checkedId = void 0;
|
|
76423
76723
|
}
|
|
76424
76724
|
destroy() {
|
|
76725
|
+
var _a;
|
|
76726
|
+
this.destroyed = true;
|
|
76727
|
+
this.clearFocusTimer();
|
|
76425
76728
|
this.toolbar.destroy();
|
|
76729
|
+
(_a = this.anchor) == null ? void 0 : _a.remove();
|
|
76730
|
+
this.anchor = null;
|
|
76731
|
+
this.docs = null;
|
|
76732
|
+
}
|
|
76733
|
+
canRestoreFocus() {
|
|
76734
|
+
var _a;
|
|
76735
|
+
if (this.destroyed || this.editor.destroyed || !this.editor.rootElement.isConnected || !((_a = this.anchor) == null ? void 0 : _a.isConnected)) {
|
|
76736
|
+
return false;
|
|
76737
|
+
}
|
|
76738
|
+
const activeElement = document.activeElement;
|
|
76739
|
+
return !activeElement || activeElement === document.body || this.isFocusOwner(activeElement);
|
|
76740
|
+
}
|
|
76741
|
+
isFocusOwner(target) {
|
|
76742
|
+
return target instanceof Node && (this.editor.rootElement.contains(target) || this.toolbar.isInCommandBar(target));
|
|
76743
|
+
}
|
|
76744
|
+
clearFocusTimer() {
|
|
76745
|
+
if (this.focusTimer !== null) {
|
|
76746
|
+
clearTimeout(this.focusTimer);
|
|
76747
|
+
this.focusTimer = null;
|
|
76748
|
+
}
|
|
76749
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
76750
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
76426
76751
|
}
|
|
76427
76752
|
getCommandItems(docs) {
|
|
76428
76753
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -96850,14 +97175,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96850
97175
|
__publicField(this, "toolbar");
|
|
96851
97176
|
__publicField(this, "toolbarFullScreen");
|
|
96852
97177
|
__publicField(this, "root");
|
|
97178
|
+
__publicField(this, "cancelFocus");
|
|
96853
97179
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
96854
97180
|
const command = item;
|
|
96855
97181
|
if (command.onClick) {
|
|
96856
97182
|
command.onClick(this.editor, command, bar2);
|
|
96857
97183
|
this.handleSelectionChanged();
|
|
96858
|
-
|
|
96859
|
-
this.editor.focus();
|
|
96860
|
-
});
|
|
97184
|
+
this.restoreFocus();
|
|
96861
97185
|
return;
|
|
96862
97186
|
}
|
|
96863
97187
|
const findParent = (item2, id) => {
|
|
@@ -96903,9 +97227,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96903
97227
|
id: "main-toolbar"
|
|
96904
97228
|
});
|
|
96905
97229
|
this.toolbar.addListener("closing", () => {
|
|
96906
|
-
|
|
96907
|
-
editor.focus();
|
|
96908
|
-
}, 100);
|
|
97230
|
+
this.restoreFocus(100);
|
|
96909
97231
|
return true;
|
|
96910
97232
|
});
|
|
96911
97233
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -96936,11 +97258,18 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96936
97258
|
});
|
|
96937
97259
|
}
|
|
96938
97260
|
}
|
|
96939
|
-
|
|
97261
|
+
restoreFocus(delay = 0) {
|
|
96940
97262
|
var _a;
|
|
97263
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97264
|
+
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
97265
|
+
}
|
|
97266
|
+
destroy() {
|
|
97267
|
+
var _a, _b, _c;
|
|
97268
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
96941
97269
|
this.toolbar.destroy();
|
|
96942
97270
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
96943
|
-
(
|
|
97271
|
+
(_b = this.toolbarFullScreen) == null ? void 0 : _b.destroy();
|
|
97272
|
+
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
96944
97273
|
this.root.remove();
|
|
96945
97274
|
}
|
|
96946
97275
|
setItems(items) {
|
|
@@ -97532,7 +97861,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97532
97861
|
}
|
|
97533
97862
|
}
|
|
97534
97863
|
});
|
|
97535
|
-
editor.version = "4.0.
|
|
97864
|
+
editor.version = "4.0.7-beta.ONES22302592.1";
|
|
97536
97865
|
return editor;
|
|
97537
97866
|
}
|
|
97538
97867
|
function isDoc(doc2) {
|
|
@@ -97668,7 +97997,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97668
97997
|
OnesEditorDropTarget.register(editor);
|
|
97669
97998
|
OnesEditorTocProvider.register(editor);
|
|
97670
97999
|
OnesEditorExclusiveBlock.register(editor);
|
|
97671
|
-
editor.version = "4.0.
|
|
98000
|
+
editor.version = "4.0.7-beta.ONES22302592.1";
|
|
97672
98001
|
return editor;
|
|
97673
98002
|
} catch (error2) {
|
|
97674
98003
|
try {
|
|
@@ -97811,7 +98140,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97811
98140
|
}
|
|
97812
98141
|
}
|
|
97813
98142
|
});
|
|
97814
|
-
editor.version = "4.0.
|
|
98143
|
+
editor.version = "4.0.7-beta.ONES22302592.1";
|
|
97815
98144
|
return editor;
|
|
97816
98145
|
}
|
|
97817
98146
|
const emojis$1 = {
|
|
@@ -143637,6 +143966,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143637
143966
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
143638
143967
|
exports2.FitIcon = FitIcon;
|
|
143639
143968
|
exports2.FixedToolbar = FixedToolbar;
|
|
143969
|
+
exports2.FocusRestoration = FocusRestoration;
|
|
143640
143970
|
exports2.FontBoldItem = FontBoldItem;
|
|
143641
143971
|
exports2.FontItalicItem = FontItalicItem;
|
|
143642
143972
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -143835,6 +144165,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143835
144165
|
exports2.YoukuIcon = YoukuIcon;
|
|
143836
144166
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
143837
144167
|
exports2.abbreviation = abbreviation;
|
|
144168
|
+
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
143838
144169
|
exports2.activeComment = activeComment;
|
|
143839
144170
|
exports2.addAttribute = addAttribute;
|
|
143840
144171
|
exports2.addClass = addClass;
|
|
@@ -144320,6 +144651,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144320
144651
|
exports2.replaceAllText = replaceAllText;
|
|
144321
144652
|
exports2.replaceText = replaceText;
|
|
144322
144653
|
exports2.requestDownload = requestDownload;
|
|
144654
|
+
exports2.requestEditorFocus = requestEditorFocus;
|
|
144655
|
+
exports2.requestInputFocus = requestInputFocus;
|
|
144323
144656
|
exports2.resetListStart = resetListStart;
|
|
144324
144657
|
exports2.saveAs = saveAs$1;
|
|
144325
144658
|
exports2.scrollBarIntoView = scrollBarIntoView;
|