1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Electron: Toolbar button to set tags

This commit is contained in:
Laurent Cozic 2018-02-07 20:35:11 +00:00
parent fc0d227396
commit 78e5eaf1e2

View File

@ -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) { itemContextMenu(event) {
const note = this.state.note; const note = this.state.note;
if (!note) return; if (!note) return;
@ -475,6 +485,10 @@ class NoteTextComponent extends React.Component {
return this.commandAttachFile(); return this.commandAttachFile();
}})); }}));
menu.append(new MenuItem({label: _('Tags'), click: async () => {
return this.commandSetTags();
}}));
if (!!note.is_todo) { if (!!note.is_todo) {
menu.append(new MenuItem({label: _('Set alarm'), click: async () => { menu.append(new MenuItem({label: _('Set alarm'), click: async () => {
return this.commandSetAlarm(); return this.commandSetAlarm();
@ -598,6 +612,12 @@ class NoteTextComponent extends React.Component {
onClick: () => { return this.commandAttachFile(); }, onClick: () => { return this.commandAttachFile(); },
}); });
toolbarItems.push({
title: _('Tags'),
iconName: 'fa-tags',
onClick: () => { return this.commandSetTags(); },
});
if (note.is_todo) { if (note.is_todo) {
toolbarItems.push({ toolbarItems.push({
title: Note.needAlarm(note) ? time.formatMsToLocal(note.todo_due) : _('Set alarm'), title: Note.needAlarm(note) ? time.formatMsToLocal(note.todo_due) : _('Set alarm'),