@ones-editor/editor 5.0.8-beta.h1475.2 → 5.0.8-beta.h1475.3
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.
|
@@ -25,7 +25,7 @@ export default class OnesEditorToolbar implements OnesEditorHoveringBlockFilter,
|
|
|
25
25
|
isInToolbar: (event: MouseEvent) => boolean;
|
|
26
26
|
isInBlock(block: BlockElement, event: MouseEvent): boolean;
|
|
27
27
|
handleButtonClick: (toolbar: AbstractCommandBar, item: CommandItem) => void;
|
|
28
|
-
handleClose: () => void;
|
|
28
|
+
handleClose: (toolbar: AbstractCommandBar) => void;
|
|
29
29
|
handleClosing: (bar: unknown, event: MouseEvent | TouchEvent) => boolean;
|
|
30
30
|
bindEvents(): void;
|
|
31
31
|
unbindEvents(): void;
|
|
@@ -8,12 +8,14 @@ export default abstract class ManualCommandBar extends CommandBar implements Abs
|
|
|
8
8
|
_target: HTMLElement | null;
|
|
9
9
|
private cancelFocus?;
|
|
10
10
|
private focusTimer;
|
|
11
|
+
private focusRestoreGeneration;
|
|
11
12
|
constructor(items: CommandItem[], closeable?: Closeable, manualCommandBarOptions?: CommandBarOptions | undefined);
|
|
12
13
|
handleBeforeClose: (event?: MouseEvent | TouchEvent) => boolean;
|
|
13
14
|
private getFocusOwner;
|
|
14
15
|
private restoreFocusAfterClose;
|
|
15
16
|
private isFocusOwner;
|
|
16
17
|
private handleFocusInteraction;
|
|
18
|
+
private handleWindowBlur;
|
|
17
19
|
private clearFocusTimer;
|
|
18
20
|
setProps: (props: ManualShowCommandBarOptions) => void;
|
|
19
21
|
manualShow(target: HTMLElement, options?: ManualShowCommandBarOptions): void;
|
package/dist/index.js
CHANGED
|
@@ -42935,6 +42935,7 @@ ${codeText}
|
|
|
42935
42935
|
__publicField(this, "_target", null);
|
|
42936
42936
|
__publicField(this, "cancelFocus");
|
|
42937
42937
|
__publicField(this, "focusTimer", null);
|
|
42938
|
+
__publicField(this, "focusRestoreGeneration", 0);
|
|
42938
42939
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42939
42940
|
var _a;
|
|
42940
42941
|
const focusOwner = this.getFocusOwner();
|
|
@@ -42954,6 +42955,9 @@ ${codeText}
|
|
|
42954
42955
|
this.clearFocusTimer();
|
|
42955
42956
|
}
|
|
42956
42957
|
});
|
|
42958
|
+
__publicField(this, "handleWindowBlur", () => {
|
|
42959
|
+
this.clearFocusTimer();
|
|
42960
|
+
});
|
|
42957
42961
|
__publicField(this, "setProps", (props) => {
|
|
42958
42962
|
var _a;
|
|
42959
42963
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
@@ -42972,19 +42976,24 @@ ${codeText}
|
|
|
42972
42976
|
if (!parentEditor || event && !this.isFocusOwner(event.target)) {
|
|
42973
42977
|
return;
|
|
42974
42978
|
}
|
|
42975
|
-
|
|
42976
|
-
document.addEventListener("
|
|
42979
|
+
const generation = this.focusRestoreGeneration;
|
|
42980
|
+
document.addEventListener("mousedown", this.handleFocusInteraction, true);
|
|
42981
|
+
document.addEventListener("focusin", this.handleFocusInteraction, true);
|
|
42982
|
+
window.addEventListener("blur", this.handleWindowBlur);
|
|
42977
42983
|
this.focusTimer = setTimeout(() => {
|
|
42984
|
+
if (generation !== this.focusRestoreGeneration) {
|
|
42985
|
+
return;
|
|
42986
|
+
}
|
|
42978
42987
|
this.clearFocusTimer();
|
|
42979
42988
|
const input2 = parentEditor.querySelector(".editor-input");
|
|
42980
|
-
if (!target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected)) {
|
|
42989
|
+
if (this._target !== target || !target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected) || !document.hasFocus()) {
|
|
42981
42990
|
return;
|
|
42982
42991
|
}
|
|
42983
42992
|
const activeElement = document.activeElement;
|
|
42984
42993
|
if (parentEditor.contains(activeElement)) {
|
|
42985
42994
|
return;
|
|
42986
42995
|
}
|
|
42987
|
-
if (!activeElement || activeElement === document.body || this.isInCommandBar(activeElement)) {
|
|
42996
|
+
if (!activeElement || activeElement === document.body || activeElement === document.documentElement || this.isInCommandBar(activeElement)) {
|
|
42988
42997
|
this.cancelFocus = requestInputFocus(input2);
|
|
42989
42998
|
}
|
|
42990
42999
|
}, 100);
|
|
@@ -42996,14 +43005,16 @@ ${codeText}
|
|
|
42996
43005
|
}
|
|
42997
43006
|
clearFocusTimer() {
|
|
42998
43007
|
var _a;
|
|
43008
|
+
this.focusRestoreGeneration += 1;
|
|
42999
43009
|
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
43000
43010
|
this.cancelFocus = void 0;
|
|
43001
43011
|
if (this.focusTimer !== null) {
|
|
43002
43012
|
clearTimeout(this.focusTimer);
|
|
43003
43013
|
this.focusTimer = null;
|
|
43004
43014
|
}
|
|
43005
|
-
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
43006
|
-
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
43015
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction, true);
|
|
43016
|
+
document.removeEventListener("focusin", this.handleFocusInteraction, true);
|
|
43017
|
+
window.removeEventListener("blur", this.handleWindowBlur);
|
|
43007
43018
|
}
|
|
43008
43019
|
manualShow(target, options) {
|
|
43009
43020
|
var _a, _b, _c, _d;
|
|
@@ -43056,7 +43067,7 @@ ${codeText}
|
|
|
43056
43067
|
}
|
|
43057
43068
|
close(reason, e2) {
|
|
43058
43069
|
var _a, _b;
|
|
43059
|
-
if (reason
|
|
43070
|
+
if (reason === "clickBackground" || reason && reason !== "cancelBar" && reason !== "clickItem") {
|
|
43060
43071
|
this.clearFocusTimer();
|
|
43061
43072
|
}
|
|
43062
43073
|
super.close(reason);
|
|
@@ -55788,8 +55799,15 @@ ${codeText}
|
|
|
55788
55799
|
}
|
|
55789
55800
|
this._lastClickTime = Date.now();
|
|
55790
55801
|
});
|
|
55791
|
-
__publicField(this, "handleClose", () => {
|
|
55802
|
+
__publicField(this, "handleClose", (toolbar2) => {
|
|
55792
55803
|
var _a, _b;
|
|
55804
|
+
if (toolbar2.closeReason === "clickBackground" || !this.editor.rootElement.isConnected) {
|
|
55805
|
+
return;
|
|
55806
|
+
}
|
|
55807
|
+
const focusedElement = document.activeElement;
|
|
55808
|
+
if (focusedElement && focusedElement !== document.body && focusedElement !== document.documentElement && !this.editor.rootElement.contains(focusedElement) && !toolbar2.isInCommandBar(focusedElement)) {
|
|
55809
|
+
return;
|
|
55810
|
+
}
|
|
55793
55811
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55794
55812
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55795
55813
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
@@ -98355,7 +98373,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98355
98373
|
}
|
|
98356
98374
|
}
|
|
98357
98375
|
});
|
|
98358
|
-
editor.version = "5.0.8-beta.h1475.
|
|
98376
|
+
editor.version = "5.0.8-beta.h1475.3";
|
|
98359
98377
|
return editor;
|
|
98360
98378
|
}
|
|
98361
98379
|
function isDoc(doc2) {
|
|
@@ -98491,7 +98509,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98491
98509
|
OnesEditorDropTarget.register(editor);
|
|
98492
98510
|
OnesEditorTocProvider.register(editor);
|
|
98493
98511
|
OnesEditorExclusiveBlock.register(editor);
|
|
98494
|
-
editor.version = "5.0.8-beta.h1475.
|
|
98512
|
+
editor.version = "5.0.8-beta.h1475.3";
|
|
98495
98513
|
return editor;
|
|
98496
98514
|
} catch (error2) {
|
|
98497
98515
|
try {
|
|
@@ -98634,7 +98652,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
98634
98652
|
}
|
|
98635
98653
|
}
|
|
98636
98654
|
});
|
|
98637
|
-
editor.version = "5.0.8-beta.h1475.
|
|
98655
|
+
editor.version = "5.0.8-beta.h1475.3";
|
|
98638
98656
|
return editor;
|
|
98639
98657
|
}
|
|
98640
98658
|
const emojis$1 = {
|