@netless/window-manager 1.0.6-beta.1 → 1.0.6-beta.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/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/ExtendPluginManager.ts +12 -0
- package/src/index.ts +2 -0
package/package.json
CHANGED
@@ -7,6 +7,7 @@ export interface ExtendContext {
|
|
7
7
|
readonly manager: ExtendPluginManager;
|
8
8
|
readonly windowManager: WindowManager;
|
9
9
|
readonly internalEmitter: EmitterType;
|
10
|
+
windowManagerContainer?: HTMLElement;
|
10
11
|
}
|
11
12
|
|
12
13
|
export abstract class ExtendPlugin extends Emittery {
|
@@ -24,6 +25,7 @@ export type ExtendPluginInstance<T extends ExtendPlugin> = T;
|
|
24
25
|
export interface ExtendManagerOptions {
|
25
26
|
readonly windowManager: WindowManager;
|
26
27
|
readonly internalEmitter: EmitterType;
|
28
|
+
readonly container?: HTMLElement;
|
27
29
|
}
|
28
30
|
|
29
31
|
export class ExtendPluginManager {
|
@@ -35,6 +37,16 @@ export class ExtendPluginManager {
|
|
35
37
|
windowManager: props.windowManager,
|
36
38
|
internalEmitter: props.internalEmitter,
|
37
39
|
};
|
40
|
+
if (props.container) {
|
41
|
+
this.refreshContainer(props.container);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
refreshContainer(container: HTMLElement) {
|
46
|
+
this.context.windowManagerContainer = container;
|
47
|
+
this.extends.forEach(extend => {
|
48
|
+
extend._inject(this.context);
|
49
|
+
});
|
38
50
|
}
|
39
51
|
|
40
52
|
hasRegister(kind: string) {
|
package/src/index.ts
CHANGED
@@ -279,6 +279,7 @@ export class WindowManager
|
|
279
279
|
params.cursorOptions,
|
280
280
|
params.applianceIcons
|
281
281
|
);
|
282
|
+
|
282
283
|
manager.extendPluginManager = new ExtendPluginManager({
|
283
284
|
internalEmitter: internalEmitter,
|
284
285
|
windowManager: manager,
|
@@ -383,6 +384,7 @@ export class WindowManager
|
|
383
384
|
this.appManager?.resetMinimized();
|
384
385
|
this.appManager?.displayerWritableListener(!this.room.isWritable);
|
385
386
|
WindowManager.container = container;
|
387
|
+
this.extendPluginManager?.refreshContainer(container);
|
386
388
|
}
|
387
389
|
|
388
390
|
public bindCollectorContainer(container: HTMLElement) {
|