rita-workspace 0.5.19 → 0.5.21
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 +4 -1
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -719,7 +719,8 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
719
719
|
if (!workspace) return null;
|
|
720
720
|
const now = Date.now();
|
|
721
721
|
const tempId = `temp-${now}`;
|
|
722
|
-
const
|
|
722
|
+
const allDrawings = await getAllDrawings();
|
|
723
|
+
const defaultName = `${t.newDrawing} ${allDrawings.length + 1}`;
|
|
723
724
|
const tempDrawing = {
|
|
724
725
|
id: tempId,
|
|
725
726
|
name: name || defaultName,
|
|
@@ -834,6 +835,7 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
834
835
|
}, [workspace]);
|
|
835
836
|
const saveCurrentDrawing = (0, import_react.useCallback)(async (elements, appState, files) => {
|
|
836
837
|
if (!activeDrawing) return;
|
|
838
|
+
if (isDrawingOpenedEarlierInOtherTab(activeDrawing.id)) return;
|
|
837
839
|
try {
|
|
838
840
|
const updateData = {
|
|
839
841
|
elements,
|
|
@@ -848,6 +850,7 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
848
850
|
}
|
|
849
851
|
}, [activeDrawing]);
|
|
850
852
|
const saveDrawingById = (0, import_react.useCallback)(async (id, elements, appState, files) => {
|
|
853
|
+
if (isDrawingOpenedEarlierInOtherTab(id)) return;
|
|
851
854
|
try {
|
|
852
855
|
const updateData = {
|
|
853
856
|
elements,
|
package/dist/index.mjs
CHANGED
|
@@ -648,7 +648,8 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
648
648
|
if (!workspace) return null;
|
|
649
649
|
const now = Date.now();
|
|
650
650
|
const tempId = `temp-${now}`;
|
|
651
|
-
const
|
|
651
|
+
const allDrawings = await getAllDrawings();
|
|
652
|
+
const defaultName = `${t.newDrawing} ${allDrawings.length + 1}`;
|
|
652
653
|
const tempDrawing = {
|
|
653
654
|
id: tempId,
|
|
654
655
|
name: name || defaultName,
|
|
@@ -763,6 +764,7 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
763
764
|
}, [workspace]);
|
|
764
765
|
const saveCurrentDrawing = useCallback(async (elements, appState, files) => {
|
|
765
766
|
if (!activeDrawing) return;
|
|
767
|
+
if (isDrawingOpenedEarlierInOtherTab(activeDrawing.id)) return;
|
|
766
768
|
try {
|
|
767
769
|
const updateData = {
|
|
768
770
|
elements,
|
|
@@ -777,6 +779,7 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
777
779
|
}
|
|
778
780
|
}, [activeDrawing]);
|
|
779
781
|
const saveDrawingById = useCallback(async (id, elements, appState, files) => {
|
|
782
|
+
if (isDrawingOpenedEarlierInOtherTab(id)) return;
|
|
780
783
|
try {
|
|
781
784
|
const updateData = {
|
|
782
785
|
elements,
|