1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Support to copy Mustache path by left click and ctrl key

This commit is contained in:
Kazuhito Yokoi 2022-02-04 15:21:24 +09:00
parent 5293563a6a
commit a3b2b20368
3 changed files with 11 additions and 1 deletions

View File

@ -280,6 +280,7 @@
"conflictNotification2": "Select which nodes to import and whether to replace the existing nodes, or to import a copy of them."
},
"copyMessagePath": "Path copied",
"copyMessagePathForMustache": "Path copied for Mustache",
"copyMessageValue": "Value copied",
"copyMessageValue_truncated": "Truncated value copied"
},

View File

@ -280,6 +280,7 @@
"conflictNotification2": "読み込むノードを選択し、また既存のノードを置き換えるか、もしくはそれらのコピーを読み込むかも選択してください。"
},
"copyMessagePath": "パスをコピーしました",
"copyMessagePathForMustache": "Mustache向けのパスをコピーしました",
"copyMessageValue": "値をコピーしました",
"copyMessageValue_truncated": "切り捨てられた値をコピーしました"
},

View File

@ -229,7 +229,15 @@ RED.utils = (function() {
var copyPath = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-terminal"></i></button>').appendTo(copyTools).on("click", function(e) {
e.preventDefault();
e.stopPropagation();
RED.clipboard.copyText(key,copyPath,"clipboard.copyMessagePath");
var mustachePath;
if (e.ctrlKey || e.metaKey) {
mustachePath = key.replace(/\["([^\]]+)"\]/g,'.$1').replace(/\[([0-9]+)\]/g,'.$1');
}
if (!mustachePath || key === mustachePath) {
RED.clipboard.copyText(key,copyPath,"clipboard.copyMessagePath");
} else {
RED.clipboard.copyText(mustachePath,copyPath,"clipboard.copyMessagePathForMustache");
}
})
RED.popover.tooltip(copyPath,RED._("node-red:debug.sidebar.copyPath"));
}