diff --git a/core/multi_line_edit_text_view2.js b/core/multi_line_edit_text_view2.js index 3f8a8938..06f7914f 100644 --- a/core/multi_line_edit_text_view2.js +++ b/core/multi_line_edit_text_view2.js @@ -1006,6 +1006,10 @@ MultiLineEditTextView2.prototype.setText = function(text) { }; +MultiLineEditTextView2.prototype.getData = function() { + return this.getOutputText(0, this.textLines.length, true); +}; + var HANDLED_SPECIAL_KEYS = [ 'up', 'down', 'left', 'right', 'home', 'end', diff --git a/core/view_controller.js b/core/view_controller.js index 5e664709..f1cc0f6d 100644 --- a/core/view_controller.js +++ b/core/view_controller.js @@ -161,7 +161,7 @@ function ViewController(options) { this.setViewPropertiesFromMCIConf = function(view, conf) { function setViewProp(propName, setter) { - if(conf[propName]) { + if(!_.isUndefined(conf[propName])) { var propValue; var propAsset = asset.getViewPropertyAsset(conf[propName]); if(propAsset) { @@ -182,7 +182,7 @@ function ViewController(options) { propValue = conf[propName]; } - if(propValue) { + if(!_.isUndefined(propValue)) { if(setter) { setter(propValue); } else { @@ -323,7 +323,6 @@ ViewController.prototype.attachClientEvents = function() { } this.client.on('key press', this.clientKeyPressHandler); - //this.client.on('special key', this.clientSpecialKeyHandler); this.attached = true; }; @@ -334,7 +333,6 @@ ViewController.prototype.detachClientEvents = function() { } this.client.removeListener('key press', this.clientKeyPressHandler); - //this.client.removeListener('special key', this.clientSpecialKeyHandler); for(var id in this.views) { this.views[id].removeAllListeners(); @@ -584,6 +582,7 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) { } self.on('submit', function formSubmit(formData) { + Log.trace( { formData : self.getLogFriendlyFormData(formData) }, 'Form submit'); // diff --git a/mods/fse.js b/mods/fse.js index fff1bb34..646531df 100644 --- a/mods/fse.js +++ b/mods/fse.js @@ -54,59 +54,22 @@ function FullScreenEditorModule(options) { }; this.mciReadyHandlerNetMail = function(mciData) { - var vc = self.addViewController('main', new ViewController( { client : self.client } )); - - // :TODO: This can probably come from the normal mci configuration... - // additional mci stuff could be in config{} block. This should all be easily user-defined - var mciConfig = { - ET1 : { - width : 20, - text : 'Hello, World' - }, - ET2 : { - width : 10, - text : 'This is a longer string', - }, - MT3 : { - width : 79, - height : 17, - focus : true, - text : 'Ermergerd!\nHuzzah!' - } + var mainVc = self.addViewController('main', new ViewController( { client : self.client } )); + var menuLoadOpts = { + callingMenu : self, + mciMap : mciData.main.mciMap, + formId : 0, }; + + mainVc.loadFromMenuConfig(menuLoadOpts, function viewsReady(err) { + }); + }; - var initialFocusedId = 3; // editor + this.menuMethods = { + editorEscPressed : function(formData, extraArgs) { - async.waterfall( - [ - function createViews(callback) { - vc.createViewsFromMCI(mciData.main.mciMap, function viewsCreated(err) { - callback(err); - }); - }, - function applyThemeCustomization(callback) { - console.log('applyThemeCustomization...') - // :TODO: menuUtil.applyThemeCustomization() ... - // this should update local hard coded mci stuff for example to change colors, widths, blah blah - callback(null); - }, - function applyViewConfiguration(callback) { - console.log('applyViewConfiguration...') - - vc.applyViewConfig( { mci : mciConfig }, function configApplied(err, info) { - callback(err); - }); - }, - function drawAllViews(callback) { - vc.redrawAll(initialFocusedId); - callback(null); - }, - function setInitialFocus(callback) { - vc.switchFocus(initialFocusedId); // editor - } - ] - ); + } }; } diff --git a/mods/menu.json b/mods/menu.json index 441cf2be..f44f6426 100644 --- a/mods/menu.json +++ b/mods/menu.json @@ -436,6 +436,38 @@ "options" : { "cls" : true }, "config" : { "editorType" : "netMail" + }, + "form" : { + "0" : { + "ET1ET2MT3" : { + "mci" : { + "ET1" : { + "width" : 20, + "text" : "FIXME: to" + }, + "ET2" : { + "width" : 20, + "text" : "FIXME: from" + }, + "MT3" : { + "width" : 79, + "height" : 17, + "focus" : true, + "text" : "", + "submit" : [ "escape" ] + } + }, + "submit" : { + // :TODO: It may be nice to have a way to submit without data - e.g. we just care about the key press. + "3" : [ + { + "value" : 3, + "action" : "@method:editorEscPressed" + } + ] + } + } + } } }