mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add copy-value button to entries in Node Props table of info sidebar
This commit is contained in:
parent
b7bae18849
commit
a508177e21
@ -163,6 +163,7 @@ RED.sidebar.info = (function() {
|
||||
});
|
||||
return el;
|
||||
}
|
||||
|
||||
function refresh(node) {
|
||||
if (node === undefined) {
|
||||
refreshSelection();
|
||||
@ -271,7 +272,7 @@ RED.sidebar.info = (function() {
|
||||
objectType = "group";
|
||||
}
|
||||
$(propRow.children()[0]).text(RED._("sidebar.info."+objectType))
|
||||
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
|
||||
RED.utils.createObjectElement(node.id,{sourceId: node.id}).appendTo(propRow.children()[1]);
|
||||
|
||||
if (node.type === "tab" || node.type === "subflow") {
|
||||
// If nothing is selected, but we're on a flow or subflow tab.
|
||||
@ -365,7 +366,7 @@ RED.sidebar.info = (function() {
|
||||
|
||||
}
|
||||
} else {
|
||||
RED.utils.createObjectElement(val).appendTo(propRow.children()[1]);
|
||||
RED.utils.createObjectElement(val,{sourceId: node.id}).appendTo(propRow.children()[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -431,6 +432,7 @@ RED.sidebar.info = (function() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function setInfoText(infoText,target) {
|
||||
var info = addTargetToExternalLinks($('<div class="red-ui-help"><span class="red-ui-text-bidi-aware" dir=\"'+RED.text.bidi.resolveBaseTextDir(infoText)+'">'+infoText+'</span></div>')).appendTo(target);
|
||||
info.find(".red-ui-text-bidi-aware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" );
|
||||
@ -447,6 +449,7 @@ RED.sidebar.info = (function() {
|
||||
$(this).toggleClass('expanded',!isExpanded);
|
||||
})
|
||||
}
|
||||
|
||||
var tips = (function() {
|
||||
var enabled = true;
|
||||
var startDelay = 1000;
|
||||
|
@ -365,7 +365,16 @@ RED.utils = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
function buildMessageElement(obj,options) {
|
||||
/**
|
||||
* Create a DOM element representation of obj - as used by Debug sidebar etc
|
||||
*
|
||||
* @params obj - the data to display
|
||||
* @params options - a bag of options
|
||||
*
|
||||
* - If you want the Copy Value button, then set `sourceId`
|
||||
* - If you want the Copy Path button, also set `path` to the value to be copied
|
||||
*/
|
||||
function createObjectElement(obj,options) {
|
||||
options = options || {};
|
||||
var key = options.key;
|
||||
var typeHint = options.typeHint;
|
||||
@ -555,7 +564,7 @@ RED.utils = (function() {
|
||||
if (fullLength <= 10) {
|
||||
for (i=0;i<fullLength;i++) {
|
||||
row = $('<div class="red-ui-debug-msg-object-entry collapsed"></div>').appendTo(arrayRows);
|
||||
subElements[path+"["+i+"]"] = buildMessageElement(
|
||||
subElements[path+"["+i+"]"] = createObjectElement(
|
||||
data[i],
|
||||
{
|
||||
key: ""+i,
|
||||
@ -585,7 +594,7 @@ RED.utils = (function() {
|
||||
return function() {
|
||||
for (var i=min;i<=max;i++) {
|
||||
var row = $('<div class="red-ui-debug-msg-object-entry collapsed"></div>').appendTo(parent);
|
||||
subElements[path+"["+i+"]"] = buildMessageElement(
|
||||
subElements[path+"["+i+"]"] = createObjectElement(
|
||||
data[i],
|
||||
{
|
||||
key: ""+i,
|
||||
@ -641,7 +650,7 @@ RED.utils = (function() {
|
||||
newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]"
|
||||
}
|
||||
}
|
||||
subElements[newPath] = buildMessageElement(
|
||||
subElements[newPath] = createObjectElement(
|
||||
data[keys[i]],
|
||||
{
|
||||
key: keys[i],
|
||||
@ -1369,7 +1378,7 @@ RED.utils = (function() {
|
||||
}
|
||||
|
||||
return {
|
||||
createObjectElement: buildMessageElement,
|
||||
createObjectElement: createObjectElement,
|
||||
getMessageProperty: getMessageProperty,
|
||||
setMessageProperty: setMessageProperty,
|
||||
normalisePropertyExpression: normalisePropertyExpression,
|
||||
|
Loading…
Reference in New Issue
Block a user