mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Make it possible to save formatting choices separately by the type of object (#1458)
This commit is contained in:
parent
dd47e615ee
commit
d7f59dac84
@ -171,7 +171,7 @@ RED.utils = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatNumber(element,obj,sourceId,path,cycle,initialFormat) {
|
function formatNumber(element,obj,sourceId,path,cycle,initialFormat) {
|
||||||
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path]) || initialFormat || "dec";
|
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path] && formattedPaths[sourceId][path]['number']) || initialFormat || "dec";
|
||||||
if (cycle) {
|
if (cycle) {
|
||||||
if (format === 'dec') {
|
if (format === 'dec') {
|
||||||
if ((obj.toString().length===13) && (obj<=2147483647000)) {
|
if ((obj.toString().length===13) && (obj<=2147483647000)) {
|
||||||
@ -187,10 +187,12 @@ RED.utils = (function() {
|
|||||||
format = 'dec';
|
format = 'dec';
|
||||||
}
|
}
|
||||||
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||||
formattedPaths[sourceId][path] = format;
|
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
|
||||||
|
formattedPaths[sourceId][path]['number'] = format;
|
||||||
} else if (initialFormat !== undefined){
|
} else if (initialFormat !== undefined){
|
||||||
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||||
formattedPaths[sourceId][path] = format;
|
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
|
||||||
|
formattedPaths[sourceId][path]['number'] = format;
|
||||||
}
|
}
|
||||||
if (format === 'dec') {
|
if (format === 'dec') {
|
||||||
element.text(""+obj);
|
element.text(""+obj);
|
||||||
@ -204,7 +206,7 @@ RED.utils = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatBuffer(element,button,sourceId,path,cycle) {
|
function formatBuffer(element,button,sourceId,path,cycle) {
|
||||||
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path]) || "raw";
|
var format = (formattedPaths[sourceId] && formattedPaths[sourceId][path] && formattedPaths[sourceId][path]['buffer']) || "raw";
|
||||||
if (cycle) {
|
if (cycle) {
|
||||||
if (format === 'raw') {
|
if (format === 'raw') {
|
||||||
format = 'string';
|
format = 'string';
|
||||||
@ -212,7 +214,8 @@ RED.utils = (function() {
|
|||||||
format = 'raw';
|
format = 'raw';
|
||||||
}
|
}
|
||||||
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
formattedPaths[sourceId] = formattedPaths[sourceId]||{};
|
||||||
formattedPaths[sourceId][path] = format;
|
formattedPaths[sourceId][path] = formattedPaths[sourceId][path]||{};
|
||||||
|
formattedPaths[sourceId][path]['buffer'] = format;
|
||||||
}
|
}
|
||||||
if (format === 'raw') {
|
if (format === 'raw') {
|
||||||
button.text('raw');
|
button.text('raw');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user