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