From eea09dd3b367b0071ad178dc1cb54aa2fc7a7a20 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 8 Jul 2015 22:49:22 -0600 Subject: [PATCH] * Some more work on switching menus in FSE --- mods/fse.js | 29 ++++++++++++++++++++++++----- mods/menu.json | 17 +++++++++++++++-- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/mods/fse.js b/mods/fse.js index ba00a209..1d128bdd 100644 --- a/mods/fse.js +++ b/mods/fse.js @@ -245,18 +245,37 @@ function FullScreenEditorModule(options) { self.updateTextEditMode(mode); }); }, - editorEscPressed : function(formData, extraArgs) { - //this.editorMode = 'edit' === this.editorMode ? 'editMenu' : 'edit'; - self.editorMode = 'editMenu'; + editModeEscPressed : function(formData, extraArgs) { + console.log('editorModeBefore=' + self.editorMode) + self.editorMode = 'edit' === self.editorMode ? 'editMenu' : 'edit'; + console.log('editorModeAfter=' + self.editorMode) + //self.editorMode = 'editMenu'; self.switchFooter(function next(err) { if(err) { // :TODO:... what now? console.log(err) } else { - self.viewControllers.body.setFocus(false); - self.viewControllers.footerEditMenu.switchFocus(1); + switch(self.editorMode) { + case 'edit' : + if(!_.isUndefined(self.viewControllers.footerEditMenu)) { + self.viewControllers.footerEditMenu.setFocus(false); + } + self.viewControllers.body.switchFocus(1); + break; + + case 'editMenu' : + self.viewControllers.body.setFocus(false); + self.viewControllers.footerEditMenu.switchFocus(1); + break; + + default : throw new Error('Unexpected mode'); + } + } }); + }, + editModeMenu1 : function(formData, extraArgs) { + console.log('menu 1') } }; } diff --git a/mods/menu.json b/mods/menu.json index bee05bf8..897c3365 100644 --- a/mods/menu.json +++ b/mods/menu.json @@ -523,7 +523,7 @@ "*" : [ { "value" : 1, - "action" : "@method:editorEscPressed" + "action" : "@method:editModeEscPressed" } ] } @@ -545,8 +545,21 @@ "HM1" : { "mci" : { "HM1" : { - "items" : [ "Menu 1", "Menu 2", "Menu 3", "Menu 4" ] + "items" : [ "Menu 1", "Menu 2", "Menu 3", "Menu 4" ], + "submit" : [ "escape" ] } + }, + "submit" : { + "*" : [ + { + "value" : { "1" : 1 }, + "action" : "@method:editModeMenu1" + }, + { + "value" : 1, + "action" : "@method:editModeEscPressed" + } + ] } } }