* Minor work on post view FSE / related
This commit is contained in:
parent
8b3b36fd83
commit
42ddabd875
39
core/fse.js
39
core/fse.js
|
@ -349,7 +349,7 @@ function FullScreenEditorModule(options) {
|
|||
switch(self.editorMode) {
|
||||
case 'view' :
|
||||
if(self.message) {
|
||||
self.initHeaderFromMessage();
|
||||
self.initHeaderViewMode();
|
||||
|
||||
var bodyMessageView = self.viewControllers.body.getView(1);
|
||||
if(bodyMessageView && _.has(self, 'message.message')) {
|
||||
|
@ -426,21 +426,38 @@ function FullScreenEditorModule(options) {
|
|||
}
|
||||
};
|
||||
|
||||
this.initHeaderFromMessage = function() {
|
||||
this.initHeaderViewMode = function() {
|
||||
assert(_.isObject(self.message));
|
||||
|
||||
var fromView = self.viewControllers.header.getView(1); // TL
|
||||
var toView = self.viewControllers.header.getView(2); // TL
|
||||
var subjView = self.viewControllers.header.getView(3); // TL
|
||||
var tsView = self.viewControllers.header.getView(5); // TL
|
||||
function setHeaderText(id, text) {
|
||||
var v = self.viewControllers.header.getView(id);
|
||||
if(v) {
|
||||
v.setText(text);
|
||||
}
|
||||
}
|
||||
/* TL1 - From
|
||||
TL2 - To
|
||||
TL3 - Subject
|
||||
|
||||
fromView.setText(self.message.fromUserName);
|
||||
toView.setText(self.message.toUserName);
|
||||
subjView.setText(self.message.subject);
|
||||
|
||||
tsView.setText(moment(self.message.modTimestamp).format(self.client.currentTheme.helpers.getDateTimeFormat()));
|
||||
TL5 - Date/Time (TODO: format)
|
||||
TL6 - Message number
|
||||
TL7 - Mesage total (in area)
|
||||
TL8 - View Count
|
||||
TL9 - Hash tags
|
||||
TL10 - Message ID
|
||||
TL11 - Reply to message ID*/
|
||||
|
||||
setHeaderText(1, self.message.fromUserName);
|
||||
setHeaderText(2, self.message.toUserName);
|
||||
setHeaderText(3, self.message.subject);
|
||||
|
||||
setHeaderText(5, moment(self.message.modTimestamp).format(self.client.currentTheme.helpers.getDateTimeFormat()));
|
||||
setHeaderText(6, '1'); // :TODO: Message number
|
||||
setHeaderText(7, '100'); // :TODO: Message total
|
||||
setHeaderText(8, self.message.viewCount);
|
||||
setHeaderText(9, 'TODO hash tags');
|
||||
setHeaderText(10, self.message.messageId);
|
||||
setHeaderText(11, self.message.replyToMessageId);
|
||||
};
|
||||
|
||||
this.displayHelp = function() {
|
||||
|
|
|
@ -145,12 +145,20 @@ function getFormConfigByIDAndMap(menuConfig, formId, mciMap, cb) {
|
|||
|
||||
Log.trace( { mciKey : mciReqKey }, 'Looking for MCI configuration key');
|
||||
|
||||
//
|
||||
// Exact, explicit match?
|
||||
//
|
||||
if(_.isObject(formForId[mciReqKey])) {
|
||||
Log.trace( { mciKey : mciReqKey }, 'Using exact configuration key match');
|
||||
cb(null, formForId[mciReqKey]);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Generic match
|
||||
//
|
||||
if(_.has(formForId, 'mci') || _.has(formForId, 'submit')) {
|
||||
Log.trace('Using generic configuration');
|
||||
cb(null, formForId);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -124,6 +124,14 @@ function MultiLineEditTextView(options) {
|
|||
}[sgrFor] || self.getSGR();
|
||||
};
|
||||
|
||||
this.isEditMode = function() {
|
||||
return 'edit' === self.mode;
|
||||
};
|
||||
|
||||
this.isPreviewMode = function() {
|
||||
return 'preview' === self.mode;
|
||||
};
|
||||
|
||||
// :TODO: Most of the calls to this could be avoided via incrementRow(), decrementRow() that keeps track or such
|
||||
this.getTextLinesIndex = function(row) {
|
||||
if(!_.isNumber(row)) {
|
||||
|
@ -1050,6 +1058,10 @@ MultiLineEditTextView.prototype.getData = function() {
|
|||
};
|
||||
|
||||
MultiLineEditTextView.prototype.setPropertyValue = function(propName, value) {
|
||||
switch(propName) {
|
||||
case 'mode' : this.mode = value; break;
|
||||
}
|
||||
|
||||
MultiLineEditTextView.super_.prototype.setPropertyValue.call(this, propName, value);
|
||||
};
|
||||
|
||||
|
@ -1064,6 +1076,16 @@ var HANDLED_SPECIAL_KEYS = [
|
|||
'delete line',
|
||||
];
|
||||
|
||||
/*
|
||||
var EDIT_MODE_KEYS = [
|
||||
'line feed', 'insert', 'tab', 'backspace', 'del', 'delete line'
|
||||
];
|
||||
*/
|
||||
|
||||
var PREVIEW_MODE_KEYS = [
|
||||
'up', 'down', 'page up', 'page down'
|
||||
];
|
||||
|
||||
MultiLineEditTextView.prototype.onKeyPress = function(ch, key) {
|
||||
var self = this;
|
||||
var handled;
|
||||
|
@ -1071,13 +1093,18 @@ MultiLineEditTextView.prototype.onKeyPress = function(ch, key) {
|
|||
if(key) {
|
||||
HANDLED_SPECIAL_KEYS.forEach(function aKey(specialKey) {
|
||||
if(self.isKeyMapped(specialKey, key.name)) {
|
||||
|
||||
if(self.isPreviewMode() && -1 === PREVIEW_MODE_KEYS.indexOf(specialKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
self[_.camelCase('keyPress ' + specialKey)]();
|
||||
handled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(ch && strUtil.isPrintable(ch)) {
|
||||
if(self.isEditMode() && ch && strUtil.isPrintable(ch)) {
|
||||
this.keyPressCharacter(ch);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,9 +127,14 @@ TextView.prototype.setText = function(text) {
|
|||
|
||||
this.text = strUtil.stylizeString(this.text, this.hasFocus ? this.focusTextStyle : this.textStyle);
|
||||
|
||||
/*
|
||||
if(this.resizable) {
|
||||
this.dimens.width = this.text.length + widthDelta;
|
||||
}
|
||||
*/
|
||||
if(this.autoScale.width) {
|
||||
this.dimens.width = this.text.length + widthDelta;
|
||||
}
|
||||
|
||||
this.redraw();
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -372,7 +372,6 @@
|
|||
},
|
||||
"form" : {
|
||||
"0" : {
|
||||
"TLTLTLTL" : {
|
||||
"mci" : {
|
||||
"TL1" : {
|
||||
"width" : 36
|
||||
|
@ -381,7 +380,8 @@
|
|||
"width" : 36
|
||||
},
|
||||
"TL3" : {
|
||||
"width" : 65
|
||||
"width" : 39,
|
||||
"textOverflow" : "..."
|
||||
},
|
||||
"TL5" : {
|
||||
"width" : 19
|
||||
|
@ -390,12 +390,6 @@
|
|||
"width" : 19,
|
||||
"textOverflow" : "..."
|
||||
}
|
||||
/*,
|
||||
"TL4" : {
|
||||
"width" : 19,
|
||||
"textOverflow" : "..."
|
||||
}*/
|
||||
}
|
||||
}
|
||||
},
|
||||
"1" : {
|
||||
|
@ -403,7 +397,8 @@
|
|||
"mci" : {
|
||||
"MT1" : {
|
||||
"width" : 79,
|
||||
"height" : 17
|
||||
"height" : 17,
|
||||
"mode" : "preview"
|
||||
}
|
||||
},
|
||||
"submit" : {
|
||||
|
|
Loading…
Reference in New Issue