mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3359 from node-red-hitachi/fix-action-list-i18n
fix to make actions list i18n ready and Japanese translation
This commit is contained in:
commit
f0bf607b43
@ -1151,5 +1151,137 @@
|
|||||||
"ru": "ロシア語",
|
"ru": "ロシア語",
|
||||||
"zh-CN": "中国語(簡体)",
|
"zh-CN": "中国語(簡体)",
|
||||||
"zh-TW": "中国語(繁体)"
|
"zh-TW": "中国語(繁体)"
|
||||||
|
},
|
||||||
|
"action-list": {
|
||||||
|
"toggle-show-tips" : "ヒント表示切替",
|
||||||
|
"show-about" : "Node-REDの説明を表示",
|
||||||
|
"show-welcome-tour": "ウェルカムツアー表示",
|
||||||
|
"show-next-tab": "次のタブを表示",
|
||||||
|
"show-previous-tab": "前のタブを表示",
|
||||||
|
"add-flow": "フローを追加",
|
||||||
|
"add-flow-to-right": "フローを右に追加",
|
||||||
|
"edit-flow": "フローを編集",
|
||||||
|
"remove-flow": "フローを削除",
|
||||||
|
"enable-flow": "フローを有効化",
|
||||||
|
"disable-flow": "フローを無効化",
|
||||||
|
"hide-flow": "フローを隠す",
|
||||||
|
"hide-other-flows": "他のフローを非表示",
|
||||||
|
"hide-all-flows": "全てのフローを非表示",
|
||||||
|
"show-all-flows": "全てのフローを表示",
|
||||||
|
"show-last-hidden-flow": "最後に非表示にしたフローを表示",
|
||||||
|
"list-hidden-flows": "非表示フローを表示",
|
||||||
|
"list-flows": "フロー一覧",
|
||||||
|
"list-subflows": "サブフロー一覧",
|
||||||
|
"go-to-previous-location": "前の位置に移動",
|
||||||
|
"go-to-next-location": "次の位置に移動",
|
||||||
|
"copy-selection-to-internal-clipboard": "選択をクリップボードにコピー",
|
||||||
|
"cut-selection-to-internal-clipboard": "選択をクリップボードに切り取り",
|
||||||
|
"paste-from-internal-clipboard": "クリップボードから貼り付け",
|
||||||
|
"detach-selected-nodes": "選択ノードを接続から外す",
|
||||||
|
"delete-selection": "選択を削除",
|
||||||
|
"delete-selection-and-reconnect": "選択を削除し再接続",
|
||||||
|
"edit-selected-node": "選択したノードを編集",
|
||||||
|
"go-to-selection": "選択に移動",
|
||||||
|
"undo": "変更操作を戻す",
|
||||||
|
"redo": "変更操作をやり直し",
|
||||||
|
"select-all-nodes": "全てのノードを選択",
|
||||||
|
"select-none": "ノードを選択",
|
||||||
|
"enable-selected-nodes": "選択ノードを有効化",
|
||||||
|
"disable-selected-nodes": "選択ノードを無効化",
|
||||||
|
"toggle-show-grid": "グリッド表示切替",
|
||||||
|
"toggle-snap-grid": "ノードの配置補助切替",
|
||||||
|
"toggle-status": "ステータス表示切替",
|
||||||
|
"show-selected-node-labels": "選択したノードのラベルを表示",
|
||||||
|
"hide-selected-node-labels": "選択したノードのラベルを非表示",
|
||||||
|
"scroll-view-up": "上スクロール",
|
||||||
|
"scroll-view-right": "右スクロール",
|
||||||
|
"scroll-view-down": "下スクロール",
|
||||||
|
"scroll-view-left": "左スクロール",
|
||||||
|
"step-view-up": "一単位上スクロール",
|
||||||
|
"step-view-right": "一単位右スクロール",
|
||||||
|
"step-view-down": "一単位下スクロール",
|
||||||
|
"step-view-left": "一単位左スクロール",
|
||||||
|
"move-selection-up": "選択を上移動",
|
||||||
|
"move-selection-right": "選択を右移動",
|
||||||
|
"move-selection-down": "選択を下移動",
|
||||||
|
"move-selection-left": "選択を左移動",
|
||||||
|
"move-selection-forwards": "選択を前面に移動",
|
||||||
|
"move-selection-backwards": "選択を背面に移動",
|
||||||
|
"move-selection-to-front": "選択を最前面に移動",
|
||||||
|
"move-selection-to-back": "選択を最背面に移動",
|
||||||
|
"step-selection-up": "選択を一単位上移動",
|
||||||
|
"step-selection-right": "選択を一単位右移動",
|
||||||
|
"step-selection-down": "選択を一単位下移動",
|
||||||
|
"step-selection-left": "選択を一単位左移動",
|
||||||
|
"select-connected-nodes": "接続されたノードを選択",
|
||||||
|
"select-downstream-nodes": "後方に接続されたノードを選択",
|
||||||
|
"select-upstream-nodes": "前方に接続されたノードを選択",
|
||||||
|
"go-to-next-node": "次のノードに移動",
|
||||||
|
"go-to-previous-node": "前のノードに移動",
|
||||||
|
"go-to-next-sibling": "次の兄弟ノードに移動",
|
||||||
|
"go-to-previous-sibling": "前の兄弟ノードに移動",
|
||||||
|
"go-to-nearest-node-on-left": "最も近い左側ノードに移動",
|
||||||
|
"go-to-nearest-node-on-right": "最も近い右側ノードに移動",
|
||||||
|
"go-to-nearest-node-above": "最も近い上側ノードに移動",
|
||||||
|
"go-to-nearest-node-below": "最も近い下側ノードに移動",
|
||||||
|
"align-selection-to-grid": "選択を整列",
|
||||||
|
"align-selection-to-left": "選択を左揃え",
|
||||||
|
"align-selection-to-right": "選択を右揃え",
|
||||||
|
"align-selection-to-top": "選択を上揃え",
|
||||||
|
"align-selection-to-bottom": "選択を下揃え",
|
||||||
|
"align-selection-to-middle": "選択を上下中央揃え",
|
||||||
|
"align-selection-to-center": "選択を左右中央揃え",
|
||||||
|
"distribute-selection-horizontally": "選択を左右に整列",
|
||||||
|
"distribute-selection-vertically": "選択を上下に整列",
|
||||||
|
"wire-series-of-nodes": "ノードを一続きに接続",
|
||||||
|
"wire-node-to-multiple": "ノードを複数に接続",
|
||||||
|
"show-user-settings": "ユーザ設定を表示",
|
||||||
|
"show-help": "ヘルプを表示",
|
||||||
|
"toggle-palette": "パレットの表示切替",
|
||||||
|
"show-event-log": "イベントログを表示",
|
||||||
|
"manage-palette": "パレットの管理",
|
||||||
|
"toggle-sidebar": "サイドバーの表示切替",
|
||||||
|
"show-info-tab": "ノード情報タブの表示",
|
||||||
|
"show-help-tab": "ノードヘルプタブの表示",
|
||||||
|
"show-config-tab": "設定ノードタブの表示",
|
||||||
|
"select-all-config-nodes": "全ての設定ノードを選択",
|
||||||
|
"delete-config-selection": "選択した設定ノードを削除",
|
||||||
|
"show-context-tab": "コンテクキストデータタブを表示",
|
||||||
|
"create-subflow": "サブフローを作成",
|
||||||
|
"convert-to-subflow": "選択をサブフローに変換",
|
||||||
|
"group-selection": "選択をグループ化",
|
||||||
|
"ungroup-selection": "選択をグループ解除",
|
||||||
|
"merge-selection-to-group": "選択をグループにマージ",
|
||||||
|
"remove-selection-from-group": "選択をグループから削除",
|
||||||
|
"copy-group-style": "グループのスタイルをコピー",
|
||||||
|
"paste-group-style": "グループのスタイルを貼り付け",
|
||||||
|
"show-export-dialog": "書き出しダイアログを表示",
|
||||||
|
"show-import-dialog": "読み込みダイアログを表示",
|
||||||
|
"show-library-export-dialog": "ライブラリ書き出しダイアログを表示",
|
||||||
|
"show-library-import-dialog": "ライブラリ読み込みダイアログを表示",
|
||||||
|
"show-examples-import-dialog": "サンプル読み込みダイアログを表示",
|
||||||
|
"search": "検索",
|
||||||
|
"show-action-list": "アクション一覧を表示",
|
||||||
|
"confirm-edit-tray": "編集を完了",
|
||||||
|
"cancel-edit-tray": "編集をキャンセル",
|
||||||
|
"show-remote-diff": "リモートとの変更差分を表示",
|
||||||
|
"deploy-flows": "フローをデプロイ",
|
||||||
|
"restart-flows": "フローを再起動",
|
||||||
|
"set-deploy-type-to-full": "デプロイを「全て」に設定",
|
||||||
|
"set-deploy-type-to-modified-flows": "デプロイを「変更したフロー」に設定",
|
||||||
|
"set-deploy-type-to-modified-nodes": "デプロイを「変更したノード」に設定",
|
||||||
|
"show-debug-tab": "デバッグタブを表示",
|
||||||
|
"clear-debug-messages": "デバッグメッセージをクリア",
|
||||||
|
"clear-filtered-debug-messages": "フィルタしたデバッグメッセージをクリア",
|
||||||
|
"activate-selected-debug-nodes": "選択したデバッグノードを有効化",
|
||||||
|
"activate-all-debug-nodes": "全てのデバッグノードを有効化",
|
||||||
|
"activate-all-flow-debug-nodes" : "フロー内の全デバッグノードを有効化",
|
||||||
|
"deactivate-selected-debug-nodes": "選択したデバッグノードを無効化",
|
||||||
|
"deactivate-all-debug-nodes": "全てのデバッグノードを無効化",
|
||||||
|
"deactivate-all-flow-debug-nodes": "フロー内の全デバッグノードを無効化",
|
||||||
|
"zoom-in": "ズームイン",
|
||||||
|
"zoom-out": "ズームアウト",
|
||||||
|
"zoom-reset": "ズームリセット",
|
||||||
|
"toggle-navigator": "ナビゲータ表示切替"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,18 +160,19 @@ RED.actionList = (function() {
|
|||||||
createDialog();
|
createDialog();
|
||||||
}
|
}
|
||||||
dialog.slideDown(300);
|
dialog.slideDown(300);
|
||||||
searchInput.searchBox('value',v)
|
searchInput.searchBox('value',v);
|
||||||
searchResults.editableList('empty');
|
searchResults.editableList('empty');
|
||||||
results = [];
|
results = [];
|
||||||
var actions = RED.actions.list();
|
var actions = RED.actions.list();
|
||||||
actions.sort(function(A,B) {
|
actions.sort(function(A,B) {
|
||||||
return A.id.localeCompare(B.id);
|
var Akey = A.label;
|
||||||
|
var Bkey = B.label;
|
||||||
|
return Akey.localeCompare(Bkey);
|
||||||
});
|
});
|
||||||
actions.forEach(function(action) {
|
actions.forEach(function(action) {
|
||||||
action.label = action.id.replace(/:/,": ").replace(/-/g," ").replace(/(^| )./g,function() { return arguments[0].toUpperCase()});
|
|
||||||
action._label = action.label.toLowerCase();
|
action._label = action.label.toLowerCase();
|
||||||
searchResults.editableList('addItem',action)
|
searchResults.editableList('addItem',action);
|
||||||
})
|
});
|
||||||
RED.events.emit("actionList:open");
|
RED.events.emit("actionList:open");
|
||||||
visible = true;
|
visible = true;
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,39 @@
|
|||||||
RED.actions = (function() {
|
RED.actions = (function() {
|
||||||
var actions = {
|
var actions = {
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
function addAction(name,handler) {
|
function addAction(name,handler,options) {
|
||||||
if (typeof handler !== 'function') {
|
if (typeof handler !== 'function') {
|
||||||
throw new Error("Action handler not a function");
|
throw new Error("Action handler not a function");
|
||||||
}
|
}
|
||||||
if (actions[name]) {
|
if (actions[name]) {
|
||||||
throw new Error("Cannot override existing action");
|
throw new Error("Cannot override existing action");
|
||||||
}
|
}
|
||||||
actions[name] = handler;
|
actions[name] = {
|
||||||
|
handler: handler,
|
||||||
|
options: options,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
function removeAction(name) {
|
function removeAction(name) {
|
||||||
delete actions[name];
|
delete actions[name];
|
||||||
}
|
}
|
||||||
function getAction(name) {
|
function getAction(name) {
|
||||||
return actions[name];
|
return actions[name].handler;
|
||||||
}
|
}
|
||||||
function invokeAction() {
|
function invokeAction() {
|
||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
var name = args.shift();
|
var name = args.shift();
|
||||||
if (actions.hasOwnProperty(name)) {
|
if (actions.hasOwnProperty(name)) {
|
||||||
actions[name].apply(null, args);
|
var handler = actions[name].handler;
|
||||||
|
handler.apply(null, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function listActions() {
|
function listActions() {
|
||||||
var result = [];
|
var result = [];
|
||||||
|
var missing = [];
|
||||||
Object.keys(actions).forEach(function(action) {
|
Object.keys(actions).forEach(function(action) {
|
||||||
|
var def = actions[action];
|
||||||
var shortcut = RED.keyboard.getShortcut(action);
|
var shortcut = RED.keyboard.getShortcut(action);
|
||||||
var isUser = false;
|
var isUser = false;
|
||||||
if (shortcut) {
|
if (shortcut) {
|
||||||
@ -35,13 +41,38 @@ RED.actions = (function() {
|
|||||||
} else {
|
} else {
|
||||||
isUser = !!RED.keyboard.getUserShortcut(action);
|
isUser = !!RED.keyboard.getUserShortcut(action);
|
||||||
}
|
}
|
||||||
|
if (!def.label) {
|
||||||
|
var name = action;
|
||||||
|
var options = def.options;
|
||||||
|
var key = options ? options.label : undefined;
|
||||||
|
if (!key) {
|
||||||
|
key = "action-list." +name.replace(/^.*:/,"");
|
||||||
|
}
|
||||||
|
var label = RED._(key);
|
||||||
|
if (label === key) {
|
||||||
|
// no translation. convert `name` to description
|
||||||
|
label = name.replace(/(^.+:([a-z]))|(-([a-z]))/g, function() {
|
||||||
|
if (arguments[5] === 0) {
|
||||||
|
return arguments[2].toUpperCase();
|
||||||
|
} else {
|
||||||
|
return " "+arguments[4].toUpperCase();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
missing.push(key);
|
||||||
|
}
|
||||||
|
def.label = label;
|
||||||
|
}
|
||||||
|
//console.log("; missing:", missing);
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
id:action,
|
id:action,
|
||||||
scope:shortcut?shortcut.scope:undefined,
|
scope:shortcut?shortcut.scope:undefined,
|
||||||
key:shortcut?shortcut.key:undefined,
|
key:shortcut?shortcut.key:undefined,
|
||||||
user:isUser
|
user:isUser,
|
||||||
})
|
label: def.label,
|
||||||
})
|
options: def.options,
|
||||||
|
});
|
||||||
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
@ -49,15 +49,15 @@ RED.keyboard = (function() {
|
|||||||
"]": 221,
|
"]": 221,
|
||||||
"{": 219,// <- QWERTY specific
|
"{": 219,// <- QWERTY specific
|
||||||
"}": 221 // <- QWERTY specific
|
"}": 221 // <- QWERTY specific
|
||||||
}
|
};
|
||||||
var metaKeyCodes = {
|
var metaKeyCodes = {
|
||||||
16: true,
|
16: true,
|
||||||
17: true,
|
17: true,
|
||||||
18: true,
|
18: true,
|
||||||
91: true,
|
91: true,
|
||||||
93: true
|
93: true
|
||||||
}
|
};
|
||||||
var actionToKeyMap = {}
|
var actionToKeyMap = {};
|
||||||
var defaultKeyMap = {};
|
var defaultKeyMap = {};
|
||||||
|
|
||||||
// FF generates some different keycodes because reasons.
|
// FF generates some different keycodes because reasons.
|
||||||
@ -65,7 +65,7 @@ RED.keyboard = (function() {
|
|||||||
59:186,
|
59:186,
|
||||||
61:187,
|
61:187,
|
||||||
173:189
|
173:189
|
||||||
}
|
};
|
||||||
|
|
||||||
function migrateOldKeymap() {
|
function migrateOldKeymap() {
|
||||||
// pre-0.18
|
// pre-0.18
|
||||||
@ -80,7 +80,7 @@ RED.keyboard = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getUserKey(action) {
|
function getUserKey(action) {
|
||||||
return RED.settings.get('editor.keymap',{})[action]
|
return RED.settings.get('editor.keymap',{})[action];
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeKeymaps(defaultKeymap, themeKeymap) {
|
function mergeKeymaps(defaultKeymap, themeKeymap) {
|
||||||
@ -105,7 +105,7 @@ RED.keyboard = (function() {
|
|||||||
scope:scope,
|
scope:scope,
|
||||||
key:key,
|
key:key,
|
||||||
user:false
|
user:false
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,13 +115,13 @@ RED.keyboard = (function() {
|
|||||||
if (themeKeymap.hasOwnProperty(action)) {
|
if (themeKeymap.hasOwnProperty(action)) {
|
||||||
if (!themeKeymap[action].key) {
|
if (!themeKeymap[action].key) {
|
||||||
// No key for this action - default is no keybinding
|
// No key for this action - default is no keybinding
|
||||||
delete mergedKeymap[action]
|
delete mergedKeymap[action];
|
||||||
} else {
|
} else {
|
||||||
mergedKeymap[action] = [{
|
mergedKeymap[action] = [{
|
||||||
scope: themeKeymap[action].scope || "*",
|
scope: themeKeymap[action].scope || "*",
|
||||||
key: themeKeymap[action].key,
|
key: themeKeymap[action].key,
|
||||||
user: false
|
user: false
|
||||||
}]
|
}];
|
||||||
if (mergedKeymap[action][0].scope === "workspace") {
|
if (mergedKeymap[action][0].scope === "workspace") {
|
||||||
mergedKeymap[action][0].scope = "red-ui-workspace";
|
mergedKeymap[action][0].scope = "red-ui-workspace";
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ RED.keyboard = (function() {
|
|||||||
close: function() {
|
close: function() {
|
||||||
RED.menu.refreshShortcuts();
|
RED.menu.refreshShortcuts();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function revertToDefault(action) {
|
function revertToDefault(action) {
|
||||||
@ -327,7 +327,7 @@ RED.keyboard = (function() {
|
|||||||
scope:scope,
|
scope:scope,
|
||||||
key:key,
|
key:key,
|
||||||
user:false
|
user:false
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
if (!ondown) {
|
if (!ondown) {
|
||||||
var userAction = getUserKey(cbdown);
|
var userAction = getUserKey(cbdown);
|
||||||
@ -350,7 +350,7 @@ RED.keyboard = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
keys.push([key,mod])
|
keys.push([key,mod]);
|
||||||
}
|
}
|
||||||
var slot = handlers;
|
var slot = handlers;
|
||||||
for (i=0;i<keys.length;i++) {
|
for (i=0;i<keys.length;i++) {
|
||||||
@ -373,7 +373,7 @@ RED.keyboard = (function() {
|
|||||||
//slot[key] = {scope: scope, ondown:cbdown};
|
//slot[key] = {scope: scope, ondown:cbdown};
|
||||||
}
|
}
|
||||||
slot.handlers = slot.handlers || [];
|
slot.handlers = slot.handlers || [];
|
||||||
slot.handlers.push({scope:scope,ondown:cbdown})
|
slot.handlers.push({scope:scope,ondown:cbdown});
|
||||||
slot.scope = scope;
|
slot.scope = scope;
|
||||||
slot.ondown = cbdown;
|
slot.ondown = cbdown;
|
||||||
}
|
}
|
||||||
@ -390,12 +390,12 @@ RED.keyboard = (function() {
|
|||||||
if (parsedKey) {
|
if (parsedKey) {
|
||||||
keys.push(parsedKey);
|
keys.push(parsedKey);
|
||||||
} else {
|
} else {
|
||||||
console.log("Unrecognised key specifier:",key)
|
console.log("Unrecognised key specifier:",key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
keys.push([key,mod])
|
keys.push([key,mod]);
|
||||||
}
|
}
|
||||||
var slot = handlers;
|
var slot = handlers;
|
||||||
for (i=0;i<keys.length;i++) {
|
for (i=0;i<keys.length;i++) {
|
||||||
@ -417,7 +417,7 @@ RED.keyboard = (function() {
|
|||||||
}
|
}
|
||||||
if (typeof slot.ondown === "string") {
|
if (typeof slot.ondown === "string") {
|
||||||
if (typeof modifiers === 'boolean' && modifiers) {
|
if (typeof modifiers === 'boolean' && modifiers) {
|
||||||
actionToKeyMap[slot.ondown] = {user: modifiers}
|
actionToKeyMap[slot.ondown] = {user: modifiers};
|
||||||
} else {
|
} else {
|
||||||
delete actionToKeyMap[slot.ondown];
|
delete actionToKeyMap[slot.ondown];
|
||||||
}
|
}
|
||||||
@ -433,11 +433,11 @@ RED.keyboard = (function() {
|
|||||||
function formatKey(key,plain) {
|
function formatKey(key,plain) {
|
||||||
var formattedKey = isMac?key.replace(/ctrl-?/,"⌘"):key;
|
var formattedKey = isMac?key.replace(/ctrl-?/,"⌘"):key;
|
||||||
formattedKey = isMac?formattedKey.replace(/alt-?/,"⌥"):key;
|
formattedKey = isMac?formattedKey.replace(/alt-?/,"⌥"):key;
|
||||||
formattedKey = formattedKey.replace(/shift-?/,"⇧")
|
formattedKey = formattedKey.replace(/shift-?/,"⇧");
|
||||||
formattedKey = formattedKey.replace(/left/,"←")
|
formattedKey = formattedKey.replace(/left/,"←");
|
||||||
formattedKey = formattedKey.replace(/up/,"↑")
|
formattedKey = formattedKey.replace(/up/,"↑");
|
||||||
formattedKey = formattedKey.replace(/right/,"→")
|
formattedKey = formattedKey.replace(/right/,"→");
|
||||||
formattedKey = formattedKey.replace(/down/,"↓")
|
formattedKey = formattedKey.replace(/down/,"↓");
|
||||||
if (plain) {
|
if (plain) {
|
||||||
return formattedKey;
|
return formattedKey;
|
||||||
}
|
}
|
||||||
@ -461,7 +461,6 @@ RED.keyboard = (function() {
|
|||||||
var container = $(this);
|
var container = $(this);
|
||||||
var object = container.data('data');
|
var object = container.data('data');
|
||||||
|
|
||||||
|
|
||||||
if (!container.hasClass('keyboard-shortcut-entry-expanded')) {
|
if (!container.hasClass('keyboard-shortcut-entry-expanded')) {
|
||||||
endEditShortcut();
|
endEditShortcut();
|
||||||
|
|
||||||
@ -485,7 +484,7 @@ RED.keyboard = (function() {
|
|||||||
}
|
}
|
||||||
$(this).toggleClass("input-error",!valid);
|
$(this).toggleClass("input-error",!valid);
|
||||||
okButton.attr("disabled",!valid);
|
okButton.attr("disabled",!valid);
|
||||||
})
|
});
|
||||||
|
|
||||||
var scopeSelect = $('<select><option value="*" data-i18n="keyboard.global"></option><option value="red-ui-workspace" data-i18n="keyboard.workspace"></option></select>').appendTo(scope);
|
var scopeSelect = $('<select><option value="*" data-i18n="keyboard.global"></option><option value="red-ui-workspace" data-i18n="keyboard.workspace"></option></select>').appendTo(scope);
|
||||||
scopeSelect.i18n();
|
scopeSelect.i18n();
|
||||||
@ -495,7 +494,7 @@ RED.keyboard = (function() {
|
|||||||
scopeSelect.val(object.scope||'*');
|
scopeSelect.val(object.scope||'*');
|
||||||
scopeSelect.on("change", function() {
|
scopeSelect.on("change", function() {
|
||||||
keyInput.trigger("change");
|
keyInput.trigger("change");
|
||||||
})
|
});
|
||||||
|
|
||||||
var div = $('<div class="keyboard-shortcut-edit button-group-vertical"></div>').appendTo(scope);
|
var div = $('<div class="keyboard-shortcut-edit button-group-vertical"></div>').appendTo(scope);
|
||||||
var okButton = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-check"></i></button>').appendTo(div);
|
var okButton = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-check"></i></button>').appendTo(div);
|
||||||
@ -521,10 +520,13 @@ RED.keyboard = (function() {
|
|||||||
id:object.id,
|
id:object.id,
|
||||||
scope:shortcut?shortcut.scope:undefined,
|
scope:shortcut?shortcut.scope:undefined,
|
||||||
key:shortcut?shortcut.key:undefined,
|
key:shortcut?shortcut.key:undefined,
|
||||||
user:shortcut?shortcut.user:undefined
|
user:shortcut?shortcut.user:undefined,
|
||||||
}
|
|
||||||
|
label: object.label,
|
||||||
|
options: object.options,
|
||||||
|
};
|
||||||
buildShortcutRow(container,obj);
|
buildShortcutRow(container,obj);
|
||||||
})
|
});
|
||||||
|
|
||||||
keyInput.trigger("focus");
|
keyInput.trigger("focus");
|
||||||
}
|
}
|
||||||
@ -559,7 +561,7 @@ RED.keyboard = (function() {
|
|||||||
delete object.scope;
|
delete object.scope;
|
||||||
} else {
|
} else {
|
||||||
keyDiv.parent().removeClass("keyboard-shortcut-entry-unassigned");
|
keyDiv.parent().removeClass("keyboard-shortcut-entry-unassigned");
|
||||||
keyDiv.append(RED.keyboard.formatKey(key))
|
keyDiv.append(RED.keyboard.formatKey(key));
|
||||||
$("<span>").text(scope).appendTo(scopeDiv);
|
$("<span>").text(scope).appendTo(scopeDiv);
|
||||||
object.key = key;
|
object.key = key;
|
||||||
object.scope = scope;
|
object.scope = scope;
|
||||||
@ -572,7 +574,7 @@ RED.keyboard = (function() {
|
|||||||
userKeymap[object.id] = {
|
userKeymap[object.id] = {
|
||||||
scope:shortcut.scope,
|
scope:shortcut.scope,
|
||||||
key:shortcut.key
|
key:shortcut.key
|
||||||
}
|
};
|
||||||
RED.settings.set('editor.keymap',userKeymap);
|
RED.settings.set('editor.keymap',userKeymap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,13 +590,7 @@ RED.keyboard = (function() {
|
|||||||
var item = $('<div class="keyboard-shortcut-entry">').appendTo(container);
|
var item = $('<div class="keyboard-shortcut-entry">').appendTo(container);
|
||||||
container.data('data',object);
|
container.data('data',object);
|
||||||
|
|
||||||
var text = object.id.replace(/(^.+:([a-z]))|(-([a-z]))/g,function() {
|
var text = object.label;
|
||||||
if (arguments[5] === 0) {
|
|
||||||
return arguments[2].toUpperCase();
|
|
||||||
} else {
|
|
||||||
return " "+arguments[4].toUpperCase();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var label = $('<div>').addClass("keyboard-shortcut-entry-text").text(text).appendTo(item);
|
var label = $('<div>').addClass("keyboard-shortcut-entry-text").text(text).appendTo(item);
|
||||||
|
|
||||||
var user = $('<i class="fa fa-user"></i>').prependTo(label);
|
var user = $('<i class="fa fa-user"></i>').prependTo(label);
|
||||||
@ -635,8 +631,9 @@ RED.keyboard = (function() {
|
|||||||
} else {
|
} else {
|
||||||
filterValue = filterValue.replace(/\s/g,"");
|
filterValue = filterValue.replace(/\s/g,"");
|
||||||
shortcutList.editableList('filter', function(data) {
|
shortcutList.editableList('filter', function(data) {
|
||||||
return data.id.toLowerCase().replace(/^.*:/,"").replace("-","").indexOf(filterValue) > -1;
|
var label = data.label.toLowerCase();
|
||||||
})
|
return label.indexOf(filterValue) > -1;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -657,9 +654,9 @@ RED.keyboard = (function() {
|
|||||||
});
|
});
|
||||||
var shortcuts = RED.actions.list();
|
var shortcuts = RED.actions.list();
|
||||||
shortcuts.sort(function(A,B) {
|
shortcuts.sort(function(A,B) {
|
||||||
var Aid = A.id.replace(/^.*:/,"").replace(/[ -]/g,"").toLowerCase();
|
var Akey = A.label;
|
||||||
var Bid = B.id.replace(/^.*:/,"").replace(/[ -]/g,"").toLowerCase();
|
var Bkey = B.label;
|
||||||
return Aid.localeCompare(Bid);
|
return Akey.localeCompare(Bkey);
|
||||||
});
|
});
|
||||||
knownShortcuts = new Set();
|
knownShortcuts = new Set();
|
||||||
shortcuts.forEach(function(s) {
|
shortcuts.forEach(function(s) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user