usability tweaks and add available_server_tags

This commit is contained in:
Brenden Tuck 2020-01-21 21:05:54 -05:00
parent e429481f4a
commit d6835f030c
2 changed files with 11 additions and 1 deletions

View file

@ -48,6 +48,7 @@ let spawns = (function () {
//
var onFocusOut = function (evnt) {
ignoreDefaultKeydown = false;
onAlterTag(evnt); // percolate event so closing the pane, etc saves any last changes.
}
//
@ -108,13 +109,15 @@ let spawns = (function () {
// If it does, rewrite the Text Type to be our tag value instead.
//
var onText = function (args, kwargs) {
var txt = args[0];
var div = $("<div>" + args[0] + "</div>");
var txt = div.text();
for( var id in spawnmap ) {
var regex = spawnmap[id]["r"];
if ( txt.match(regex) != null ) {
kwargs['type'] = spawnmap[id]["t"];
}
}
return false;
}

View file

@ -120,8 +120,15 @@ let options2 = (function () {
//
// Called when options settings are sent from server
var onGotOptions = function (args, kwargs) {
var addKnownType = window.plugins["goldenlayout"].addKnownType;
$.each(kwargs, function(key, value) {
options[key] = value;
// for "available_server_tags", addKnownType for each value ["tag1", "tag2", ... ]
if( (key === "available_server_tags") && addKnownType ) {
$.each( value, addKnownType );
}
});
}