small fixes to keymaps

pull/85/head
Ruben Daniels 2015-04-13 21:13:13 +00:00 zatwierdzone przez Ruben Daniels
rodzic 82a31c8150
commit 56656a9c2c
2 zmienionych plików z 24 dodań i 10 usunięć

Wyświetl plik

@ -350,9 +350,12 @@ define(function(require, exports, module) {
// Add key
commands.bindKey(lastKey, commands.commands[name]);
var keys = {};
keys[commands.platform] = (node.actualKeys || node.keys).split("|");
var n = {
command: node.name,
keys: (node.actualKeys || node.keys).split("|")
keys: keys
};
var cmds = settings.getJson("user/key-bindings") || [];
@ -389,6 +392,8 @@ define(function(require, exports, module) {
if (!cmd || !cmd.command)
return;
var keys = cmd.keys;
if (typeof keys == "object" && keys[commands.platform])
keys = keys[commands.platform];
if (Array.isArray(keys))
keys = keys.join("|");
if (typeof keys == "string")
@ -484,7 +489,7 @@ define(function(require, exports, module) {
}).join(",\n");
if (!keys.length)
value += ' // { "command": "nexttab", "keys": ["Ctrl-Tab"] }';
value += ' // { "command": "nexttab", "keys": { win: "Ctrl-Tab", mac: "Cmd-Tab" } }';
value += "\n]";
@ -542,8 +547,7 @@ define(function(require, exports, module) {
}
plugin.form.update([{
type: "dropdown",
name: "kbmode",
id: "kbmode",
items: items
}])
}

Wyświetl plik

@ -21,6 +21,7 @@ define(function(require, exports, module) {
var maxwidth = options.colmaxwidth || 300;
var widths = options.widths || {};
var skins = options.skins || {};
var elements = {};
var container, meta = {};
var debug = location.href.indexOf('menus=1') > -1;
@ -388,8 +389,10 @@ define(function(require, exports, module) {
});
}
if (options.name)
if (options.name) {
node.setAttribute("id", options.name);
elements[node.name] = node;
}
ui.insertByIndex(heading.container, node, position, foreign);
@ -400,7 +403,7 @@ define(function(require, exports, module) {
function update(items) {
items.forEach(function(item) {
var el = plugin.getElement(item.id);
var el = elements[item.id];
switch (el.type) {
case "dropdown":
var dropdown = el.lastChild;
@ -409,10 +412,17 @@ define(function(require, exports, module) {
return "<item value='" + item.value
+ "'><![CDATA[" + item.caption + "]]></item>";
}).join("");
if (data)
dropdown.$model.load("<items>" + data + "</items>");
if (item.value)
dropdown.setAttribute("value", item.value);
if (data) {
setTimeout(function(){
dropdown.$model.load("<items>" + data + "</items>");
setTimeout(function(){
var value = item.value || dropdown.value;
dropdown.value = -999;
dropdown.setAttribute("value", value);
});
});
}
break;
default:
if ("value" in item)