* Fix word wrap bug introduced prior -- use 'expand' not 'expandTabs'
* Notes on better access of views by ID * Work on apply process a bit * Replies can now be saved
This commit is contained in:
parent
a6d00b05a7
commit
b15d9a0bf8
41
core/fse.js
41
core/fse.js
|
@ -123,6 +123,10 @@ function FullScreenEditorModule(options) {
|
||||||
return 'email' === self.editorType && Message.WellKnownAreaNames.Private === self.messageAreaName;
|
return 'email' === self.editorType && Message.WellKnownAreaNames.Private === self.messageAreaName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.isReply = function() {
|
||||||
|
return !_.isUndefined(self.replyToMessage);
|
||||||
|
};
|
||||||
|
|
||||||
this.getFooterName = function() {
|
this.getFooterName = function() {
|
||||||
return 'footer' + _.capitalize(self.footerMode); // e.g. 'footerEditor', 'footerEditorMenu', ...
|
return 'footer' + _.capitalize(self.footerMode); // e.g. 'footerEditor', 'footerEditorMenu', ...
|
||||||
};
|
};
|
||||||
|
@ -140,6 +144,38 @@ function FullScreenEditorModule(options) {
|
||||||
}[name];
|
}[name];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*ViewModeHeader : {
|
||||||
|
From : 1,
|
||||||
|
To : 2,
|
||||||
|
Subject : 3,
|
||||||
|
|
||||||
|
DateTime : 5,
|
||||||
|
MsgNum : 6,
|
||||||
|
MsgTotal : 7,
|
||||||
|
ViewCount : 8,
|
||||||
|
HashTags : 9,
|
||||||
|
MessageID : 10,
|
||||||
|
ReplyToMsgID : 11
|
||||||
|
},*/
|
||||||
|
|
||||||
|
// :TODO: convert to something like this for all view acces:
|
||||||
|
this.getHeaderViews = function() {
|
||||||
|
var vc = self.viewControllers.header;
|
||||||
|
|
||||||
|
if(self.isViewMode()) {
|
||||||
|
return {
|
||||||
|
from : vc.getView(1),
|
||||||
|
to : vc.getView(2),
|
||||||
|
subject : vc.getView(3),
|
||||||
|
|
||||||
|
dateTime : vc.getView(5),
|
||||||
|
msgNum : vc.getView(7),
|
||||||
|
// ...
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.setInitialFooterMode = function() {
|
this.setInitialFooterMode = function() {
|
||||||
switch(self.editorMode) {
|
switch(self.editorMode) {
|
||||||
case 'edit' : self.footerMode = 'editor'; break;
|
case 'edit' : self.footerMode = 'editor'; break;
|
||||||
|
@ -158,6 +194,11 @@ function FullScreenEditorModule(options) {
|
||||||
message : self.viewControllers.body.getFormData().value.message,
|
message : self.viewControllers.body.getFormData().value.message,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(self.isReply()) {
|
||||||
|
msgOpts.replyToMsgId = self.replyToMessageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
self.message = new Message(msgOpts);
|
self.message = new Message(msgOpts);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,8 @@ function callModuleMenuMethod(client, asset, path, formData, extraArgs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
client.log.trace( { methodName : asset.asset, formData : formData, extraArgs : extraArgs } );
|
||||||
|
|
||||||
var methodMod = require(path);
|
var methodMod = require(path);
|
||||||
methodMod[asset.asset](client.currentMenuModule, formData || { }, extraArgs);
|
methodMod[asset.asset](client.currentMenuModule, formData || { }, extraArgs);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
@ -190,7 +192,7 @@ function handleAction(client, formData, conf) {
|
||||||
case 'method' :
|
case 'method' :
|
||||||
case 'systemMethod' :
|
case 'systemMethod' :
|
||||||
if(_.isString(actionAsset.location)) {
|
if(_.isString(actionAsset.location)) {
|
||||||
callModuleMenuMethod(client, actionAsset, paths.join(Config.paths.mods, actionAsset.location, formData, conf.extraArgs));
|
callModuleMenuMethod(client, actionAsset, paths.join(Config.paths.mods, actionAsset.location), formData, conf.extraArgs);
|
||||||
} else {
|
} else {
|
||||||
if('systemMethod' === actionAsset.type) {
|
if('systemMethod' === actionAsset.type) {
|
||||||
// :TODO: Need to pass optional args here -- conf.extraArgs and args between e.g. ()
|
// :TODO: Need to pass optional args here -- conf.extraArgs and args between e.g. ()
|
||||||
|
|
|
@ -502,6 +502,7 @@ function MultiLineEditTextView(options) {
|
||||||
width : width,
|
width : width,
|
||||||
tabHandling : tabHandling || 'expand',
|
tabHandling : tabHandling || 'expand',
|
||||||
tabWidth : self.tabWidth,
|
tabWidth : self.tabWidth,
|
||||||
|
tabChar : '\t',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -545,7 +546,10 @@ function MultiLineEditTextView(options) {
|
||||||
var wrapped;
|
var wrapped;
|
||||||
|
|
||||||
for(var i = 0; i < text.length; ++i) {
|
for(var i = 0; i < text.length; ++i) {
|
||||||
wrapped = self.wordWrapSingleLine(text[i], 'expandTabs', self.dimens.width).wrapped;
|
wrapped = self.wordWrapSingleLine(
|
||||||
|
text[i], // input
|
||||||
|
'expand', // tabHandling
|
||||||
|
self.dimens.width).wrapped;
|
||||||
|
|
||||||
for(var j = 0; j < wrapped.length - 1; ++j) {
|
for(var j = 0; j < wrapped.length - 1; ++j) {
|
||||||
self.textLines.splice(index++, 0, { text : wrapped[j] } );
|
self.textLines.splice(index++, 0, { text : wrapped[j] } );
|
||||||
|
|
|
@ -12,6 +12,7 @@ function wordWrapText(text, options) {
|
||||||
// width : word wrap width
|
// width : word wrap width
|
||||||
// tabHandling : expand (default=expand)
|
// tabHandling : expand (default=expand)
|
||||||
// tabWidth : tab width if tabHandling is 'expand' (default=4)
|
// tabWidth : tab width if tabHandling is 'expand' (default=4)
|
||||||
|
// tabChar : character to use for tab expansion
|
||||||
//
|
//
|
||||||
assert(_.isObject(options), 'Missing options!');
|
assert(_.isObject(options), 'Missing options!');
|
||||||
assert(_.isNumber(options.width), 'Missing options.width!');
|
assert(_.isNumber(options.width), 'Missing options.width!');
|
||||||
|
@ -22,6 +23,8 @@ function wordWrapText(text, options) {
|
||||||
options.tabWidth = 4;
|
options.tabWidth = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options.tabChar = options.tabChar || ' ';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Notes
|
// Notes
|
||||||
// * Sublime Text 3 for example considers spaces after a word
|
// * Sublime Text 3 for example considers spaces after a word
|
||||||
|
@ -47,7 +50,7 @@ function wordWrapText(text, options) {
|
||||||
|
|
||||||
function expandTab(col) {
|
function expandTab(col) {
|
||||||
var remainWidth = options.tabWidth - (col % options.tabWidth);
|
var remainWidth = options.tabWidth - (col % options.tabWidth);
|
||||||
return new Array(remainWidth).join('\t');
|
return new Array(remainWidth).join(options.tabChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: support wrapping pipe code text (e.g. ignore color codes, expand MCI codes)
|
// :TODO: support wrapping pipe code text (e.g. ignore color codes, expand MCI codes)
|
||||||
|
@ -84,7 +87,7 @@ function wordWrapText(text, options) {
|
||||||
// Nice info here: http://c-for-dummies.com/blog/?p=424
|
// Nice info here: http://c-for-dummies.com/blog/?p=424
|
||||||
//
|
//
|
||||||
if('expand' === options.tabHandling) {
|
if('expand' === options.tabHandling) {
|
||||||
word += expandTab(results.wrapped[i].length + word.length) + '\t';
|
word += expandTab(results.wrapped[i].length + word.length) + options.tabChar;
|
||||||
} else {
|
} else {
|
||||||
word += m[0];
|
word += m[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ function validateApplicationData(formData, cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNaN(Date.parse(formData.value.birthdate))) {
|
if(isNaN(Date.parse(formData.value.birthdate))) {
|
||||||
cb('Invalid birthdate!');
|
cb('Invalid birthdate!', [ 3 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,8 @@ function submitApplication(callingMenu, formData, extraArgs) {
|
||||||
|
|
||||||
newUser.create( { password : formData.value.password }, function created(err) {
|
newUser.create( { password : formData.value.password }, function created(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
|
Log.info( { error : err, username : formData.value.username }, 'New user creation failed');
|
||||||
|
|
||||||
client.gotoMenuModule( { name : extraArgs.error } );
|
client.gotoMenuModule( { name : extraArgs.error } );
|
||||||
} else {
|
} else {
|
||||||
Log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');
|
Log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');
|
||||||
|
|
|
@ -230,6 +230,13 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actionKeys: [
|
||||||
|
{
|
||||||
|
keys: [ "escape" ]
|
||||||
|
viewId: 13
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -664,6 +671,10 @@
|
||||||
|
|
||||||
submit: {
|
submit: {
|
||||||
*: [
|
*: [
|
||||||
|
{
|
||||||
|
value: { 1: 0 }
|
||||||
|
action: @method:editModeMenuSave
|
||||||
|
}
|
||||||
{
|
{
|
||||||
value: { 1: 1 }
|
value: { 1: 1 }
|
||||||
action: @method:replyDiscard
|
action: @method:replyDiscard
|
||||||
|
@ -686,7 +697,7 @@
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
keys: [ "s", "shift + s" ]
|
keys: [ "s", "shift + s" ]
|
||||||
action: @method:replySave
|
action: @method:editModeMenuSave
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
keys: [ "d", "shift + d" ]
|
keys: [ "d", "shift + d" ]
|
||||||
|
|
|
@ -50,7 +50,8 @@ function AreaPostFSEModule(options) {
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
|
self.client.fallbackMenuModule();
|
||||||
|
//self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue