1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-29 09:40:10 +02:00

focus last editor when saveditemspane closes

This commit is contained in:
Kushagra Gour
2018-06-17 00:51:01 +05:30
parent e713288d12
commit 7990b22371
4 changed files with 17 additions and 3 deletions

View File

@@ -413,6 +413,9 @@ export default class App extends Component {
this.setState({ isAddLibraryModalOpen: true });
}
closeSavedItemsPane() {
if (this.editorWithFocus) {
this.editorWithFocus.focus();
}
this.setState({
isSavedItemPaneOpen: false
});
@@ -462,7 +465,7 @@ export default class App extends Component {
closeAllOverlays() {
if (this.state.isSavedItemPaneOpen) {
this.setState({ isSavedItemPaneOpen: false });
this.closeSavedItemsPane();
}
}
onExternalLibChange(newValues) {
@@ -926,6 +929,10 @@ export default class App extends Component {
});
}
editorFocusHandler(editor) {
this.editorWithFocus = editor;
}
render() {
return (
<div>
@@ -954,6 +961,7 @@ export default class App extends Component {
onCodeModeChange={this.onCodeModeChange.bind(this)}
onRef={comp => (this.contentWrap = comp)}
prefs={this.state.prefs}
onEditorFocus={this.editorFocusHandler.bind(this)}
/>
<div class="global-console-container" id="globalConsoleContainerEl" />
<Footer