* WIP on upload support - protocols, modules, etc.

* Ability for KeyEntryView to only show specific/allowed keys
* Start moving/adding common methods to MenuModule vs boilerplate code
* menuFlags: String|StringArray: flags for menus, e.g. new 'noHistory' flag to prevent appending to history/stack
* New download stats/MCI codes
* Ability to redirect input stream to [protocols] temporairly
This commit is contained in:
Bryan Ashby 2016-12-31 14:50:29 -07:00
parent 6da7d557f9
commit 0a92eec5e8
21 changed files with 985 additions and 76 deletions

View file

@ -15,22 +15,30 @@ module.exports = class KeyEntryView extends View {
super(options);
this.eatTabKey = options.eatTabKey || true;
this.caseInsensitive = options.caseInsensitive || true;
this.eatTabKey = options.eatTabKey || true;
this.caseInsensitive = options.caseInsensitive || true;
// :TODO: allow (by default) only supplied keys[] to even draw
if(Array.isArray(options.keys)) {
if(this.caseInsensitive) {
this.keys = options.keys.map( k => k.toUpperCase() );
} else {
this.keys = options.keys;
}
}
}
onKeyPress(ch, key) {
if(ch && isPrintable(ch)) {
this.redraw(); // sets position
this.client.term.write(stylizeString(ch, this.textStyle));
}
const drawKey = ch;
if(ch && this.caseInsensitive) {
ch = ch.toUpperCase();
}
if(drawKey && isPrintable(drawKey) && (!this.keys || this.keys.indexOf(ch) > -1)) {
this.redraw(); // sets position
this.client.term.write(stylizeString(ch, this.textStyle));
}
this.keyEntered = ch || key.name;
if(key && 'tab' === key.name && !this.eatTabKey) {
@ -54,6 +62,12 @@ module.exports = class KeyEntryView extends View {
this.caseInsensitive = propValue;
}
break;
case 'keys' :
if(Array.isArray(propValue)) {
this.keys = propValue;
}
break;
}
super.setPropertyValue(propName, propValue);