diff --git a/packages/editor/src/components/EditorContainer.tsx b/packages/editor/src/components/EditorContainer.tsx index 0ea7ee7be5..d18eb18fd3 100644 --- a/packages/editor/src/components/EditorContainer.tsx +++ b/packages/editor/src/components/EditorContainer.tsx @@ -41,7 +41,7 @@ import { t } from 'i18next' import { DockLayout, DockMode, LayoutData } from 'rc-dock' import React, { useEffect, useRef } from 'react' import { useHotkeys } from 'react-hotkeys-hook' -import Toolbar, { confirmedSaveIfModified } from '../components/toolbar/Toolbar' +import Toolbar, { confirmSceneSaveIfModified } from '../components/toolbar/Toolbar' import { cmdOrCtrlString } from '../functions/utils' import { EditorErrorState } from '../services/EditorErrorServices' import { EditorState } from '../services/EditorServices' @@ -202,7 +202,7 @@ const EditorContainer = () => { useEffect(() => { const handleBeforeUnload = async (event: BeforeUnloadEvent) => { - if (!(await confirmedSaveIfModified())) { + if (!(await confirmSceneSaveIfModified())) { event.preventDefault() event.returnValue = '' } diff --git a/packages/editor/src/components/toolbar/Toolbar.tsx b/packages/editor/src/components/toolbar/Toolbar.tsx index b99133400e..4ecf87012e 100644 --- a/packages/editor/src/components/toolbar/Toolbar.tsx +++ b/packages/editor/src/components/toolbar/Toolbar.tsx @@ -60,7 +60,7 @@ const onImportAsset = async () => { } } -export const confirmedSaveIfModified = async () => { +export const confirmSceneSaveIfModified = async () => { const isModified = EditorState.isModified() if (isModified) { @@ -74,7 +74,7 @@ export const confirmedSaveIfModified = async () => { } const onClickNewScene = async () => { - if (!(await confirmedSaveIfModified())) return + if (!(await confirmSceneSaveIfModified())) return const newSceneUIAddons = getState(EditorState).uiAddons.newScene if (Object.keys(newSceneUIAddons).length > 0) { @@ -85,7 +85,7 @@ const onClickNewScene = async () => { } const onCloseProject = async () => { - if (!(await confirmedSaveIfModified())) return + if (!(await confirmSceneSaveIfModified())) return const editorState = getMutableState(EditorState) getMutableState(GLTFModifiedState).set({}) diff --git a/packages/ui/src/components/editor/panels/Scenes/container/index.tsx b/packages/ui/src/components/editor/panels/Scenes/container/index.tsx index 77847ef4e4..e11d76ee1b 100644 --- a/packages/ui/src/components/editor/panels/Scenes/container/index.tsx +++ b/packages/ui/src/components/editor/panels/Scenes/container/index.tsx @@ -27,7 +27,7 @@ import { SceneItem } from '@etherealengine/client-core/src/admin/components/scen import { PopoverState } from '@etherealengine/client-core/src/common/services/PopoverState' import { StaticResourceType, fileBrowserPath, staticResourcePath } from '@etherealengine/common/src/schema.type.module' import CreateSceneDialog from '@etherealengine/editor/src/components/dialogs/CreateScenePanelDialog' -import { confirmedSaveIfModified } from '@etherealengine/editor/src/components/toolbar/Toolbar' +import { confirmSceneSaveIfModified } from '@etherealengine/editor/src/components/toolbar/Toolbar' import { onNewScene } from '@etherealengine/editor/src/functions/sceneFunctions' import { EditorState } from '@etherealengine/editor/src/services/EditorServices' import { getMutableState, useHookstate, useMutableState } from '@etherealengine/hyperflux' @@ -49,7 +49,7 @@ export default function ScenesPanel() { const scenesLoading = scenesQuery.status === 'pending' const onClickScene = async (scene: StaticResourceType) => { - if (!(await confirmedSaveIfModified())) return + if (!(await confirmSceneSaveIfModified())) return getMutableState(EditorState).merge({ scenePath: scene.key