mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop: Improved search - when clearing search, stay on current item. When clicking on notebook name, jump to note within notebook. Improved toolbar layout.
This commit is contained in:
parent
6884dd2b9e
commit
96a1546da1
@ -210,6 +210,15 @@ class MainScreenComponent extends React.Component {
|
||||
type: 'SEARCH_SELECT',
|
||||
id: this.searchId_,
|
||||
});
|
||||
} else {
|
||||
const note = await Note.load(this.props.selectedNoteId);
|
||||
if (note) {
|
||||
this.props.dispatch({
|
||||
type: "FOLDER_AND_NOTE_SELECT",
|
||||
folderId: note.parent_id,
|
||||
noteId: note.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
} else if (command.name === 'commandNoteProperties') {
|
||||
@ -502,6 +511,7 @@ const mapStateToProps = (state) => {
|
||||
sidebarVisibility: state.sidebarVisibility,
|
||||
sidebarWidth: state.settings['style.sidebar.width'],
|
||||
noteListWidth: state.settings['style.noteList.width'],
|
||||
selectedNoteId: state.selectedNoteIds.length === 1 ? state.selectedNoteIds[0] : null,
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ const Search = require('lib/models/Search.js');
|
||||
const { time } = require('lib/time-utils.js');
|
||||
const Setting = require('lib/models/Setting.js');
|
||||
const { IconButton } = require('./IconButton.min.js');
|
||||
const { urlDecode, escapeHtml, pregQuote, scriptType } = require('lib/string-utils');
|
||||
const { urlDecode, escapeHtml, pregQuote, scriptType, substrWithEllipsis } = require('lib/string-utils');
|
||||
const Toolbar = require('./Toolbar.min.js');
|
||||
const TagList = require('./TagList.min.js');
|
||||
const { connect } = require('react-redux');
|
||||
@ -1372,9 +1372,16 @@ class NoteTextComponent extends React.Component {
|
||||
const toolbarItems = [];
|
||||
if (note && this.state.folder && ['Search', 'Tag'].includes(this.props.notesParentType)) {
|
||||
toolbarItems.push({
|
||||
title: _('In: %s', this.state.folder.title),
|
||||
title: _('In: %s', substrWithEllipsis(this.state.folder.title, 0, 16)),
|
||||
iconName: 'fa-book',
|
||||
enabled: false,
|
||||
onClick: () => {
|
||||
this.props.dispatch({
|
||||
type: "FOLDER_AND_NOTE_SELECT",
|
||||
folderId: this.state.folder.id,
|
||||
noteId: note.id,
|
||||
});
|
||||
},
|
||||
// enabled: false,
|
||||
});
|
||||
}
|
||||
|
||||
@ -1413,25 +1420,6 @@ class NoteTextComponent extends React.Component {
|
||||
type: 'separator',
|
||||
});
|
||||
|
||||
toolbarItems.push({
|
||||
tooltip: _('Note properties'),
|
||||
iconName: 'fa-info-circle',
|
||||
onClick: () => {
|
||||
const n = this.state.note;
|
||||
if (!n || !n.id) return;
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'WINDOW_COMMAND',
|
||||
name: 'commandNoteProperties',
|
||||
noteId: n.id,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
toolbarItems.push({
|
||||
type: 'separator',
|
||||
});
|
||||
|
||||
toolbarItems.push({
|
||||
tooltip: _('Hyperlink'),
|
||||
iconName: 'fa-link',
|
||||
@ -1529,6 +1517,22 @@ class NoteTextComponent extends React.Component {
|
||||
toolbarItems.push(item);
|
||||
}
|
||||
|
||||
|
||||
toolbarItems.push({
|
||||
tooltip: _('Note properties'),
|
||||
iconName: 'fa-info-circle',
|
||||
onClick: () => {
|
||||
const n = this.state.note;
|
||||
if (!n || !n.id) return;
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'WINDOW_COMMAND',
|
||||
name: 'commandNoteProperties',
|
||||
noteId: n.id,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return toolbarItems;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ function addExtraStyles(style) {
|
||||
|
||||
style.toolbarStyle = {
|
||||
height: style.toolbarHeight,
|
||||
minWidth: style.toolbarHeight,
|
||||
// minWidth: style.toolbarHeight,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
paddingLeft: style.headerButtonHPadding,
|
||||
@ -159,6 +159,7 @@ function addExtraStyles(style) {
|
||||
cursor: 'default',
|
||||
justifyContent: 'center',
|
||||
color: style.color,
|
||||
whiteSpace: 'nowrap',
|
||||
};
|
||||
|
||||
style.textStyle = {
|
||||
|
Loading…
Reference in New Issue
Block a user