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 {
|
return {
|
||||||
...state,
|
...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,
|
currentTab: dontFocusTab ? state.currentTab : state.editors.length,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -112,10 +112,10 @@ const useEditorTabsStateSaving = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const openEditorTabsFromPersistedState = React.useCallback(
|
const openEditorTabsFromPersistedState = React.useCallback(
|
||||||
(project: gdProject) => {
|
(project: gdProject): number => {
|
||||||
const projectId = project.getProjectUuid();
|
const projectId = project.getProjectUuid();
|
||||||
const editorState = getEditorStateForProject(projectId);
|
const editorState = getEditorStateForProject(projectId);
|
||||||
if (!editorState) return;
|
if (!editorState) return 0;
|
||||||
let shouldOpenSavedCurrentTab = true;
|
let shouldOpenSavedCurrentTab = true;
|
||||||
|
|
||||||
const editorsOpeningOptions = editorState.editorTabs.editors
|
const editorsOpeningOptions = editorState.editorTabs.editors
|
||||||
@@ -167,6 +167,7 @@ const useEditorTabsStateSaving = ({
|
|||||||
: 0
|
: 0
|
||||||
);
|
);
|
||||||
setEditorTabs(newEditorTabs);
|
setEditorTabs(newEditorTabs);
|
||||||
|
return editorsOpeningOptions.length;
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
getEditorOpeningOptions,
|
getEditorOpeningOptions,
|
||||||
|
@@ -1983,10 +1983,19 @@ const MainFrame = (props: Props) => {
|
|||||||
currentProject &&
|
currentProject &&
|
||||||
hasAPreviousSaveForEditorTabsState(currentProject)
|
hasAPreviousSaveForEditorTabsState(currentProject)
|
||||||
) {
|
) {
|
||||||
openEditorTabsFromPersistedState(currentProject);
|
const openedEditorsCount = openEditorTabsFromPersistedState(
|
||||||
setIsLoadingProject(false);
|
currentProject
|
||||||
setLoaderModalProgress(null, null);
|
);
|
||||||
openProjectManager(false);
|
if (openedEditorsCount === 0) {
|
||||||
|
openSceneOrProjectManager({
|
||||||
|
currentProject: currentProject,
|
||||||
|
editorTabs: state.editorTabs,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setIsLoadingProject(false);
|
||||||
|
setLoaderModalProgress(null, null);
|
||||||
|
openProjectManager(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
openSceneOrProjectManager({
|
openSceneOrProjectManager({
|
||||||
currentProject: currentProject,
|
currentProject: currentProject,
|
||||||
@@ -2064,10 +2073,19 @@ const MainFrame = (props: Props) => {
|
|||||||
currentProject &&
|
currentProject &&
|
||||||
hasAPreviousSaveForEditorTabsState(currentProject)
|
hasAPreviousSaveForEditorTabsState(currentProject)
|
||||||
) {
|
) {
|
||||||
openEditorTabsFromPersistedState(currentProject);
|
const openedEditorsCount = openEditorTabsFromPersistedState(
|
||||||
setIsLoadingProject(false);
|
currentProject
|
||||||
setLoaderModalProgress(null, null);
|
);
|
||||||
openProjectManager(false);
|
if (openedEditorsCount === 0) {
|
||||||
|
openSceneOrProjectManager({
|
||||||
|
currentProject: currentProject,
|
||||||
|
editorTabs: state.editorTabs,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setIsLoadingProject(false);
|
||||||
|
setLoaderModalProgress(null, null);
|
||||||
|
openProjectManager(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
openSceneOrProjectManager({
|
openSceneOrProjectManager({
|
||||||
currentProject: currentProject,
|
currentProject: currentProject,
|
||||||
|
Reference in New Issue
Block a user