From 78e5eaf1e226e55a881d2f0838abbef243c3e63e Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 7 Feb 2018 20:35:11 +0000 Subject: [PATCH] Electron: Toolbar button to set tags --- ElectronClient/app/gui/NoteText.jsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ElectronClient/app/gui/NoteText.jsx b/ElectronClient/app/gui/NoteText.jsx index da786e541..2beb6b13c 100644 --- a/ElectronClient/app/gui/NoteText.jsx +++ b/ElectronClient/app/gui/NoteText.jsx @@ -465,6 +465,16 @@ class NoteTextComponent extends React.Component { }); } + async commandSetTags() { + await this.saveIfNeeded(true); + + this.props.dispatch({ + type: 'WINDOW_COMMAND', + name: 'setTags', + noteId: this.state.note.id, + }); + } + itemContextMenu(event) { const note = this.state.note; if (!note) return; @@ -475,6 +485,10 @@ class NoteTextComponent extends React.Component { return this.commandAttachFile(); }})); + menu.append(new MenuItem({label: _('Tags'), click: async () => { + return this.commandSetTags(); + }})); + if (!!note.is_todo) { menu.append(new MenuItem({label: _('Set alarm'), click: async () => { return this.commandSetAlarm(); @@ -598,6 +612,12 @@ class NoteTextComponent extends React.Component { onClick: () => { return this.commandAttachFile(); }, }); + toolbarItems.push({ + title: _('Tags'), + iconName: 'fa-tags', + onClick: () => { return this.commandSetTags(); }, + }); + if (note.is_todo) { toolbarItems.push({ title: Note.needAlarm(note) ? time.formatMsToLocal(note.todo_due) : _('Set alarm'),