@ones-editor/editor 2.9.8-beta.32 → 2.9.8-beta.34
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/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +7 -3
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -1
- package/dist/index.js +49 -12
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
|
|
|
14
14
|
private header;
|
|
15
15
|
private footer;
|
|
16
16
|
constructor(items: CommandItem[], closeable?: Closeable, options?: CommandBarOptions);
|
|
17
|
-
close(reason: CloseReason): void;
|
|
17
|
+
close(reason: CloseReason, e?: MouseEvent | null): void;
|
|
18
18
|
click(item: CommandItem, target: HTMLElement): void;
|
|
19
19
|
createPopperOptions(flip?: boolean): Partial<import("@popperjs/core").Options>;
|
|
20
20
|
destroy(): void;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { CloseReason } from '../../../../@ones-editor/core';
|
|
1
|
+
import { CloseReason, CommandItem, Closeable } from '../../../../@ones-editor/core';
|
|
2
2
|
import { Instance } from 'tippy.js';
|
|
3
3
|
import CommandBar from './command-bar';
|
|
4
|
-
import { AbstractManualCommandBar, ManualShowCommandBarOptions } from './types';
|
|
4
|
+
import { AbstractManualCommandBar, CommandBarOptions, ManualShowCommandBarOptions } from './types';
|
|
5
5
|
export default abstract class ManualCommandBar extends CommandBar implements AbstractManualCommandBar {
|
|
6
|
+
private manualCommandBarOptions?;
|
|
6
7
|
tippyInstance: Instance | null;
|
|
8
|
+
_target: HTMLElement | null;
|
|
9
|
+
constructor(items: CommandItem[], closeable?: Closeable, manualCommandBarOptions?: CommandBarOptions | undefined);
|
|
10
|
+
handleBeforeClose: (event?: MouseEvent | TouchEvent) => boolean;
|
|
7
11
|
setProps: (props: ManualShowCommandBarOptions) => void;
|
|
8
12
|
manualShow(target: HTMLElement, options?: ManualShowCommandBarOptions): void;
|
|
9
|
-
close(reason: CloseReason): void;
|
|
13
|
+
close(reason: CloseReason, e?: MouseEvent | null): void;
|
|
10
14
|
destroy(): void;
|
|
11
15
|
protected getCommandBarRoot(): HTMLElement | null;
|
|
12
16
|
get isVisible(): boolean;
|
|
@@ -25,7 +25,7 @@ export interface ManualShowCommandBarOptions {
|
|
|
25
25
|
export interface AbstractCommandBar extends TypedEmitter<CommandBarEvents> {
|
|
26
26
|
readonly isVisible: boolean;
|
|
27
27
|
readonly parentItem: CommandItem | null;
|
|
28
|
-
close: (reason: CloseReason) => void;
|
|
28
|
+
close: (reason: CloseReason, e?: MouseEvent | null) => void;
|
|
29
29
|
destroy: () => void;
|
|
30
30
|
isInCommandBar: (target: EventTarget | null) => boolean;
|
|
31
31
|
handleDocumentKeydown: (event: KeyboardEvent) => boolean;
|
package/dist/index.js
CHANGED
|
@@ -41615,7 +41615,7 @@ ${codeText}
|
|
|
41615
41615
|
this.closeable = closeable != null ? closeable : null;
|
|
41616
41616
|
this.content = this.createCommandBarContent(items);
|
|
41617
41617
|
}
|
|
41618
|
-
close(reason) {
|
|
41618
|
+
close(reason, e2) {
|
|
41619
41619
|
this.closeReason = reason;
|
|
41620
41620
|
if (this.subBar) {
|
|
41621
41621
|
this.subBar.close(reason);
|
|
@@ -42045,16 +42045,48 @@ ${codeText}
|
|
|
42045
42045
|
__publicField(CommandBar, "commandBarCreators", /* @__PURE__ */ new Map());
|
|
42046
42046
|
getLogger("ui-command-bar");
|
|
42047
42047
|
class ManualCommandBar extends CommandBar {
|
|
42048
|
-
constructor() {
|
|
42049
|
-
super(
|
|
42048
|
+
constructor(items, closeable, manualCommandBarOptions) {
|
|
42049
|
+
super(items, closeable, {
|
|
42050
|
+
...manualCommandBarOptions,
|
|
42051
|
+
beforeClose: (e2) => {
|
|
42052
|
+
return this.handleBeforeClose(e2);
|
|
42053
|
+
}
|
|
42054
|
+
});
|
|
42050
42055
|
__publicField(this, "tippyInstance", null);
|
|
42056
|
+
__publicField(this, "_target", null);
|
|
42057
|
+
__publicField(this, "handleBeforeClose", (event) => {
|
|
42058
|
+
var _a;
|
|
42059
|
+
let ret = false;
|
|
42060
|
+
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42061
|
+
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
42062
|
+
}
|
|
42063
|
+
if (ret) {
|
|
42064
|
+
return ret;
|
|
42065
|
+
}
|
|
42066
|
+
if (!this._target) {
|
|
42067
|
+
return ret;
|
|
42068
|
+
}
|
|
42069
|
+
const target = this._target;
|
|
42070
|
+
setTimeout(() => {
|
|
42071
|
+
const parentEditor = target.closest(".editor-root");
|
|
42072
|
+
if (parentEditor) {
|
|
42073
|
+
const input2 = parentEditor.querySelector(".editor-input");
|
|
42074
|
+
if (input2) {
|
|
42075
|
+
input2.focus();
|
|
42076
|
+
}
|
|
42077
|
+
}
|
|
42078
|
+
}, 100);
|
|
42079
|
+
return ret;
|
|
42080
|
+
});
|
|
42051
42081
|
__publicField(this, "setProps", (props) => {
|
|
42052
42082
|
var _a;
|
|
42053
42083
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
42054
42084
|
});
|
|
42085
|
+
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42055
42086
|
}
|
|
42056
42087
|
manualShow(target, options) {
|
|
42057
42088
|
var _a, _b, _c, _d;
|
|
42089
|
+
this._target = target;
|
|
42058
42090
|
if (this.isVisible) {
|
|
42059
42091
|
return;
|
|
42060
42092
|
}
|
|
@@ -42078,7 +42110,8 @@ ${codeText}
|
|
|
42078
42110
|
theme: options == null ? void 0 : options.theme,
|
|
42079
42111
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
42080
42112
|
offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
|
|
42081
|
-
popperOptions: this.createPopperOptions()
|
|
42113
|
+
popperOptions: this.createPopperOptions(),
|
|
42114
|
+
delay: 500
|
|
42082
42115
|
});
|
|
42083
42116
|
if (options == null ? void 0 : options.point) {
|
|
42084
42117
|
const { x, y } = options.point;
|
|
@@ -42099,11 +42132,15 @@ ${codeText}
|
|
|
42099
42132
|
addClass(this.popper, "mobile");
|
|
42100
42133
|
}
|
|
42101
42134
|
}
|
|
42102
|
-
close(reason) {
|
|
42103
|
-
var _a;
|
|
42135
|
+
close(reason, e2) {
|
|
42136
|
+
var _a, _b;
|
|
42104
42137
|
super.close(reason);
|
|
42105
42138
|
if (this.isVisible) {
|
|
42106
|
-
(
|
|
42139
|
+
if (e2) {
|
|
42140
|
+
(_a = this.tippyInstance) == null ? void 0 : _a.hideWithInteractivity(e2);
|
|
42141
|
+
} else {
|
|
42142
|
+
(_b = this.tippyInstance) == null ? void 0 : _b.hide();
|
|
42143
|
+
}
|
|
42107
42144
|
}
|
|
42108
42145
|
}
|
|
42109
42146
|
destroy() {
|
|
@@ -54932,14 +54969,14 @@ ${codeText}
|
|
|
54932
54969
|
const child = this.hoveringTextChild;
|
|
54933
54970
|
const { commands, element } = getObjectCommands(this.editor, block, child);
|
|
54934
54971
|
if (!commands.length || !element) {
|
|
54935
|
-
this.toolbar.close("fromHover");
|
|
54972
|
+
this.toolbar.close("fromHover", event);
|
|
54936
54973
|
return;
|
|
54937
54974
|
}
|
|
54938
54975
|
this.toolbarType = "object";
|
|
54939
54976
|
if (this.toolbar.isVisible) {
|
|
54940
54977
|
const currentElement = (_b = (_a = this.toolbar) == null ? void 0 : _a.tippyInstance) == null ? void 0 : _b.reference;
|
|
54941
54978
|
if (currentElement !== element) {
|
|
54942
|
-
this.toolbar.close("fromHover");
|
|
54979
|
+
this.toolbar.close("fromHover", event);
|
|
54943
54980
|
}
|
|
54944
54981
|
}
|
|
54945
54982
|
const getReferenceClientRectByCaret = () => {
|
|
@@ -69340,7 +69377,7 @@ ${codeText}
|
|
|
69340
69377
|
const data2 = blockData.embedData;
|
|
69341
69378
|
const images = getImages$1(data2);
|
|
69342
69379
|
if (type === "html") {
|
|
69343
|
-
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${
|
|
69380
|
+
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
|
|
69344
69381
|
}
|
|
69345
69382
|
if (type === "markdown") {
|
|
69346
69383
|
const markdown = images.map((image) => `})`).join("\n");
|
|
@@ -95524,7 +95561,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95524
95561
|
}
|
|
95525
95562
|
}
|
|
95526
95563
|
});
|
|
95527
|
-
editor.version = "2.9.8-beta.
|
|
95564
|
+
editor.version = "2.9.8-beta.34";
|
|
95528
95565
|
return editor;
|
|
95529
95566
|
}
|
|
95530
95567
|
function isDoc(doc2) {
|
|
@@ -95656,7 +95693,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95656
95693
|
OnesEditorDropTarget.register(editor);
|
|
95657
95694
|
OnesEditorTocProvider.register(editor);
|
|
95658
95695
|
OnesEditorExclusiveBlock.register(editor);
|
|
95659
|
-
editor.version = "2.9.8-beta.
|
|
95696
|
+
editor.version = "2.9.8-beta.34";
|
|
95660
95697
|
return editor;
|
|
95661
95698
|
}
|
|
95662
95699
|
async function showDocVersions(editor, options, serverUrl) {
|