* Fix some extraArgs stuff
* Minor updates to FSE related modules -- WIP!
This commit is contained in:
parent
d9b39fcaa6
commit
7990202317
|
@ -441,9 +441,9 @@ Client.prototype.gotoMenuModule = function(options, cb) {
|
|||
self.detachCurrentMenuModule();
|
||||
|
||||
var loadOptions = {
|
||||
name : options.name,
|
||||
client : self,
|
||||
args : options.args
|
||||
name : options.name,
|
||||
client : self,
|
||||
extraArgs : options.extraArgs,
|
||||
};
|
||||
|
||||
menuUtil.loadMenu(loadOptions, function onMenuModuleLoaded(err, modInst) {
|
||||
|
|
48
core/fse.js
48
core/fse.js
|
@ -43,7 +43,9 @@ function FullScreenEditorModule(options) {
|
|||
this.editorType = config.editorType;
|
||||
this.editorMode = config.editorMode;
|
||||
|
||||
this.mciData = {};
|
||||
if(_.isObject(options.extraArgs)) {
|
||||
this.messageAreaId = options.extraArgs.messageAreaId || Message.WellKnownAreaIds.Private;
|
||||
}
|
||||
|
||||
// netMail/crashMail | echoMail
|
||||
//this.messageAreaId = 'netMail' === this.editorType ? Message.WellKnownAreaIds.Private : options.messageAreaId;
|
||||
|
@ -69,7 +71,7 @@ function FullScreenEditorModule(options) {
|
|||
var headerValues = self.viewControllers.header.getFormData().value;
|
||||
|
||||
var messageOpts = {
|
||||
// areaId : self.messageAreaId,
|
||||
areaId : self.messageAreaId,
|
||||
toUserName : headerValues.to,
|
||||
fromUserName : headerValues.from,
|
||||
subject : headerValues.subject,
|
||||
|
@ -241,11 +243,9 @@ function FullScreenEditorModule(options) {
|
|||
);
|
||||
};
|
||||
|
||||
this.mciReadyHandler = function(mciData) {
|
||||
this.createInitialViews = function(mciData, cb) {
|
||||
|
||||
var menuLoadOpts = { callingMenu : self };
|
||||
|
||||
console.log('mciReadyHandler...')
|
||||
var menuLoadOpts = { callingMenu : self };
|
||||
|
||||
async.series(
|
||||
[
|
||||
|
@ -283,20 +283,39 @@ function FullScreenEditorModule(options) {
|
|||
).loadFromMenuConfig(menuLoadOpts, function footerReady(err) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function prepareViewStates(callback) {
|
||||
var header = self.viewControllers.header;
|
||||
var from = header.getView(1);
|
||||
from.acceptsFocus = false;
|
||||
from.setText(self.client.user.username);
|
||||
|
||||
var body = self.viewControllers.body.getView(1);
|
||||
self.updateTextEditMode(body.getTextEditMode());
|
||||
self.updateEditModePosition(body.getEditPosition());
|
||||
|
||||
callback(null);
|
||||
},
|
||||
function setInitialFocus(callback) {
|
||||
self.viewControllers.body.setFocus(false);
|
||||
self.viewControllers.header.switchFocus(2); // to
|
||||
|
||||
callback(null);
|
||||
}
|
||||
],
|
||||
function complete(err) {
|
||||
console.log(err)
|
||||
var bodyView = self.viewControllers.body.getView(1);
|
||||
self.updateTextEditMode(bodyView.getTextEditMode());
|
||||
self.updateEditModePosition(bodyView.getEditPosition());
|
||||
|
||||
self.viewControllers.body.setFocus(false);
|
||||
self.viewControllers.header.switchFocus(1);
|
||||
cb(err);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.mciReadyHandler = function(mciData) {
|
||||
|
||||
self.createInitialViews(mciData, function viewsCreated(err) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
this.updateEditModePosition = function(pos) {
|
||||
if('edit' === this.editorMode) {
|
||||
var posView = self.viewControllers.footerEdit.getView(1);
|
||||
|
@ -415,10 +434,11 @@ function FullScreenEditorModule(options) {
|
|||
}
|
||||
});
|
||||
},
|
||||
/*
|
||||
editModeMenuSave : function(formData, extraArgs) {
|
||||
var msg = self.getMessage();
|
||||
console.log(msg);
|
||||
},
|
||||
},*/
|
||||
editModeMenuQuote : function(formData, extraArgs) {
|
||||
|
||||
},
|
||||
|
|
|
@ -102,7 +102,7 @@ function loadMenu(options, cb) {
|
|||
},
|
||||
function createModuleInstance(modData, callback) {
|
||||
Log.debug(
|
||||
{ moduleName : modData.name, args : options.args, config : modData.config, info : modData.mod.modInfo },
|
||||
{ moduleName : modData.name, extraArgs : options.extraArgs, config : modData.config, info : modData.mod.modInfo },
|
||||
'Creating menu module instance');
|
||||
|
||||
try {
|
||||
|
@ -110,7 +110,7 @@ function loadMenu(options, cb) {
|
|||
{
|
||||
menuName : options.name,
|
||||
menuConfig : modData.config,
|
||||
args : options.args,
|
||||
extraArgs : options.extraArgs,
|
||||
});
|
||||
callback(null, moduleInstance);
|
||||
} catch(e) {
|
||||
|
|
|
@ -259,7 +259,12 @@
|
|||
"submit" : [
|
||||
{
|
||||
"value" : { "command" : "N" },
|
||||
"action" : "@menu:messageAreaNewPost"
|
||||
"action" : "@menu:messageAreaNewPost",
|
||||
"extraArgs" : { "messageAreaId" : 123 }
|
||||
},
|
||||
{
|
||||
"value" : { "command" : "Q" },
|
||||
"action" : "@menu:mainMenu"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -304,7 +309,7 @@
|
|||
"3" : [
|
||||
{
|
||||
"value" : { "subject" : null },
|
||||
"action" : "@method:fseSubmitProxy"
|
||||
"action" : "@method:headerSubmit"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -323,7 +328,7 @@
|
|||
"*" : [
|
||||
{
|
||||
"value" : "message",
|
||||
"action" : "@method:fseSubmitProxy"
|
||||
"action" : "@method:editModeEscPressed"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -359,7 +364,7 @@
|
|||
"*" : [
|
||||
{
|
||||
"value" : { "1" : 0 },
|
||||
"action" : "@method:fseSubmitProxy"
|
||||
"action" : "@method:editModeMenuSave"
|
||||
},
|
||||
{
|
||||
"value" : { "1" : 1 },
|
||||
|
@ -371,18 +376,18 @@
|
|||
},
|
||||
{
|
||||
"value" : { "1" : 3 },
|
||||
"action" : "@method:fseSubmitProxy"
|
||||
},
|
||||
"action" : "@method:editModeMenuHelp"
|
||||
}/*,
|
||||
{
|
||||
"value" : 1,
|
||||
"action" : "@method:fseSubmitProxy"
|
||||
}
|
||||
"action" : "@method:editModeEscPressed"
|
||||
}*/
|
||||
]
|
||||
},
|
||||
"actionKeys" : [ // :TODO: Need better name
|
||||
{
|
||||
"keys" : [ "escape" ],
|
||||
"action" : "@method:fseSubmitProxy"
|
||||
"action" : "@method:editModeEscPressed"
|
||||
}
|
||||
]
|
||||
// :TODO: something like the following for overriding keymap
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
'use strict';
|
||||
|
||||
var FullScreenEditorModule = require('../core/fse.js').FullScreenEditorModule;
|
||||
var Message = require('../core/message.js').Message;
|
||||
|
||||
var _ = require('lodash');
|
||||
|
||||
exports.getModule = AreaPostFSEModule;
|
||||
|
||||
|
@ -14,9 +17,15 @@ exports.moduleInfo = {
|
|||
function AreaPostFSEModule(options) {
|
||||
FullScreenEditorModule.call(this, options);
|
||||
|
||||
var self = this;
|
||||
|
||||
// we're posting, so always start with 'edit' mode
|
||||
this.editorMode = 'edit';
|
||||
|
||||
this.menuMethods.editModeMenuSave = function(formData, extraArgs) {
|
||||
var msg = self.getMessage();
|
||||
console.log(msg);
|
||||
};
|
||||
}
|
||||
|
||||
require('util').inherits(AreaPostFSEModule, FullScreenEditorModule);
|
||||
|
|
Loading…
Reference in New Issue