@ones-editor/editor 4.0.6 → 4.0.7-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
|
@@ -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,12 @@ ${codeText}
|
|
|
42594
42729
|
});
|
|
42595
42730
|
__publicField(this, "tippyInstance", null);
|
|
42596
42731
|
__publicField(this, "_target", null);
|
|
42732
|
+
__publicField(this, "cancelFocus");
|
|
42733
|
+
__publicField(this, "focusTimer", null);
|
|
42597
42734
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42598
42735
|
var _a;
|
|
42736
|
+
const focusOwner = this.getFocusOwner();
|
|
42737
|
+
focusOwner.clearFocusTimer();
|
|
42599
42738
|
let ret = false;
|
|
42600
42739
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42601
42740
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42603,32 +42742,68 @@ ${codeText}
|
|
|
42603
42742
|
if (ret) {
|
|
42604
42743
|
return ret;
|
|
42605
42744
|
}
|
|
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);
|
|
42745
|
+
focusOwner.restoreFocusAfterClose(event);
|
|
42622
42746
|
return ret;
|
|
42623
42747
|
});
|
|
42748
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
42749
|
+
if (!this.isFocusOwner(event.target)) {
|
|
42750
|
+
this.clearFocusTimer();
|
|
42751
|
+
}
|
|
42752
|
+
});
|
|
42624
42753
|
__publicField(this, "setProps", (props) => {
|
|
42625
42754
|
var _a;
|
|
42626
42755
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
42627
42756
|
});
|
|
42628
42757
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42629
42758
|
}
|
|
42759
|
+
getFocusOwner() {
|
|
42760
|
+
return this.closeable instanceof ManualCommandBar ? this.closeable.getFocusOwner() : this;
|
|
42761
|
+
}
|
|
42762
|
+
restoreFocusAfterClose(event) {
|
|
42763
|
+
if (!this._target) {
|
|
42764
|
+
return;
|
|
42765
|
+
}
|
|
42766
|
+
const target = this._target;
|
|
42767
|
+
const parentEditor = target.closest(".editor-root");
|
|
42768
|
+
if (!parentEditor || event && !this.isFocusOwner(event.target)) {
|
|
42769
|
+
return;
|
|
42770
|
+
}
|
|
42771
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
42772
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
42773
|
+
this.focusTimer = setTimeout(() => {
|
|
42774
|
+
this.clearFocusTimer();
|
|
42775
|
+
const input2 = parentEditor.querySelector(".editor-input");
|
|
42776
|
+
if (!target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected)) {
|
|
42777
|
+
return;
|
|
42778
|
+
}
|
|
42779
|
+
const activeElement = document.activeElement;
|
|
42780
|
+
if (parentEditor.contains(activeElement)) {
|
|
42781
|
+
return;
|
|
42782
|
+
}
|
|
42783
|
+
if (!activeElement || activeElement === document.body || this.isInCommandBar(activeElement)) {
|
|
42784
|
+
this.cancelFocus = requestInputFocus(input2);
|
|
42785
|
+
}
|
|
42786
|
+
}, 100);
|
|
42787
|
+
}
|
|
42788
|
+
isFocusOwner(target) {
|
|
42789
|
+
var _a;
|
|
42790
|
+
const parentEditor = (_a = this._target) == null ? void 0 : _a.closest(".editor-root");
|
|
42791
|
+
return target instanceof Node && (!!(parentEditor == null ? void 0 : parentEditor.contains(target)) || this.isInCommandBar(target));
|
|
42792
|
+
}
|
|
42793
|
+
clearFocusTimer() {
|
|
42794
|
+
var _a;
|
|
42795
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
42796
|
+
this.cancelFocus = void 0;
|
|
42797
|
+
if (this.focusTimer !== null) {
|
|
42798
|
+
clearTimeout(this.focusTimer);
|
|
42799
|
+
this.focusTimer = null;
|
|
42800
|
+
}
|
|
42801
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
42802
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
42803
|
+
}
|
|
42630
42804
|
manualShow(target, options) {
|
|
42631
42805
|
var _a, _b, _c, _d;
|
|
42806
|
+
this.getFocusOwner().clearFocusTimer();
|
|
42632
42807
|
this._target = target;
|
|
42633
42808
|
if (this.isVisible) {
|
|
42634
42809
|
return;
|
|
@@ -42677,6 +42852,9 @@ ${codeText}
|
|
|
42677
42852
|
}
|
|
42678
42853
|
close(reason, e2) {
|
|
42679
42854
|
var _a, _b;
|
|
42855
|
+
if (reason && reason !== "clickBackground" && reason !== "cancelBar" && reason !== "clickItem") {
|
|
42856
|
+
this.clearFocusTimer();
|
|
42857
|
+
}
|
|
42680
42858
|
super.close(reason);
|
|
42681
42859
|
if (this.isVisible) {
|
|
42682
42860
|
if (e2) {
|
|
@@ -42687,10 +42865,12 @@ ${codeText}
|
|
|
42687
42865
|
}
|
|
42688
42866
|
}
|
|
42689
42867
|
destroy() {
|
|
42690
|
-
var _a;
|
|
42868
|
+
var _a, _b;
|
|
42869
|
+
this.clearFocusTimer();
|
|
42691
42870
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42692
42871
|
this.tippyInstance = null;
|
|
42693
42872
|
super.destroy();
|
|
42873
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
42694
42874
|
}
|
|
42695
42875
|
getCommandBarRoot() {
|
|
42696
42876
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -44816,19 +44996,22 @@ ${codeText}
|
|
|
44816
44996
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
44817
44997
|
constructor(editor, editorOptions) {
|
|
44818
44998
|
super(editorOptions);
|
|
44999
|
+
__publicField(this, "cancelFocus");
|
|
44819
45000
|
__publicField(this, "handleClose", () => {
|
|
44820
|
-
var _a, _b;
|
|
45001
|
+
var _a, _b, _c;
|
|
45002
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
44821
45003
|
if (shouldFocusToEditor(this.editor)) {
|
|
44822
|
-
this.editor
|
|
45004
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
44823
45005
|
}
|
|
44824
|
-
(
|
|
45006
|
+
(_c = (_b = this.options).onClose) == null ? void 0 : _c.call(_b);
|
|
44825
45007
|
});
|
|
44826
45008
|
this.editor = editor;
|
|
44827
45009
|
this.editorOptions = editorOptions;
|
|
44828
45010
|
}
|
|
44829
45011
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
44830
|
-
var _a, _b;
|
|
44831
|
-
|
|
45012
|
+
var _a, _b, _c;
|
|
45013
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45014
|
+
if (((_c = (_b = this.editorOptions).onShow) == null ? void 0 : _c.call(_b, this, containerId, blockIndex, offset)) === false) {
|
|
44832
45015
|
return;
|
|
44833
45016
|
}
|
|
44834
45017
|
if (this.options.showLoading) {
|
|
@@ -44846,6 +45029,11 @@ ${codeText}
|
|
|
44846
45029
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
44847
45030
|
super.popup(anchor2, { noEvent: true });
|
|
44848
45031
|
}
|
|
45032
|
+
destroy() {
|
|
45033
|
+
var _a;
|
|
45034
|
+
super.destroy();
|
|
45035
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
45036
|
+
}
|
|
44849
45037
|
}
|
|
44850
45038
|
const logger$2G = getLogger("auto-suggest-menu");
|
|
44851
45039
|
class OnesEditorAutoSuggest {
|
|
@@ -54187,6 +54375,7 @@ ${codeText}
|
|
|
54187
54375
|
});
|
|
54188
54376
|
__publicField(this, "close", () => {
|
|
54189
54377
|
this.linkPopup.close("cancelBar");
|
|
54378
|
+
this.emit("close");
|
|
54190
54379
|
});
|
|
54191
54380
|
__publicField(this, "createItems", (content) => [{
|
|
54192
54381
|
id: "link-popup",
|
|
@@ -54208,7 +54397,6 @@ ${codeText}
|
|
|
54208
54397
|
this.emit("finished");
|
|
54209
54398
|
});
|
|
54210
54399
|
__publicField(this, "handleClose", () => {
|
|
54211
|
-
this.emit("close");
|
|
54212
54400
|
this.close();
|
|
54213
54401
|
});
|
|
54214
54402
|
__publicField(this, "handleShown", () => {
|
|
@@ -54237,8 +54425,13 @@ ${codeText}
|
|
|
54237
54425
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54238
54426
|
id: "link-popup",
|
|
54239
54427
|
header: this.createHeader(),
|
|
54240
|
-
disableSelectedScroll: true
|
|
54428
|
+
disableSelectedScroll: true,
|
|
54429
|
+
beforeClose: () => {
|
|
54430
|
+
this.handleClose();
|
|
54431
|
+
return true;
|
|
54432
|
+
}
|
|
54241
54433
|
});
|
|
54434
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54242
54435
|
}
|
|
54243
54436
|
destroy() {
|
|
54244
54437
|
var _a, _b;
|
|
@@ -54257,11 +54450,11 @@ ${codeText}
|
|
|
54257
54450
|
this.emit("finished");
|
|
54258
54451
|
});
|
|
54259
54452
|
__publicField(this, "handleClose", () => {
|
|
54260
|
-
this.emit("close");
|
|
54261
54453
|
this.close();
|
|
54262
54454
|
});
|
|
54263
54455
|
__publicField(this, "close", () => {
|
|
54264
54456
|
this.linkPopup.close("cancelBar");
|
|
54457
|
+
this.emit("close");
|
|
54265
54458
|
});
|
|
54266
54459
|
__publicField(this, "disabledSubmit", () => {
|
|
54267
54460
|
var _a;
|
|
@@ -54281,8 +54474,13 @@ ${codeText}
|
|
|
54281
54474
|
this.content = content;
|
|
54282
54475
|
this.options = options;
|
|
54283
54476
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54284
|
-
id: "link-popup"
|
|
54477
|
+
id: "link-popup",
|
|
54478
|
+
beforeClose: () => {
|
|
54479
|
+
this.handleClose();
|
|
54480
|
+
return true;
|
|
54481
|
+
}
|
|
54285
54482
|
});
|
|
54483
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54286
54484
|
}
|
|
54287
54485
|
createPopupContent() {
|
|
54288
54486
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54315,46 +54513,85 @@ ${codeText}
|
|
|
54315
54513
|
__publicField(this, "onFinished", null);
|
|
54316
54514
|
__publicField(this, "onClose", null);
|
|
54317
54515
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54516
|
+
__publicField(this, "session", 0);
|
|
54517
|
+
__publicField(this, "submitting", false);
|
|
54518
|
+
__publicField(this, "focusTimer");
|
|
54519
|
+
__publicField(this, "releaseFocus");
|
|
54318
54520
|
__publicField(this, "handleOk", async () => {
|
|
54319
|
-
|
|
54521
|
+
if (!this.linkPopup || this.submitting || this.editor.destroyed) {
|
|
54522
|
+
return;
|
|
54523
|
+
}
|
|
54524
|
+
const session = this.session;
|
|
54525
|
+
const form = this.form;
|
|
54526
|
+
const onFinished = this.onFinished;
|
|
54527
|
+
const beforeFormatUrl = this.onBeforeFormatUrl;
|
|
54528
|
+
this.submitting = true;
|
|
54320
54529
|
try {
|
|
54321
|
-
await this.checkValue();
|
|
54322
|
-
|
|
54530
|
+
await this.checkValue(form);
|
|
54531
|
+
if (!this.isCurrent(session)) {
|
|
54532
|
+
return;
|
|
54533
|
+
}
|
|
54534
|
+
const { linkText, linkUrl } = form;
|
|
54323
54535
|
const inputValue = linkUrl.getInputValue();
|
|
54324
|
-
|
|
54325
|
-
|
|
54326
|
-
|
|
54327
|
-
|
|
54328
|
-
|
|
54536
|
+
const formatted = beforeFormatUrl == null ? void 0 : beforeFormatUrl(inputValue);
|
|
54537
|
+
const link2 = typeof formatted === "string" ? formatted : this.formatUrl(inputValue);
|
|
54538
|
+
const text2 = linkText.getInputValue() || link2;
|
|
54539
|
+
if (!this.isCurrent(session)) {
|
|
54540
|
+
return;
|
|
54329
54541
|
}
|
|
54330
|
-
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54331
54542
|
this._destroy();
|
|
54543
|
+
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54332
54544
|
} catch (error2) {
|
|
54545
|
+
if (this.isCurrent(session)) {
|
|
54546
|
+
this.submitting = false;
|
|
54547
|
+
}
|
|
54333
54548
|
}
|
|
54334
54549
|
});
|
|
54335
54550
|
__publicField(this, "handleClose", () => {
|
|
54336
|
-
|
|
54337
|
-
|
|
54551
|
+
if (!this.linkPopup) {
|
|
54552
|
+
return;
|
|
54553
|
+
}
|
|
54554
|
+
const onClose = this.onClose;
|
|
54338
54555
|
this._destroy();
|
|
54556
|
+
if (!this.editor.destroyed) {
|
|
54557
|
+
onClose == null ? void 0 : onClose();
|
|
54558
|
+
}
|
|
54339
54559
|
});
|
|
54340
54560
|
__publicField(this, "onShow", () => {
|
|
54341
|
-
|
|
54342
|
-
|
|
54343
|
-
|
|
54561
|
+
var _a;
|
|
54562
|
+
const session = this.session;
|
|
54563
|
+
const field = (_a = this.form.linkUrl) == null ? void 0 : _a.getField();
|
|
54564
|
+
clearTimeout(this.focusTimer);
|
|
54565
|
+
this.focusTimer = setTimeout(() => {
|
|
54566
|
+
if (this.isCurrent(session) && (field == null ? void 0 : field.isConnected)) {
|
|
54567
|
+
field.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54568
|
+
}
|
|
54344
54569
|
}, 400);
|
|
54345
54570
|
});
|
|
54346
54571
|
__publicField(this, "showPopup", (options) => {
|
|
54347
|
-
|
|
54572
|
+
const session = this.session;
|
|
54348
54573
|
if (clientType.isMobile) {
|
|
54349
54574
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54350
54575
|
} else {
|
|
54351
54576
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54352
54577
|
}
|
|
54353
|
-
|
|
54354
|
-
|
|
54355
|
-
|
|
54356
|
-
|
|
54357
|
-
|
|
54578
|
+
this.linkPopup.addListener("show", () => {
|
|
54579
|
+
if (this.isCurrent(session)) {
|
|
54580
|
+
this.onShow();
|
|
54581
|
+
}
|
|
54582
|
+
});
|
|
54583
|
+
this.linkPopup.addListener("finished", () => {
|
|
54584
|
+
if (this.isCurrent(session)) {
|
|
54585
|
+
this.handleOk();
|
|
54586
|
+
}
|
|
54587
|
+
});
|
|
54588
|
+
this.linkPopup.addListener("close", () => {
|
|
54589
|
+
if (this.isCurrent(session)) {
|
|
54590
|
+
this.handleClose();
|
|
54591
|
+
}
|
|
54592
|
+
});
|
|
54593
|
+
this.linkPopup.disabledSubmit();
|
|
54594
|
+
this.linkPopup.manualShow();
|
|
54358
54595
|
});
|
|
54359
54596
|
__publicField(this, "onChange", () => {
|
|
54360
54597
|
var _a;
|
|
@@ -54366,11 +54603,14 @@ ${codeText}
|
|
|
54366
54603
|
return;
|
|
54367
54604
|
}
|
|
54368
54605
|
if (event.key === "Enter") {
|
|
54369
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54606
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54607
|
+
event.preventDefault();
|
|
54370
54608
|
event.stopPropagation();
|
|
54371
54609
|
return;
|
|
54372
54610
|
}
|
|
54373
54611
|
if (event.key === "Escape") {
|
|
54612
|
+
event.preventDefault();
|
|
54613
|
+
event.stopPropagation();
|
|
54374
54614
|
this.handleClose();
|
|
54375
54615
|
}
|
|
54376
54616
|
});
|
|
@@ -54384,13 +54624,18 @@ ${codeText}
|
|
|
54384
54624
|
return;
|
|
54385
54625
|
}
|
|
54386
54626
|
if (event.key === "Escape") {
|
|
54627
|
+
event.preventDefault();
|
|
54628
|
+
event.stopPropagation();
|
|
54387
54629
|
this.handleClose();
|
|
54388
54630
|
}
|
|
54389
54631
|
});
|
|
54390
54632
|
this.editor = editor;
|
|
54391
54633
|
}
|
|
54392
|
-
|
|
54393
|
-
|
|
54634
|
+
isCurrent(session) {
|
|
54635
|
+
return session === this.session && !!this.linkPopup && !this.editor.destroyed;
|
|
54636
|
+
}
|
|
54637
|
+
async checkValue(form) {
|
|
54638
|
+
const { linkUrl } = form;
|
|
54394
54639
|
if (!linkUrl.getInputValue()) {
|
|
54395
54640
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54396
54641
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54408,14 +54653,20 @@ ${codeText}
|
|
|
54408
54653
|
return link2;
|
|
54409
54654
|
}
|
|
54410
54655
|
editLink(options) {
|
|
54411
|
-
this.
|
|
54656
|
+
this._destroy();
|
|
54657
|
+
if (this.editor.destroyed) {
|
|
54658
|
+
return;
|
|
54659
|
+
}
|
|
54660
|
+
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54412
54661
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54413
54662
|
this.onFinished = onFinished;
|
|
54414
|
-
|
|
54415
|
-
|
|
54416
|
-
|
|
54417
|
-
|
|
54418
|
-
|
|
54663
|
+
this.onClose = onClose != null ? onClose : null;
|
|
54664
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl != null ? onBeforeFormatUrl : null;
|
|
54665
|
+
try {
|
|
54666
|
+
this.showPopup(options);
|
|
54667
|
+
} catch (error2) {
|
|
54668
|
+
this._destroy();
|
|
54669
|
+
throw error2;
|
|
54419
54670
|
}
|
|
54420
54671
|
}
|
|
54421
54672
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54444,12 +54695,21 @@ ${codeText}
|
|
|
54444
54695
|
return content;
|
|
54445
54696
|
}
|
|
54446
54697
|
_destroy() {
|
|
54447
|
-
|
|
54698
|
+
this.session += 1;
|
|
54699
|
+
clearTimeout(this.focusTimer);
|
|
54700
|
+
this.focusTimer = void 0;
|
|
54701
|
+
const popup = this.linkPopup;
|
|
54702
|
+
const releaseFocus = this.releaseFocus;
|
|
54703
|
+
this.linkPopup = null;
|
|
54704
|
+
this.releaseFocus = void 0;
|
|
54705
|
+
this.submitting = false;
|
|
54448
54706
|
this.onFinished = null;
|
|
54449
54707
|
this.onClose = null;
|
|
54708
|
+
this.onBeforeFormatUrl = null;
|
|
54450
54709
|
this.form = {};
|
|
54451
|
-
|
|
54452
|
-
|
|
54710
|
+
popup == null ? void 0 : popup.removeAllListeners();
|
|
54711
|
+
popup == null ? void 0 : popup.destroy();
|
|
54712
|
+
releaseFocus == null ? void 0 : releaseFocus();
|
|
54453
54713
|
}
|
|
54454
54714
|
destroy() {
|
|
54455
54715
|
this._destroy();
|
|
@@ -54489,14 +54749,14 @@ ${codeText}
|
|
|
54489
54749
|
const text2 = [op1, op2];
|
|
54490
54750
|
editor.insertTextToBlock(block, 0, text2);
|
|
54491
54751
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54492
|
-
editor
|
|
54752
|
+
requestEditorFocus(editor);
|
|
54493
54753
|
} catch (error2) {
|
|
54494
54754
|
logger$20.error(error2);
|
|
54495
54755
|
}
|
|
54496
54756
|
});
|
|
54497
54757
|
};
|
|
54498
54758
|
const onClose = () => {
|
|
54499
|
-
editor
|
|
54759
|
+
requestEditorFocus(editor);
|
|
54500
54760
|
};
|
|
54501
54761
|
editLink(editor, {
|
|
54502
54762
|
target: block,
|
|
@@ -54528,21 +54788,21 @@ ${codeText}
|
|
|
54528
54788
|
if (isCollapsed) {
|
|
54529
54789
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
54530
54790
|
editor.setBlockText(block, newText);
|
|
54531
|
-
editor
|
|
54791
|
+
requestEditorFocus(editor);
|
|
54532
54792
|
return;
|
|
54533
54793
|
}
|
|
54534
54794
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
54535
54795
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
54536
54796
|
editor.setBlockText(block, newText);
|
|
54537
54797
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
54538
|
-
editor
|
|
54798
|
+
requestEditorFocus(editor);
|
|
54539
54799
|
} catch (error2) {
|
|
54540
54800
|
logger$20.error(error2);
|
|
54541
54801
|
}
|
|
54542
54802
|
});
|
|
54543
54803
|
};
|
|
54544
54804
|
const onClose = () => {
|
|
54545
|
-
editor
|
|
54805
|
+
requestEditorFocus(editor);
|
|
54546
54806
|
};
|
|
54547
54807
|
editLink(editor, {
|
|
54548
54808
|
target: anchor2,
|
|
@@ -54791,14 +55051,14 @@ ${codeText}
|
|
|
54791
55051
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
54792
55052
|
editor.setBlockText(block, newText);
|
|
54793
55053
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
54794
|
-
editor
|
|
55054
|
+
requestEditorFocus(editor);
|
|
54795
55055
|
} catch (error2) {
|
|
54796
55056
|
logger$1$.error(error2);
|
|
54797
55057
|
}
|
|
54798
55058
|
};
|
|
54799
55059
|
const onClose = () => {
|
|
54800
55060
|
editor.selection.selectBlock(block, range.end);
|
|
54801
|
-
editor
|
|
55061
|
+
requestEditorFocus(editor);
|
|
54802
55062
|
};
|
|
54803
55063
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
54804
55064
|
if (!rect) {
|
|
@@ -55300,6 +55560,7 @@ ${codeText}
|
|
|
55300
55560
|
__publicField(this, "_disableTextToolbar", false);
|
|
55301
55561
|
__publicField(this, "_lastClickTime", 0);
|
|
55302
55562
|
__publicField(this, "_disabled", false);
|
|
55563
|
+
__publicField(this, "cancelFocus");
|
|
55303
55564
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55304
55565
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55305
55566
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55324,16 +55585,15 @@ ${codeText}
|
|
|
55324
55585
|
this._lastClickTime = Date.now();
|
|
55325
55586
|
});
|
|
55326
55587
|
__publicField(this, "handleClose", () => {
|
|
55327
|
-
var _a;
|
|
55588
|
+
var _a, _b;
|
|
55328
55589
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55329
55590
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55330
55591
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55331
55592
|
logger$1Z.debug("focus is in block tools, ignore focus");
|
|
55332
55593
|
return;
|
|
55333
55594
|
}
|
|
55334
|
-
this.
|
|
55335
|
-
|
|
55336
|
-
});
|
|
55595
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
55596
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
55337
55597
|
}
|
|
55338
55598
|
});
|
|
55339
55599
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55462,8 +55722,10 @@ ${codeText}
|
|
|
55462
55722
|
this.toolbar.close("selectionChange");
|
|
55463
55723
|
}
|
|
55464
55724
|
destroy() {
|
|
55725
|
+
var _a;
|
|
55465
55726
|
this.unbindEvents();
|
|
55466
55727
|
this.toolbar.destroy();
|
|
55728
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55467
55729
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55468
55730
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55469
55731
|
}
|
|
@@ -76307,6 +76569,8 @@ ${codeText}
|
|
|
76307
76569
|
__publicField(this, "item");
|
|
76308
76570
|
__publicField(this, "docs", null);
|
|
76309
76571
|
__publicField(this, "checkedId");
|
|
76572
|
+
__publicField(this, "focusTimer", null);
|
|
76573
|
+
__publicField(this, "destroyed", false);
|
|
76310
76574
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76311
76575
|
if (!item.data) {
|
|
76312
76576
|
return;
|
|
@@ -76317,24 +76581,37 @@ ${codeText}
|
|
|
76317
76581
|
this.checkedId = item.id;
|
|
76318
76582
|
}
|
|
76319
76583
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76320
|
-
|
|
76584
|
+
this.clearFocusTimer();
|
|
76585
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
76586
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
76587
|
+
this.focusTimer = setTimeout(() => {
|
|
76588
|
+
this.clearFocusTimer();
|
|
76589
|
+
if (!this.canRestoreFocus()) {
|
|
76590
|
+
return;
|
|
76591
|
+
}
|
|
76321
76592
|
if (this.docs) {
|
|
76322
76593
|
this.show(this.docs);
|
|
76323
76594
|
}
|
|
76324
76595
|
this.editor.focus();
|
|
76325
76596
|
});
|
|
76326
76597
|
});
|
|
76327
|
-
__publicField(this, "handleClose", () => {
|
|
76328
|
-
|
|
76329
|
-
|
|
76330
|
-
if (tagName === "input" || tagName === "textarea") {
|
|
76598
|
+
__publicField(this, "handleClose", (bar2) => {
|
|
76599
|
+
if (bar2.closeReason === "clickBackground") {
|
|
76600
|
+
this.clearFocusTimer();
|
|
76331
76601
|
return;
|
|
76332
76602
|
}
|
|
76333
|
-
this.
|
|
76603
|
+
if (bar2.closeReason === "cancelBar" && this.canRestoreFocus()) {
|
|
76604
|
+
this.editor.focus();
|
|
76605
|
+
}
|
|
76334
76606
|
});
|
|
76335
76607
|
__publicField(this, "handleSelectionChange", () => {
|
|
76336
76608
|
if (this.toolbar.isVisible) {
|
|
76337
|
-
this.handleClose();
|
|
76609
|
+
this.handleClose(this.toolbar);
|
|
76610
|
+
}
|
|
76611
|
+
});
|
|
76612
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76613
|
+
if (!this.isFocusOwner(event.target)) {
|
|
76614
|
+
this.clearFocusTimer();
|
|
76338
76615
|
}
|
|
76339
76616
|
});
|
|
76340
76617
|
this.editor = editor;
|
|
@@ -76358,6 +76635,10 @@ ${codeText}
|
|
|
76358
76635
|
this.toolbar.addListener("close", this.handleClose);
|
|
76359
76636
|
}
|
|
76360
76637
|
show(docs) {
|
|
76638
|
+
this.clearFocusTimer();
|
|
76639
|
+
if (this.destroyed || this.editor.destroyed) {
|
|
76640
|
+
return;
|
|
76641
|
+
}
|
|
76361
76642
|
this.docs = docs;
|
|
76362
76643
|
const editor = this.editor;
|
|
76363
76644
|
const range = editor.selection.range;
|
|
@@ -76416,13 +76697,39 @@ ${codeText}
|
|
|
76416
76697
|
return doc2;
|
|
76417
76698
|
}
|
|
76418
76699
|
hide() {
|
|
76700
|
+
this.clearFocusTimer();
|
|
76419
76701
|
this.toolbar.close("selectionChange");
|
|
76420
76702
|
}
|
|
76421
76703
|
clearCheckedState() {
|
|
76422
76704
|
this.checkedId = void 0;
|
|
76423
76705
|
}
|
|
76424
76706
|
destroy() {
|
|
76707
|
+
var _a;
|
|
76708
|
+
this.destroyed = true;
|
|
76709
|
+
this.clearFocusTimer();
|
|
76425
76710
|
this.toolbar.destroy();
|
|
76711
|
+
(_a = this.anchor) == null ? void 0 : _a.remove();
|
|
76712
|
+
this.anchor = null;
|
|
76713
|
+
this.docs = null;
|
|
76714
|
+
}
|
|
76715
|
+
canRestoreFocus() {
|
|
76716
|
+
var _a;
|
|
76717
|
+
if (this.destroyed || this.editor.destroyed || !this.editor.rootElement.isConnected || !((_a = this.anchor) == null ? void 0 : _a.isConnected)) {
|
|
76718
|
+
return false;
|
|
76719
|
+
}
|
|
76720
|
+
const activeElement = document.activeElement;
|
|
76721
|
+
return !activeElement || activeElement === document.body || this.isFocusOwner(activeElement);
|
|
76722
|
+
}
|
|
76723
|
+
isFocusOwner(target) {
|
|
76724
|
+
return target instanceof Node && (this.editor.rootElement.contains(target) || this.toolbar.isInCommandBar(target));
|
|
76725
|
+
}
|
|
76726
|
+
clearFocusTimer() {
|
|
76727
|
+
if (this.focusTimer !== null) {
|
|
76728
|
+
clearTimeout(this.focusTimer);
|
|
76729
|
+
this.focusTimer = null;
|
|
76730
|
+
}
|
|
76731
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
76732
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
76426
76733
|
}
|
|
76427
76734
|
getCommandItems(docs) {
|
|
76428
76735
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -96850,14 +97157,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96850
97157
|
__publicField(this, "toolbar");
|
|
96851
97158
|
__publicField(this, "toolbarFullScreen");
|
|
96852
97159
|
__publicField(this, "root");
|
|
97160
|
+
__publicField(this, "cancelFocus");
|
|
96853
97161
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
96854
97162
|
const command = item;
|
|
96855
97163
|
if (command.onClick) {
|
|
96856
97164
|
command.onClick(this.editor, command, bar2);
|
|
96857
97165
|
this.handleSelectionChanged();
|
|
96858
|
-
|
|
96859
|
-
this.editor.focus();
|
|
96860
|
-
});
|
|
97166
|
+
this.restoreFocus();
|
|
96861
97167
|
return;
|
|
96862
97168
|
}
|
|
96863
97169
|
const findParent = (item2, id) => {
|
|
@@ -96903,9 +97209,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96903
97209
|
id: "main-toolbar"
|
|
96904
97210
|
});
|
|
96905
97211
|
this.toolbar.addListener("closing", () => {
|
|
96906
|
-
|
|
96907
|
-
editor.focus();
|
|
96908
|
-
}, 100);
|
|
97212
|
+
this.restoreFocus(100);
|
|
96909
97213
|
return true;
|
|
96910
97214
|
});
|
|
96911
97215
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -96936,11 +97240,18 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96936
97240
|
});
|
|
96937
97241
|
}
|
|
96938
97242
|
}
|
|
96939
|
-
|
|
97243
|
+
restoreFocus(delay = 0) {
|
|
96940
97244
|
var _a;
|
|
97245
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97246
|
+
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
97247
|
+
}
|
|
97248
|
+
destroy() {
|
|
97249
|
+
var _a, _b, _c;
|
|
97250
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
96941
97251
|
this.toolbar.destroy();
|
|
96942
97252
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
96943
|
-
(
|
|
97253
|
+
(_b = this.toolbarFullScreen) == null ? void 0 : _b.destroy();
|
|
97254
|
+
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
96944
97255
|
this.root.remove();
|
|
96945
97256
|
}
|
|
96946
97257
|
setItems(items) {
|
|
@@ -97532,7 +97843,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97532
97843
|
}
|
|
97533
97844
|
}
|
|
97534
97845
|
});
|
|
97535
|
-
editor.version = "4.0.
|
|
97846
|
+
editor.version = "4.0.7-beta.ONES22302172.1";
|
|
97536
97847
|
return editor;
|
|
97537
97848
|
}
|
|
97538
97849
|
function isDoc(doc2) {
|
|
@@ -97668,7 +97979,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97668
97979
|
OnesEditorDropTarget.register(editor);
|
|
97669
97980
|
OnesEditorTocProvider.register(editor);
|
|
97670
97981
|
OnesEditorExclusiveBlock.register(editor);
|
|
97671
|
-
editor.version = "4.0.
|
|
97982
|
+
editor.version = "4.0.7-beta.ONES22302172.1";
|
|
97672
97983
|
return editor;
|
|
97673
97984
|
} catch (error2) {
|
|
97674
97985
|
try {
|
|
@@ -97811,7 +98122,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97811
98122
|
}
|
|
97812
98123
|
}
|
|
97813
98124
|
});
|
|
97814
|
-
editor.version = "4.0.
|
|
98125
|
+
editor.version = "4.0.7-beta.ONES22302172.1";
|
|
97815
98126
|
return editor;
|
|
97816
98127
|
}
|
|
97817
98128
|
const emojis$1 = {
|
|
@@ -143637,6 +143948,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143637
143948
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
143638
143949
|
exports2.FitIcon = FitIcon;
|
|
143639
143950
|
exports2.FixedToolbar = FixedToolbar;
|
|
143951
|
+
exports2.FocusRestoration = FocusRestoration;
|
|
143640
143952
|
exports2.FontBoldItem = FontBoldItem;
|
|
143641
143953
|
exports2.FontItalicItem = FontItalicItem;
|
|
143642
143954
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -143835,6 +144147,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143835
144147
|
exports2.YoukuIcon = YoukuIcon;
|
|
143836
144148
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
143837
144149
|
exports2.abbreviation = abbreviation;
|
|
144150
|
+
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
143838
144151
|
exports2.activeComment = activeComment;
|
|
143839
144152
|
exports2.addAttribute = addAttribute;
|
|
143840
144153
|
exports2.addClass = addClass;
|
|
@@ -144320,6 +144633,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144320
144633
|
exports2.replaceAllText = replaceAllText;
|
|
144321
144634
|
exports2.replaceText = replaceText;
|
|
144322
144635
|
exports2.requestDownload = requestDownload;
|
|
144636
|
+
exports2.requestEditorFocus = requestEditorFocus;
|
|
144637
|
+
exports2.requestInputFocus = requestInputFocus;
|
|
144323
144638
|
exports2.resetListStart = resetListStart;
|
|
144324
144639
|
exports2.saveAs = saveAs$1;
|
|
144325
144640
|
exports2.scrollBarIntoView = scrollBarIntoView;
|