@netless/window-manager 0.4.2 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -44,6 +44,10 @@ export const replaceRoomFunction = (room: Room | Player, manager: WindowManager)
44
44
  room.redo = () => manager.redo();
45
45
  room.undo = () => manager.undo();
46
46
  room.cleanCurrentScene = () => manager.cleanCurrentScene();
47
+ room.delete = () => manager.delete();
48
+ room.copy = () => manager.copy();
49
+ room.paste = () => manager.paste();
50
+ room.duplicate = () => manager.duplicate();
47
51
  delegateRemoveScenes(room);
48
52
  }
49
53
  };
package/src/index.ts CHANGED
@@ -614,6 +614,10 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
614
614
  return this.attributes.focus;
615
615
  }
616
616
 
617
+ public get focusedView(): View | undefined {
618
+ return this.appManager?.focusApp?.view;
619
+ }
620
+
617
621
  public get mainViewSceneIndex(): number {
618
622
  return this.appManager?.store.getMainViewSceneIndex();
619
623
  }
@@ -770,7 +774,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
770
774
  public cleanCurrentScene(): void {
771
775
  const focused = this.focused;
772
776
  if (focused) {
773
- this.appManager?.focusApp?.view?.cleanCurrentScene();
777
+ this.focusedView?.cleanCurrentScene();
774
778
  } else {
775
779
  this.mainView.cleanCurrentScene();
776
780
  }
@@ -779,7 +783,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
779
783
  public redo(): number {
780
784
  const focused = this.focused;
781
785
  if (focused) {
782
- return this.appManager?.focusApp?.view?.redo() || 0;
786
+ return this.focusedView?.redo() || 0;
783
787
  } else {
784
788
  return this.mainView.redo();
785
789
  }
@@ -788,12 +792,48 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
788
792
  public undo(): number {
789
793
  const focused = this.focused;
790
794
  if (focused) {
791
- return this.appManager?.focusApp?.view?.undo() || 0;
795
+ return this.focusedView?.undo() || 0;
792
796
  } else {
793
797
  return this.mainView.undo();
794
798
  }
795
799
  }
796
800
 
801
+ public delete(): void {
802
+ const focused = this.focused;
803
+ if (focused) {
804
+ this.focusedView?.delete();
805
+ } else {
806
+ this.mainView.delete();
807
+ }
808
+ }
809
+
810
+ public copy(): void {
811
+ const focused = this.focused;
812
+ if (focused) {
813
+ this.focusedView?.copy();
814
+ } else {
815
+ this.mainView.copy();
816
+ }
817
+ }
818
+
819
+ public paste(): void {
820
+ const focused = this.focused;
821
+ if (focused) {
822
+ this.focusedView?.paste();
823
+ } else {
824
+ this.mainView.paste();
825
+ }
826
+ }
827
+
828
+ public duplicate(): void {
829
+ const focused = this.focused;
830
+ if (focused) {
831
+ this.focusedView?.duplicate();
832
+ } else {
833
+ this.mainView.duplicate();
834
+ }
835
+ }
836
+
797
837
  private isDynamicPPT(scenes: SceneDefinition[]) {
798
838
  const sceneSrc = scenes[0]?.ppt?.src;
799
839
  return sceneSrc?.startsWith("pptx://");