rita-workspace 0.5.37 → 0.5.38

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.js CHANGED
@@ -794,7 +794,13 @@ function WorkspaceProvider({ children, lang = "en" }) {
794
794
  active = wsDrawings.find((d) => d.id === lastDrawingId) || null;
795
795
  }
796
796
  if (!active && wsDrawings.length > 0) {
797
- active = wsDrawings[0];
797
+ const globalLastActiveId = localStorage.getItem("rita-workspace-last-active-drawing");
798
+ if (globalLastActiveId) {
799
+ active = wsDrawings.find((d) => d.id === globalLastActiveId) || null;
800
+ }
801
+ if (!active) {
802
+ active = wsDrawings[0];
803
+ }
798
804
  }
799
805
  if (active) {
800
806
  setActiveDrawing2(active);
@@ -808,6 +814,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
808
814
  }
809
815
  init();
810
816
  }, []);
817
+ (0, import_react.useEffect)(() => {
818
+ if (activeDrawing?.id) {
819
+ localStorage.setItem("rita-workspace-last-active-drawing", activeDrawing.id);
820
+ }
821
+ }, [activeDrawing?.id]);
811
822
  const refreshDrawings = (0, import_react.useCallback)(async () => {
812
823
  if (!workspace) return;
813
824
  try {
package/dist/index.mjs CHANGED
@@ -722,7 +722,13 @@ function WorkspaceProvider({ children, lang = "en" }) {
722
722
  active = wsDrawings.find((d) => d.id === lastDrawingId) || null;
723
723
  }
724
724
  if (!active && wsDrawings.length > 0) {
725
- active = wsDrawings[0];
725
+ const globalLastActiveId = localStorage.getItem("rita-workspace-last-active-drawing");
726
+ if (globalLastActiveId) {
727
+ active = wsDrawings.find((d) => d.id === globalLastActiveId) || null;
728
+ }
729
+ if (!active) {
730
+ active = wsDrawings[0];
731
+ }
726
732
  }
727
733
  if (active) {
728
734
  setActiveDrawing2(active);
@@ -736,6 +742,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
736
742
  }
737
743
  init();
738
744
  }, []);
745
+ useEffect(() => {
746
+ if (activeDrawing?.id) {
747
+ localStorage.setItem("rita-workspace-last-active-drawing", activeDrawing.id);
748
+ }
749
+ }, [activeDrawing?.id]);
739
750
  const refreshDrawings = useCallback(async () => {
740
751
  if (!workspace) return;
741
752
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rita-workspace",
3
- "version": "0.5.37",
3
+ "version": "0.5.38",
4
4
  "description": "Multi-drawing workspace feature for Rita (Excalidraw fork)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",