mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
@@ -157,7 +157,11 @@ export const openEditorTab = (
|
||||
|
||||
return {
|
||||
...state,
|
||||
editors: [...state.editors, editorTab],
|
||||
editors:
|
||||
// Make sure the home page is always the first tab.
|
||||
key === 'start page'
|
||||
? [editorTab, ...state.editors]
|
||||
: [...state.editors, editorTab],
|
||||
currentTab: dontFocusTab ? state.currentTab : state.editors.length,
|
||||
};
|
||||
};
|
||||
|
@@ -112,10 +112,10 @@ const useEditorTabsStateSaving = ({
|
||||
);
|
||||
|
||||
const openEditorTabsFromPersistedState = React.useCallback(
|
||||
(project: gdProject) => {
|
||||
(project: gdProject): number => {
|
||||
const projectId = project.getProjectUuid();
|
||||
const editorState = getEditorStateForProject(projectId);
|
||||
if (!editorState) return;
|
||||
if (!editorState) return 0;
|
||||
let shouldOpenSavedCurrentTab = true;
|
||||
|
||||
const editorsOpeningOptions = editorState.editorTabs.editors
|
||||
@@ -167,6 +167,7 @@ const useEditorTabsStateSaving = ({
|
||||
: 0
|
||||
);
|
||||
setEditorTabs(newEditorTabs);
|
||||
return editorsOpeningOptions.length;
|
||||
},
|
||||
[
|
||||
getEditorOpeningOptions,
|
||||
|
@@ -1983,10 +1983,19 @@ const MainFrame = (props: Props) => {
|
||||
currentProject &&
|
||||
hasAPreviousSaveForEditorTabsState(currentProject)
|
||||
) {
|
||||
openEditorTabsFromPersistedState(currentProject);
|
||||
setIsLoadingProject(false);
|
||||
setLoaderModalProgress(null, null);
|
||||
openProjectManager(false);
|
||||
const openedEditorsCount = openEditorTabsFromPersistedState(
|
||||
currentProject
|
||||
);
|
||||
if (openedEditorsCount === 0) {
|
||||
openSceneOrProjectManager({
|
||||
currentProject: currentProject,
|
||||
editorTabs: state.editorTabs,
|
||||
});
|
||||
} else {
|
||||
setIsLoadingProject(false);
|
||||
setLoaderModalProgress(null, null);
|
||||
openProjectManager(false);
|
||||
}
|
||||
} else {
|
||||
openSceneOrProjectManager({
|
||||
currentProject: currentProject,
|
||||
@@ -2064,10 +2073,19 @@ const MainFrame = (props: Props) => {
|
||||
currentProject &&
|
||||
hasAPreviousSaveForEditorTabsState(currentProject)
|
||||
) {
|
||||
openEditorTabsFromPersistedState(currentProject);
|
||||
setIsLoadingProject(false);
|
||||
setLoaderModalProgress(null, null);
|
||||
openProjectManager(false);
|
||||
const openedEditorsCount = openEditorTabsFromPersistedState(
|
||||
currentProject
|
||||
);
|
||||
if (openedEditorsCount === 0) {
|
||||
openSceneOrProjectManager({
|
||||
currentProject: currentProject,
|
||||
editorTabs: state.editorTabs,
|
||||
});
|
||||
} else {
|
||||
setIsLoadingProject(false);
|
||||
setLoaderModalProgress(null, null);
|
||||
openProjectManager(false);
|
||||
}
|
||||
} else {
|
||||
openSceneOrProjectManager({
|
||||
currentProject: currentProject,
|
||||
|
Reference in New Issue
Block a user