feat: reopen library menu on import from file (#3383)
Co-authored-by: Thang Vu <thang.huu.vu@mgm-tp.com>
This commit is contained in:
parent
233576628c
commit
67289ef4ce
@ -3624,7 +3624,9 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
) {
|
) {
|
||||||
Library.importLibrary(file)
|
Library.importLibrary(file)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
// Close and then open to get the libraries updated
|
||||||
this.setState({ isLibraryOpen: false });
|
this.setState({ isLibraryOpen: false });
|
||||||
|
this.setState({ isLibraryOpen: true });
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
this.setState({ isLoading: false, errorMessage: error.message }),
|
this.setState({ isLoading: false, errorMessage: error.message }),
|
||||||
|
@ -142,9 +142,9 @@ const LibraryMenuItems = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
importLibraryFromJSON()
|
importLibraryFromJSON()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Maybe we should close and open the menu so that the items get updated.
|
// Close and then open to get the libraries updated
|
||||||
// But for now we just close the menu.
|
|
||||||
setAppState({ isLibraryOpen: false });
|
setAppState({ isLibraryOpen: false });
|
||||||
|
setAppState({ isLibraryOpen: true });
|
||||||
})
|
})
|
||||||
.catch(muteFSAbortError)
|
.catch(muteFSAbortError)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
@ -116,5 +116,5 @@ export const importLibraryFromJSON = async () => {
|
|||||||
extensions: [".json", ".excalidrawlib"],
|
extensions: [".json", ".excalidrawlib"],
|
||||||
*/
|
*/
|
||||||
});
|
});
|
||||||
Library.importLibrary(blob);
|
await Library.importLibrary(blob);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user