* Load fse stuff from menu.json. Will use form 0..n
This commit is contained in:
parent
e7e9070414
commit
670bf0fd6e
|
@ -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',
|
||||
|
|
|
@ -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');
|
||||
|
||||
//
|
||||
|
|
57
mods/fse.js
57
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,
|
||||
};
|
||||
|
||||
var initialFocusedId = 3; // editor
|
||||
|
||||
async.waterfall(
|
||||
[
|
||||
function createViews(callback) {
|
||||
vc.createViewsFromMCI(mciData.main.mciMap, function viewsCreated(err) {
|
||||
callback(err);
|
||||
mainVc.loadFromMenuConfig(menuLoadOpts, function viewsReady(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...')
|
||||
};
|
||||
|
||||
this.menuMethods = {
|
||||
editorEscPressed : function(formData, extraArgs) {
|
||||
|
||||
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
|
||||
}
|
||||
]
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue