* Quote builder even more functional :)
This commit is contained in:
parent
4cba6f4c10
commit
20fb54422a
16
core/fse.js
16
core/fse.js
|
@ -603,17 +603,8 @@ function FullScreenEditorModule(options) {
|
|||
}
|
||||
},
|
||||
function loadQuoteLines(callback) {
|
||||
// :TODO: MLTEV's word wrapping -> line[] stuff needs to be made a public API. This can then be used here and elsewhere.
|
||||
// ...should not be too bad to do at all
|
||||
// ...probably do want quote markers in place here though, e.g. " Nu> Said some things"
|
||||
// ...this could be handled via message.getQuoteLines(...) => []
|
||||
//self.viewControllers.quoteBuilder.getView(3).setItems(['Someone said some shit', 'then they said more shit', 'and what not...', 'hurp durp']);
|
||||
var quoteView = self.viewControllers.quoteBuilder.getView(3);
|
||||
var quoteWidth = quoteView.dimens.width;
|
||||
console.log(quoteWidth)
|
||||
var quoteLines = self.replyToMessage.getQuoteLines(quoteWidth);
|
||||
console.log(quoteLines)
|
||||
quoteView.setItems(quoteLines);
|
||||
quoteView.setItems(self.replyToMessage.getQuoteLines(quoteView.dimens.width));
|
||||
callback(null);
|
||||
},
|
||||
function setViewFocus(callback) {
|
||||
|
@ -700,6 +691,11 @@ function FullScreenEditorModule(options) {
|
|||
self.viewControllers.footerEditorMenu.setFocus(false);
|
||||
self.displayQuoteBuilder();
|
||||
},
|
||||
appendQuoteEntry: function(formData, extraArgs) {
|
||||
// :TODO: Dont' use magic # ID's here
|
||||
var quoteText = self.viewControllers.quoteBuilder.getView(3).getItem(formData.value.quote);
|
||||
self.viewControllers.quoteBuilder.getView(1).addText(quoteText);
|
||||
},
|
||||
editModeMenuHelp : function(formData, extraArgs) {
|
||||
self.viewControllers.footerEditorMenu.setFocus(false);
|
||||
self.displayHelp();
|
||||
|
|
|
@ -58,6 +58,10 @@ MenuView.prototype.setItems = function(items) {
|
|||
}
|
||||
};
|
||||
|
||||
MenuView.prototype.getItem = function(index) {
|
||||
return this.items[index].text;
|
||||
};
|
||||
|
||||
MenuView.prototype.setFocusItems = function(items) {
|
||||
var self = this;
|
||||
|
||||
|
|
|
@ -245,6 +245,8 @@ Message.prototype.persist = function(cb) {
|
|||
};
|
||||
|
||||
Message.prototype.getQuoteLines = function(width) {
|
||||
// :TODO: options.maxBlankLines = 1
|
||||
|
||||
var quoteLines = [];
|
||||
|
||||
var origLines = this.message
|
||||
|
@ -257,13 +259,10 @@ Message.prototype.getQuoteLines = function(width) {
|
|||
tabWidth : 4,
|
||||
};
|
||||
|
||||
var wrapped;
|
||||
var quotePrefix = 'Nu> '; // :TODO: build FTN style quote prefix
|
||||
|
||||
for(var i = 0; i < origLines.length; ++i) {
|
||||
wrapped = wordWrapText(quotePrefix + origLines[i], wrapOpts).wrapped;
|
||||
|
||||
Array.prototype.push.apply(quoteLines, wrapped);
|
||||
Array.prototype.push.apply(quoteLines, wordWrapText(quotePrefix + origLines[i], wrapOpts).wrapped);
|
||||
}
|
||||
|
||||
return quoteLines;
|
||||
|
|
|
@ -993,6 +993,17 @@ MultiLineEditTextView.prototype.setText = function(text) {
|
|||
//text = require('fs').readFileSync('/home/nuskooler/Downloads/test_text.txt', { encoding : 'utf-8'});
|
||||
|
||||
this.textLines = [ ];
|
||||
this.addText(text);
|
||||
/*this.insertRawText(text);
|
||||
|
||||
if(this.isEditMode()) {
|
||||
this.cursorEndOfDocument();
|
||||
} else if(this.isPreviewMode()) {
|
||||
this.cursorStartOfDocument();
|
||||
}*/
|
||||
};
|
||||
|
||||
MultiLineEditTextView.prototype.addText = function(text) {
|
||||
this.insertRawText(text);
|
||||
|
||||
if(this.isEditMode()) {
|
||||
|
|
|
@ -673,8 +673,18 @@
|
|||
//items: [ "just", "testing", "some", "things" ]
|
||||
width: 79
|
||||
height: 4
|
||||
argName: quote
|
||||
}
|
||||
}
|
||||
|
||||
submit: {
|
||||
*: [
|
||||
{
|
||||
value: { quote: null }
|
||||
action: @method:appendQuoteEntry
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue