Skip to content

Commit

Permalink
Desktop: Resolves laurent22#1896: Hide some toolbar buttons when edit…
Browse files Browse the repository at this point in the history
…or hidden (laurent22#1940)

addresses issue: laurent22#1896
  • Loading branch information
nathanleiby authored and scoroi committed Nov 10, 2019
1 parent 662977f commit 15e21b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ElectronClient/app/gui/NoteText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ class NoteTextComponent extends React.Component {
menu.popup(bridge().window());
}

createToolbarItems(note) {
createToolbarItems(note, editorIsVisible) {
const toolbarItems = [];
if (note && this.state.folder && ['Search', 'Tag'].includes(this.props.notesParentType)) {
toolbarItems.push({
Expand Down Expand Up @@ -1578,7 +1578,7 @@ class NoteTextComponent extends React.Component {
});
}

if (note.markup_language === Note.MARKUP_LANGUAGE_MARKDOWN) {
if (note.markup_language === Note.MARKUP_LANGUAGE_MARKDOWN && editorIsVisible) {
toolbarItems.push({
tooltip: _('Bold'),
iconName: 'fa-bold',
Expand Down Expand Up @@ -1980,7 +1980,8 @@ class NoteTextComponent extends React.Component {
}
}

const toolbarItems = this.createToolbarItems(note);
const editorIsVisible = visiblePanes.indexOf('editor') >= 0;
const toolbarItems = this.createToolbarItems(note, editorIsVisible);

const toolbar = <Toolbar style={toolbarStyle} items={toolbarItems} />;

Expand Down

0 comments on commit 15e21b0

Please sign in to comment.