mce 0.1.2 → 0.1.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.
- package/dist/editor.d.ts +4 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +17 -32
- package/package.json +1 -1
- package/dist/sw.d.ts +0 -1
package/dist/editor.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class Editor extends Observable<Events> {
|
|
|
17
17
|
config: RemovableRef<Mce.Config>;
|
|
18
18
|
onEmit?: <K extends keyof Events & string>(event: K, ...args: Events[K]) => void;
|
|
19
19
|
plugins: Map<string, PluginObject>;
|
|
20
|
-
protected _setups: (() => void)[];
|
|
20
|
+
protected _setups: (() => void | Promise<void>)[];
|
|
21
21
|
constructor(options?: Options);
|
|
22
22
|
protected _setupObservable(): void;
|
|
23
23
|
log: (...args: any[]) => void;
|
|
@@ -26,7 +26,7 @@ export declare class Editor extends Observable<Events> {
|
|
|
26
26
|
protected _useMixins(mixins: Mixin[], options: Options): void;
|
|
27
27
|
use(plugins: Plugin[], options: Options): void;
|
|
28
28
|
protected _setuped: boolean;
|
|
29
|
-
setup: () => void
|
|
29
|
+
setup: () => Promise<void>;
|
|
30
30
|
install: (app: App) => void;
|
|
31
31
|
}
|
|
32
32
|
export declare function createEditor(options?: Options): Editor;
|
|
@@ -40,9 +40,9 @@ export interface PluginObject {
|
|
|
40
40
|
hotkeys?: Mce.Hotkey[];
|
|
41
41
|
loaders?: Mce.Loader[];
|
|
42
42
|
exporters?: Mce.Exporter[];
|
|
43
|
-
setup?: () => void
|
|
43
|
+
setup?: () => void | Promise<void>;
|
|
44
44
|
}
|
|
45
45
|
export type Plugin = PluginObject | ((editor: Editor, options: Options) => PluginObject);
|
|
46
46
|
export declare function definePlugin(cb: Plugin): Plugin;
|
|
47
|
-
export type Mixin = (editor: Editor, options: Options) => (() => void) | Mixin[] | Record<string, any> | undefined | void;
|
|
47
|
+
export type Mixin = (editor: Editor, options: Options) => (() => (void | Promise<void>)) | Mixin[] | Record<string, any> | undefined | void;
|
|
48
48
|
export declare function defineMixin(cb: Mixin): Mixin;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4201,20 +4201,23 @@ class Ae extends Dt {
|
|
|
4201
4201
|
});
|
|
4202
4202
|
}
|
|
4203
4203
|
_setuped = !1;
|
|
4204
|
-
setup = () => {
|
|
4205
|
-
this._setuped || (this._setuped = !0,
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4204
|
+
setup = async () => {
|
|
4205
|
+
this._setuped || (this._setuped = !0, await Promise.all([
|
|
4206
|
+
...this._setups.map(async (e) => {
|
|
4207
|
+
try {
|
|
4208
|
+
await e();
|
|
4209
|
+
} catch (t) {
|
|
4210
|
+
console.error("Failed to setup mixin", t);
|
|
4211
|
+
}
|
|
4212
|
+
}),
|
|
4213
|
+
...[...this.plugins.values()].map(async (e) => {
|
|
4214
|
+
try {
|
|
4215
|
+
await e.setup?.();
|
|
4216
|
+
} catch (t) {
|
|
4217
|
+
console.error(`Failed to setup ${e.name} plugin`, t);
|
|
4218
|
+
}
|
|
4219
|
+
})
|
|
4220
|
+
]), this.emit("ready"));
|
|
4218
4221
|
};
|
|
4219
4222
|
install = (e) => {
|
|
4220
4223
|
e.provide(Ae.injectionKey, this);
|
|
@@ -6344,23 +6347,6 @@ const Is = Yt({
|
|
|
6344
6347
|
], 2));
|
|
6345
6348
|
}
|
|
6346
6349
|
});
|
|
6347
|
-
async function Ni() {
|
|
6348
|
-
if (!("serviceWorker" in navigator)) {
|
|
6349
|
-
console.warn("Service Worker is not supported in this browser/environment");
|
|
6350
|
-
return;
|
|
6351
|
-
}
|
|
6352
|
-
try {
|
|
6353
|
-
await new Promise((e) => {
|
|
6354
|
-
document.readyState === "complete" || document.readyState === "interactive" ? e() : window.addEventListener("load", () => e(), { once: !0 });
|
|
6355
|
-
});
|
|
6356
|
-
const o = await navigator.serviceWorker.register("./sw.js", {
|
|
6357
|
-
scope: "/"
|
|
6358
|
-
});
|
|
6359
|
-
console.log("Editor sw registered", o);
|
|
6360
|
-
} catch (o) {
|
|
6361
|
-
console.error("Editor sw registration failed", o);
|
|
6362
|
-
}
|
|
6363
|
-
}
|
|
6364
6350
|
export {
|
|
6365
6351
|
en as Doc,
|
|
6366
6352
|
Pi as Drawboard,
|
|
@@ -6406,7 +6392,6 @@ export {
|
|
|
6406
6392
|
Yt as propsFactory,
|
|
6407
6393
|
Ii as provideEditor,
|
|
6408
6394
|
$s as provideOverlay,
|
|
6409
|
-
Ni as registerSw,
|
|
6410
6395
|
so as uint32,
|
|
6411
6396
|
re as useEditor,
|
|
6412
6397
|
Es as useIcon,
|
package/package.json
CHANGED
package/dist/sw.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function registerSw(): Promise<void>;
|