diff --git a/src/modules/sabaki.js b/src/modules/sabaki.js index 0c357fec..bc8a2074 100644 --- a/src/modules/sabaki.js +++ b/src/modules/sabaki.js @@ -2596,6 +2596,8 @@ class Sabaki extends EventEmitter { // Menus openNodeMenu(treePosition, {x, y} = {}) { + let commentMenu = this.getCommentMenuTemplate(treePosition) + let t = i18n.context('menu.edit') let template = [ { @@ -2635,6 +2637,21 @@ class Sabaki extends EventEmitter { { label: t('Remove &Other Variations'), click: () => this.removeOtherVariations(treePosition) + }, + {type: 'separator'}, + { + label: t('Show Co&mments'), + click: () => { + setting.toggle('view.show_comments') + this.setState(({showCommentBox}) => ({ + showCommentBox: !showCommentBox + })) + } + }, + {type: 'separator'}, + { + label: 'Annotate', + submenu: commentMenu } ] @@ -2642,6 +2659,12 @@ class Sabaki extends EventEmitter { } openCommentMenu(treePosition, {x, y} = {}) { + let template = this.getCommentMenuTemplate(treePosition) + + helper.popupMenu(template, x, y) + } + + getCommentMenuTemplate(treePosition) { let t = i18n.context('menu.comment') let node = this.inferredState.gameTree.get(treePosition) @@ -2725,7 +2748,7 @@ class Sabaki extends EventEmitter { item.click = () => this.setComment(treePosition, item.data) } - helper.popupMenu(template, x, y) + return template } openVariationMenu(