Desktop: Improved: When opening a note using Goto Anything, open all its parent notebooks too

This commit is contained in:
Laurent Cozic
2019-05-14 00:11:27 +01:00
parent 5c069c38f5
commit 0e2bb5d784
2 changed files with 19 additions and 1 deletions
+13 -1
View File
@@ -193,13 +193,25 @@ class Dialog extends React.PureComponent {
} }
} }
gotoItem(item) { async gotoItem(item) {
this.props.dispatch({ this.props.dispatch({
pluginName: PLUGIN_NAME, pluginName: PLUGIN_NAME,
type: 'PLUGIN_DIALOG_SET', type: 'PLUGIN_DIALOG_SET',
open: false, open: false,
}); });
if (this.state.listType === BaseModel.TYPE_NOTE || this.state.listType === BaseModel.TYPE_FOLDER) {
const folderPath = await Folder.folderPath(this.props.folders, item.parent_id);
for (const folder of folderPath) {
this.props.dispatch({
type: "FOLDER_SET_COLLAPSED",
id: folder.id,
collapsed: false,
});
}
}
if (this.state.listType === BaseModel.TYPE_NOTE) { if (this.state.listType === BaseModel.TYPE_NOTE) {
this.props.dispatch({ this.props.dispatch({
type: "FOLDER_AND_NOTE_SELECT", type: "FOLDER_AND_NOTE_SELECT",
+6
View File
@@ -488,6 +488,12 @@ const reducer = (state = defaultState, action) => {
newState.collapsedFolderIds = action.ids.slice(); newState.collapsedFolderIds = action.ids.slice();
break; break;
case 'FOLDER_SET_COLLAPSED':
newState = Object.assign({}, state);
folderSetCollapsed(state, action);
break;
case 'TAG_UPDATE_ALL': case 'TAG_UPDATE_ALL':
newState = Object.assign({}, state); newState = Object.assign({}, state);