@node-red/editor-client 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/locales/en-US/editor.json +1 -3
- package/locales/fr/editor.json +83 -83
- package/locales/fr/jsonata.json +4 -0
- package/locales/ja/editor.json +0 -3
- package/locales/pt-BR/editor.json +0 -3
- package/locales/zh-CN/editor.json +0 -3
- package/package.json +1 -1
- package/public/red/about +54 -0
- package/public/red/red.js +201 -134
- package/public/red/red.min.js +3 -3
- package/public/vendor/mermaid/mermaid.min.js +793 -731
package/public/red/red.js
CHANGED
|
@@ -589,6 +589,15 @@ var RED = (function() {
|
|
|
589
589
|
]
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
+
} else if (notificationId === 'restart-required') {
|
|
593
|
+
options.buttons = [
|
|
594
|
+
{
|
|
595
|
+
text: RED._("common.label.close"),
|
|
596
|
+
click: function() {
|
|
597
|
+
persistentNotifications[notificationId].hideNotification();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
]
|
|
592
601
|
}
|
|
593
602
|
if (!persistentNotifications.hasOwnProperty(notificationId)) {
|
|
594
603
|
persistentNotifications[notificationId] = RED.notify(text,options);
|
|
@@ -616,6 +625,10 @@ var RED = (function() {
|
|
|
616
625
|
RED.view.redrawStatus(node);
|
|
617
626
|
}
|
|
618
627
|
});
|
|
628
|
+
|
|
629
|
+
let pendingNodeRemovedNotifications = []
|
|
630
|
+
let pendingNodeRemovedTimeout
|
|
631
|
+
|
|
619
632
|
RED.comms.subscribe("notification/node/#",function(topic,msg) {
|
|
620
633
|
var i,m;
|
|
621
634
|
var typeList;
|
|
@@ -653,8 +666,15 @@ var RED = (function() {
|
|
|
653
666
|
m = msg[i];
|
|
654
667
|
info = RED.nodes.removeNodeSet(m.id);
|
|
655
668
|
if (info.added) {
|
|
656
|
-
|
|
657
|
-
|
|
669
|
+
pendingNodeRemovedNotifications = pendingNodeRemovedNotifications.concat(m.types.map(RED.utils.sanitize))
|
|
670
|
+
if (pendingNodeRemovedTimeout) {
|
|
671
|
+
clearTimeout(pendingNodeRemovedTimeout)
|
|
672
|
+
}
|
|
673
|
+
pendingNodeRemovedTimeout = setTimeout(function () {
|
|
674
|
+
typeList = "<ul><li>"+pendingNodeRemovedNotifications.join("</li><li>")+"</li></ul>";
|
|
675
|
+
RED.notify(RED._("palette.event.nodeRemoved", {count:pendingNodeRemovedNotifications.length})+typeList,"success");
|
|
676
|
+
pendingNodeRemovedNotifications = []
|
|
677
|
+
}, 200)
|
|
658
678
|
}
|
|
659
679
|
}
|
|
660
680
|
loadIconList();
|
|
@@ -5894,6 +5914,12 @@ RED.nodes = (function() {
|
|
|
5894
5914
|
}
|
|
5895
5915
|
node._config.x = node.x;
|
|
5896
5916
|
node._config.y = node.y;
|
|
5917
|
+
if (n.hasOwnProperty('w')) {
|
|
5918
|
+
node.w = n.w
|
|
5919
|
+
}
|
|
5920
|
+
if (n.hasOwnProperty('h')) {
|
|
5921
|
+
node.h = n.h
|
|
5922
|
+
}
|
|
5897
5923
|
} else if (n.type.substring(0,7) === "subflow") {
|
|
5898
5924
|
var parentId = n.type.split(":")[1];
|
|
5899
5925
|
var subflow = subflow_denylist[parentId]||subflow_map[parentId]||getSubflow(parentId);
|
|
@@ -8445,96 +8471,32 @@ RED.validators = {
|
|
|
8445
8471
|
return opt ? RED._("validator.errors.invalid-regexp") : false;
|
|
8446
8472
|
};
|
|
8447
8473
|
},
|
|
8448
|
-
typedInput: function(ptypeName,isConfig,mopt) {
|
|
8474
|
+
typedInput: function(ptypeName, isConfig, mopt) {
|
|
8475
|
+
let options = ptypeName
|
|
8476
|
+
if (typeof ptypeName === 'string' ) {
|
|
8477
|
+
options = {}
|
|
8478
|
+
options.typeField = ptypeName
|
|
8479
|
+
options.isConfig = isConfig
|
|
8480
|
+
options.allowBlank = false
|
|
8481
|
+
}
|
|
8449
8482
|
return function(v, opt) {
|
|
8450
|
-
|
|
8451
|
-
if (ptype
|
|
8452
|
-
|
|
8453
|
-
JSON.parse(v);
|
|
8454
|
-
return true;
|
|
8455
|
-
} catch(err) {
|
|
8456
|
-
if (opt && opt.label) {
|
|
8457
|
-
return RED._("validator.errors.invalid-json-prop", {
|
|
8458
|
-
error: err.message,
|
|
8459
|
-
prop: opt.label,
|
|
8460
|
-
});
|
|
8461
|
-
}
|
|
8462
|
-
return opt ? RED._("validator.errors.invalid-json", {
|
|
8463
|
-
error: err.message
|
|
8464
|
-
}) : false;
|
|
8465
|
-
}
|
|
8466
|
-
} else if (ptype === 'msg' || ptype === 'flow' || ptype === 'global' ) {
|
|
8467
|
-
if (RED.utils.validatePropertyExpression(v)) {
|
|
8468
|
-
return true;
|
|
8469
|
-
}
|
|
8470
|
-
if (opt && opt.label) {
|
|
8471
|
-
return RED._("validator.errors.invalid-prop-prop", {
|
|
8472
|
-
prop: opt.label
|
|
8473
|
-
});
|
|
8474
|
-
}
|
|
8475
|
-
return opt ? RED._("validator.errors.invalid-prop") : false;
|
|
8476
|
-
} else if (ptype === 'num') {
|
|
8477
|
-
if (/^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/.test(v)) {
|
|
8478
|
-
return true;
|
|
8479
|
-
}
|
|
8480
|
-
if (opt && opt.label) {
|
|
8481
|
-
return RED._("validator.errors.invalid-num-prop", {
|
|
8482
|
-
prop: opt.label
|
|
8483
|
-
});
|
|
8484
|
-
}
|
|
8485
|
-
return opt ? RED._("validator.errors.invalid-num") : false;
|
|
8483
|
+
let ptype = options.type
|
|
8484
|
+
if (!ptype && options.typeField) {
|
|
8485
|
+
ptype = $("#node-"+(options.isConfig?"config-":"")+"input-"+options.typeField).val() || this[options.typeField];
|
|
8486
8486
|
}
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
}
|
|
8490
|
-
};
|
|
8491
|
-
;// Mermaid diagram stub library for on-demand dynamic loading
|
|
8492
|
-
// Will be overwritten after script loading by $.getScript
|
|
8493
|
-
var mermaid = (function () {
|
|
8494
|
-
var enabled /* = undefined */;
|
|
8495
|
-
|
|
8496
|
-
var initializing = false;
|
|
8497
|
-
var initCalled = false;
|
|
8498
|
-
|
|
8499
|
-
function initialize(opt) {
|
|
8500
|
-
if (enabled === undefined) {
|
|
8501
|
-
if (RED.settings.markdownEditor &&
|
|
8502
|
-
RED.settings.markdownEditor.mermaid) {
|
|
8503
|
-
enabled = RED.settings.markdownEditor.mermaid.enabled;
|
|
8487
|
+
if (options.allowBlank && v === '') {
|
|
8488
|
+
return true
|
|
8504
8489
|
}
|
|
8505
|
-
|
|
8506
|
-
|
|
8490
|
+
const result = RED.utils.validateTypedProperty(v, ptype, opt)
|
|
8491
|
+
if (result === true || opt) {
|
|
8492
|
+
// Valid, or opt provided - return result as-is
|
|
8493
|
+
return result
|
|
8507
8494
|
}
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
initializing = true;
|
|
8511
|
-
$.getScript("vendor/mermaid/mermaid.min.js",
|
|
8512
|
-
function (data, stat, jqxhr) {
|
|
8513
|
-
$(".mermaid").show();
|
|
8514
|
-
// invoke loaded mermaid API
|
|
8515
|
-
initializing = false;
|
|
8516
|
-
mermaid.initialize(opt);
|
|
8517
|
-
if (initCalled) {
|
|
8518
|
-
mermaid.init();
|
|
8519
|
-
initCalled = false;
|
|
8520
|
-
}
|
|
8521
|
-
});
|
|
8522
|
-
}
|
|
8523
|
-
}
|
|
8524
|
-
|
|
8525
|
-
function init() {
|
|
8526
|
-
if (initializing) {
|
|
8527
|
-
$(".mermaid").hide();
|
|
8528
|
-
initCalled = true;
|
|
8495
|
+
// No opt - need to return false for backwards compatibilty
|
|
8496
|
+
return false
|
|
8529
8497
|
}
|
|
8530
8498
|
}
|
|
8531
|
-
|
|
8532
|
-
return {
|
|
8533
|
-
initialize: initialize,
|
|
8534
|
-
init: init,
|
|
8535
|
-
};
|
|
8536
|
-
})();
|
|
8537
|
-
;/**
|
|
8499
|
+
};;/**
|
|
8538
8500
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
|
8539
8501
|
*
|
|
8540
8502
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -8637,28 +8599,8 @@ RED.utils = (function() {
|
|
|
8637
8599
|
|
|
8638
8600
|
renderer.code = function (code, lang) {
|
|
8639
8601
|
if(lang === "mermaid") {
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
if (RED.settings.markdownEditor &&
|
|
8643
|
-
RED.settings.markdownEditor.mermaid) {
|
|
8644
|
-
mermaidIsEnabled = RED.settings.markdownEditor.mermaid.enabled;
|
|
8645
|
-
}
|
|
8646
|
-
else {
|
|
8647
|
-
mermaidIsEnabled = true;
|
|
8648
|
-
}
|
|
8649
|
-
}
|
|
8650
|
-
if (mermaidIsEnabled) {
|
|
8651
|
-
if (!mermaidIsInitialized) {
|
|
8652
|
-
mermaidIsInitialized = true;
|
|
8653
|
-
mermaid.initialize({startOnLoad:false});
|
|
8654
|
-
}
|
|
8655
|
-
return `<pre class='mermaid'>${code}</pre>`;
|
|
8656
|
-
}
|
|
8657
|
-
else {
|
|
8658
|
-
return `<details><summary>${RED._("markdownEditor.mermaid.summary")}</summary><pre><code>${code}</code></pre></details>`;
|
|
8659
|
-
}
|
|
8660
|
-
}
|
|
8661
|
-
else {
|
|
8602
|
+
return `<pre class='mermaid'>${code}</pre>`;
|
|
8603
|
+
} else {
|
|
8662
8604
|
return "<pre><code>" +code +"</code></pre>";
|
|
8663
8605
|
}
|
|
8664
8606
|
};
|
|
@@ -9453,6 +9395,51 @@ RED.utils = (function() {
|
|
|
9453
9395
|
}
|
|
9454
9396
|
}
|
|
9455
9397
|
|
|
9398
|
+
/**
|
|
9399
|
+
* Checks a typed property is valid according to the type.
|
|
9400
|
+
* Returns true if valid.
|
|
9401
|
+
* Return String error message if invalid
|
|
9402
|
+
* @param {*} propertyType
|
|
9403
|
+
* @param {*} propertyValue
|
|
9404
|
+
* @returns true if valid, String if invalid
|
|
9405
|
+
*/
|
|
9406
|
+
function validateTypedProperty(propertyValue, propertyType, opt) {
|
|
9407
|
+
|
|
9408
|
+
let error
|
|
9409
|
+
if (propertyType === 'json') {
|
|
9410
|
+
try {
|
|
9411
|
+
JSON.parse(propertyValue);
|
|
9412
|
+
} catch(err) {
|
|
9413
|
+
error = RED._("validator.errors.invalid-json", {
|
|
9414
|
+
error: err.message
|
|
9415
|
+
})
|
|
9416
|
+
}
|
|
9417
|
+
} else if (propertyType === 'msg' || propertyType === 'flow' || propertyType === 'global' ) {
|
|
9418
|
+
if (!RED.utils.validatePropertyExpression(propertyValue)) {
|
|
9419
|
+
error = RED._("validator.errors.invalid-prop")
|
|
9420
|
+
}
|
|
9421
|
+
} else if (propertyType === 'num') {
|
|
9422
|
+
if (!/^NaN$|^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$|^[+-]?(0b|0B)[01]+$|^[+-]?(0o|0O)[0-7]+$|^[+-]?(0x|0X)[0-9a-fA-F]+$/.test(propertyValue)) {
|
|
9423
|
+
error = RED._("validator.errors.invalid-num")
|
|
9424
|
+
}
|
|
9425
|
+
} else if (propertyType === 'jsonata') {
|
|
9426
|
+
try {
|
|
9427
|
+
jsonata(propertyValue)
|
|
9428
|
+
} catch(err) {
|
|
9429
|
+
error = RED._("validator.errors.invalid-expr", {
|
|
9430
|
+
error: err.message
|
|
9431
|
+
})
|
|
9432
|
+
}
|
|
9433
|
+
}
|
|
9434
|
+
if (error) {
|
|
9435
|
+
if (opt && opt.label) {
|
|
9436
|
+
return opt.label+': '+error
|
|
9437
|
+
}
|
|
9438
|
+
return error
|
|
9439
|
+
}
|
|
9440
|
+
return true
|
|
9441
|
+
}
|
|
9442
|
+
|
|
9456
9443
|
function getMessageProperty(msg,expr) {
|
|
9457
9444
|
var result = null;
|
|
9458
9445
|
var msgPropParts;
|
|
@@ -9987,7 +9974,8 @@ RED.utils = (function() {
|
|
|
9987
9974
|
getDarkerColor: getDarkerColor,
|
|
9988
9975
|
parseModuleList: parseModuleList,
|
|
9989
9976
|
checkModuleAllowed: checkModuleAllowed,
|
|
9990
|
-
getBrowserInfo: getBrowserInfo
|
|
9977
|
+
getBrowserInfo: getBrowserInfo,
|
|
9978
|
+
validateTypedProperty: validateTypedProperty
|
|
9991
9979
|
}
|
|
9992
9980
|
})();
|
|
9993
9981
|
;/**
|
|
@@ -14274,7 +14262,9 @@ RED.stack = (function() {
|
|
|
14274
14262
|
valueLabel: contextLabel
|
|
14275
14263
|
},
|
|
14276
14264
|
str: {value:"str",label:"string",icon:"red/images/typedInput/az.svg"},
|
|
14277
|
-
num: {value:"num",label:"number",icon:"red/images/typedInput/09.svg",validate
|
|
14265
|
+
num: {value:"num",label:"number",icon:"red/images/typedInput/09.svg",validate: function(v) {
|
|
14266
|
+
return (true === RED.utils.validateTypedProperty(v, "num"));
|
|
14267
|
+
} },
|
|
14278
14268
|
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.svg",options:["true","false"]},
|
|
14279
14269
|
json: {
|
|
14280
14270
|
value:"json",
|
|
@@ -19586,6 +19576,8 @@ RED.keyboard = (function() {
|
|
|
19586
19576
|
|
|
19587
19577
|
RED.workspaces = (function() {
|
|
19588
19578
|
|
|
19579
|
+
const documentTitle = document.title;
|
|
19580
|
+
|
|
19589
19581
|
var activeWorkspace = 0;
|
|
19590
19582
|
var workspaceIndex = 0;
|
|
19591
19583
|
|
|
@@ -19908,12 +19900,18 @@ RED.workspaces = (function() {
|
|
|
19908
19900
|
$("#red-ui-workspace-chart").show();
|
|
19909
19901
|
activeWorkspace = tab.id;
|
|
19910
19902
|
window.location.hash = 'flow/'+tab.id;
|
|
19903
|
+
if (tab.label) {
|
|
19904
|
+
document.title = `${documentTitle} : ${tab.label}`
|
|
19905
|
+
} else {
|
|
19906
|
+
document.title = documentTitle
|
|
19907
|
+
}
|
|
19911
19908
|
$("#red-ui-workspace").toggleClass("red-ui-workspace-disabled", !!tab.disabled);
|
|
19912
19909
|
$("#red-ui-workspace").toggleClass("red-ui-workspace-locked", !!tab.locked);
|
|
19913
19910
|
} else {
|
|
19914
19911
|
$("#red-ui-workspace-chart").hide();
|
|
19915
19912
|
activeWorkspace = 0;
|
|
19916
19913
|
window.location.hash = '';
|
|
19914
|
+
document.title = documentTitle
|
|
19917
19915
|
}
|
|
19918
19916
|
event.workspace = activeWorkspace;
|
|
19919
19917
|
RED.events.emit("workspace:change",event);
|
|
@@ -24710,7 +24708,7 @@ RED.view = (function() {
|
|
|
24710
24708
|
nodeEl.__statusGroup__.style.display = "none";
|
|
24711
24709
|
} else {
|
|
24712
24710
|
nodeEl.__statusGroup__.style.display = "inline";
|
|
24713
|
-
let backgroundWidth =
|
|
24711
|
+
let backgroundWidth = 15
|
|
24714
24712
|
var fill = status_colours[d.status.fill]; // Only allow our colours for now
|
|
24715
24713
|
if (d.status.shape == null && fill == null) {
|
|
24716
24714
|
backgroundWidth = 0
|
|
@@ -24730,7 +24728,11 @@ RED.view = (function() {
|
|
|
24730
24728
|
nodeEl.__statusLabel__.textContent = "";
|
|
24731
24729
|
}
|
|
24732
24730
|
const textSize = nodeEl.__statusLabel__.getBBox()
|
|
24733
|
-
|
|
24731
|
+
backgroundWidth += textSize.width
|
|
24732
|
+
if (backgroundWidth > 0 && textSize.width > 0) {
|
|
24733
|
+
backgroundWidth += 6
|
|
24734
|
+
}
|
|
24735
|
+
nodeEl.__statusBackground__.setAttribute('width', backgroundWidth)
|
|
24734
24736
|
}
|
|
24735
24737
|
delete d.dirtyStatus;
|
|
24736
24738
|
}
|
|
@@ -25142,8 +25144,8 @@ RED.view = (function() {
|
|
|
25142
25144
|
statusBackground.setAttribute("y",-1);
|
|
25143
25145
|
statusBackground.setAttribute("width",200);
|
|
25144
25146
|
statusBackground.setAttribute("height",13);
|
|
25145
|
-
statusBackground.setAttribute("rx",
|
|
25146
|
-
statusBackground.setAttribute("ry",
|
|
25147
|
+
statusBackground.setAttribute("rx",2);
|
|
25148
|
+
statusBackground.setAttribute("ry",2);
|
|
25147
25149
|
|
|
25148
25150
|
statusEl.appendChild(statusBackground);
|
|
25149
25151
|
node[0][0].__statusBackground__ = statusBackground;
|
|
@@ -30149,7 +30151,7 @@ RED.sidebar.info = (function() {
|
|
|
30149
30151
|
}
|
|
30150
30152
|
$(this).toggleClass('expanded',!isExpanded);
|
|
30151
30153
|
});
|
|
30152
|
-
mermaid.
|
|
30154
|
+
RED.editor.mermaid.render()
|
|
30153
30155
|
}
|
|
30154
30156
|
|
|
30155
30157
|
var tips = (function() {
|
|
@@ -31387,6 +31389,7 @@ RED.sidebar.help = (function() {
|
|
|
31387
31389
|
$(this).toggleClass('expanded',!isExpanded);
|
|
31388
31390
|
})
|
|
31389
31391
|
helpSection.parent().scrollTop(0);
|
|
31392
|
+
RED.editor.mermaid.render()
|
|
31390
31393
|
}
|
|
31391
31394
|
|
|
31392
31395
|
function set(html,title) {
|
|
@@ -33696,8 +33699,9 @@ RED.editor = (function() {
|
|
|
33696
33699
|
var valid = validateNodeProperty(node, definition, prop, properties[prop]);
|
|
33697
33700
|
if ((typeof valid) === "string") {
|
|
33698
33701
|
result.push(valid);
|
|
33699
|
-
}
|
|
33700
|
-
|
|
33702
|
+
} else if (Array.isArray(valid)) {
|
|
33703
|
+
result = result.concat(valid)
|
|
33704
|
+
} else if(!valid) {
|
|
33701
33705
|
result.push(prop);
|
|
33702
33706
|
}
|
|
33703
33707
|
}
|
|
@@ -33746,7 +33750,7 @@ RED.editor = (function() {
|
|
|
33746
33750
|
// If the validator takes two arguments, it is a 3.x validator that
|
|
33747
33751
|
// can return a String to mean 'invalid' and provide a reason
|
|
33748
33752
|
if ((definition[property].validate.length === 2) &&
|
|
33749
|
-
((typeof valid) === "string")) {
|
|
33753
|
+
((typeof valid) === "string") || Array.isArray(valid)) {
|
|
33750
33754
|
return valid;
|
|
33751
33755
|
} else {
|
|
33752
33756
|
// Otherwise, a 2.x returns a truth-like/false-like value that
|
|
@@ -33762,6 +33766,17 @@ RED.editor = (function() {
|
|
|
33762
33766
|
error: err.message
|
|
33763
33767
|
});
|
|
33764
33768
|
}
|
|
33769
|
+
} else if (valid) {
|
|
33770
|
+
// If the validator is not provided in node property => Check if the input has a validator
|
|
33771
|
+
if ("category" in node._def) {
|
|
33772
|
+
const isConfig = node._def.category === "config";
|
|
33773
|
+
const prefix = isConfig ? "node-config-input" : "node-input";
|
|
33774
|
+
const input = $("#"+prefix+"-"+property);
|
|
33775
|
+
const isTypedInput = input.length > 0 && input.next(".red-ui-typedInput-container").length > 0;
|
|
33776
|
+
if (isTypedInput) {
|
|
33777
|
+
valid = input.typedInput("validate");
|
|
33778
|
+
}
|
|
33779
|
+
}
|
|
33765
33780
|
}
|
|
33766
33781
|
if (valid && definition[property].type && RED.nodes.getType(definition[property].type) && !("validate" in definition[property])) {
|
|
33767
33782
|
if (!value || value == "_ADD_") {
|
|
@@ -36928,7 +36943,7 @@ RED.editor = (function() {
|
|
|
36928
36943
|
var i=0,l=bufferBinValue.length;
|
|
36929
36944
|
var c = 0;
|
|
36930
36945
|
for(i=0;i<l;i++) {
|
|
36931
|
-
var d = parseInt(bufferBinValue[i]);
|
|
36946
|
+
var d = parseInt(Number(bufferBinValue[i]));
|
|
36932
36947
|
if (!isString && (isNaN(d) || d < 0 || d > 255)) {
|
|
36933
36948
|
valid = false;
|
|
36934
36949
|
break;
|
|
@@ -39396,7 +39411,7 @@ RED.editor = (function() {
|
|
|
39396
39411
|
var currentScrollTop = $(".red-ui-editor-type-markdown-panel-preview").scrollTop();
|
|
39397
39412
|
$(".red-ui-editor-type-markdown-panel-preview").html(RED.utils.renderMarkdown(expressionEditor.getValue()));
|
|
39398
39413
|
$(".red-ui-editor-type-markdown-panel-preview").scrollTop(currentScrollTop);
|
|
39399
|
-
mermaid.
|
|
39414
|
+
RED.editor.mermaid.render()
|
|
39400
39415
|
},200);
|
|
39401
39416
|
})
|
|
39402
39417
|
if (options.header) {
|
|
@@ -39405,7 +39420,7 @@ RED.editor = (function() {
|
|
|
39405
39420
|
|
|
39406
39421
|
if (value) {
|
|
39407
39422
|
$(".red-ui-editor-type-markdown-panel-preview").html(RED.utils.renderMarkdown(expressionEditor.getValue()));
|
|
39408
|
-
mermaid.
|
|
39423
|
+
RED.editor.mermaid.render()
|
|
39409
39424
|
}
|
|
39410
39425
|
panels = RED.panels.create({
|
|
39411
39426
|
id:"red-ui-editor-type-markdown-panels",
|
|
@@ -39511,6 +39526,60 @@ RED.editor = (function() {
|
|
|
39511
39526
|
}
|
|
39512
39527
|
RED.editor.registerTypeEditor("_markdown", definition);
|
|
39513
39528
|
})();
|
|
39529
|
+
;RED.editor.mermaid = (function () {
|
|
39530
|
+
let initializing = false
|
|
39531
|
+
let loaded = false
|
|
39532
|
+
let pendingEvals = []
|
|
39533
|
+
let diagramIds = 0
|
|
39534
|
+
|
|
39535
|
+
function render(selector = '.mermaid') {
|
|
39536
|
+
// $(selector).hide()
|
|
39537
|
+
if (!loaded) {
|
|
39538
|
+
pendingEvals.push(selector)
|
|
39539
|
+
|
|
39540
|
+
if (!initializing) {
|
|
39541
|
+
initializing = true
|
|
39542
|
+
$.getScript(
|
|
39543
|
+
'vendor/mermaid/mermaid.min.js',
|
|
39544
|
+
function (data, stat, jqxhr) {
|
|
39545
|
+
mermaid.initialize({
|
|
39546
|
+
startOnLoad: false,
|
|
39547
|
+
theme: RED.settings.get('mermaid', {}).theme
|
|
39548
|
+
})
|
|
39549
|
+
loaded = true
|
|
39550
|
+
while(pendingEvals.length > 0) {
|
|
39551
|
+
const pending = pendingEvals.shift()
|
|
39552
|
+
render(pending)
|
|
39553
|
+
}
|
|
39554
|
+
}
|
|
39555
|
+
)
|
|
39556
|
+
}
|
|
39557
|
+
} else {
|
|
39558
|
+
const nodes = document.querySelectorAll(selector)
|
|
39559
|
+
|
|
39560
|
+
nodes.forEach(async node => {
|
|
39561
|
+
if (!node.getAttribute('mermaid-processed')) {
|
|
39562
|
+
const mermaidContent = node.innerText
|
|
39563
|
+
node.setAttribute('mermaid-processed', true)
|
|
39564
|
+
try {
|
|
39565
|
+
const { svg } = await mermaid.render('mermaid-render-'+Date.now()+'-'+(diagramIds++), mermaidContent);
|
|
39566
|
+
node.innerHTML = svg
|
|
39567
|
+
} catch (err) {
|
|
39568
|
+
$('<div>').css({
|
|
39569
|
+
fontSize: '0.8em',
|
|
39570
|
+
border: '1px solid var(--red-ui-border-color-error)',
|
|
39571
|
+
padding: '5px',
|
|
39572
|
+
marginBottom: '10px',
|
|
39573
|
+
}).text(err.toString()).prependTo(node)
|
|
39574
|
+
}
|
|
39575
|
+
}
|
|
39576
|
+
})
|
|
39577
|
+
}
|
|
39578
|
+
}
|
|
39579
|
+
return {
|
|
39580
|
+
render: render,
|
|
39581
|
+
};
|
|
39582
|
+
})();
|
|
39514
39583
|
;/**
|
|
39515
39584
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
|
39516
39585
|
*
|
|
@@ -40771,12 +40840,10 @@ RED.editor.codeEditor.monaco = (function() {
|
|
|
40771
40840
|
|
|
40772
40841
|
//Unbind ctrl-Enter (default action is to insert a newline in editor) This permits the shortcut to close the tray.
|
|
40773
40842
|
try {
|
|
40774
|
-
|
|
40775
|
-
|
|
40776
|
-
|
|
40777
|
-
|
|
40778
|
-
);
|
|
40779
|
-
} catch (error) { }
|
|
40843
|
+
monaco.editor.addKeybindingRule({keybinding: 0, command: "-editor.action.insertLineAfter"});
|
|
40844
|
+
} catch (error) {
|
|
40845
|
+
console.warn(error)
|
|
40846
|
+
}
|
|
40780
40847
|
|
|
40781
40848
|
ed.nodered = {
|
|
40782
40849
|
refreshModuleLibs: refreshModuleLibs //expose this for function node externalModules refresh
|
|
@@ -45109,8 +45176,8 @@ RED.search = (function() {
|
|
|
45109
45176
|
|
|
45110
45177
|
menuItems.push(
|
|
45111
45178
|
null,
|
|
45112
|
-
{ onselect: 'core:undo', disabled: RED.history.list().length === 0 },
|
|
45113
|
-
{ onselect: 'core:redo', disabled: RED.history.listRedo().length === 0 },
|
|
45179
|
+
{ onselect: 'core:undo', label: RED._("keyboard.undoChange"), disabled: RED.history.list().length === 0 },
|
|
45180
|
+
{ onselect: 'core:redo', label: RED._("keyboard.redoChange"), disabled: RED.history.listRedo().length === 0 },
|
|
45114
45181
|
null,
|
|
45115
45182
|
{ onselect: 'core:cut-selection-to-internal-clipboard', label: RED._("keyboard.cutNode"), disabled: !canEdit || !hasSelection },
|
|
45116
45183
|
{ onselect: 'core:copy-selection-to-internal-clipboard', label: RED._("keyboard.copyNode"), disabled: !hasSelection },
|
|
@@ -45118,7 +45185,7 @@ RED.search = (function() {
|
|
|
45118
45185
|
{ onselect: 'core:delete-selection', disabled: !canEdit || !canDelete },
|
|
45119
45186
|
{ onselect: 'core:delete-selection-and-reconnect', label: RED._('keyboard.deleteReconnect'), disabled: !canEdit || !canDelete },
|
|
45120
45187
|
{ onselect: 'core:show-export-dialog', label: RED._("menu.label.export") },
|
|
45121
|
-
{ onselect: 'core:select-all-nodes' },
|
|
45188
|
+
{ onselect: 'core:select-all-nodes', label: RED._("keyboard.selectAll") },
|
|
45122
45189
|
)
|
|
45123
45190
|
}
|
|
45124
45191
|
|
|
@@ -45742,7 +45809,7 @@ RED.actionList = (function() {
|
|
|
45742
45809
|
}
|
|
45743
45810
|
}
|
|
45744
45811
|
function applyFilter(filter,type,def) {
|
|
45745
|
-
return !filter ||
|
|
45812
|
+
return !def || !filter ||
|
|
45746
45813
|
(
|
|
45747
45814
|
(!filter.spliceMultiple) &&
|
|
45748
45815
|
(!filter.type || type === filter.type) &&
|
|
@@ -50885,7 +50952,7 @@ RED.projects.settings = (function() {
|
|
|
50885
50952
|
var description = addTargetToExternalLinks($('<span class="red-ui-text-bidi-aware" dir=\"'+RED.text.bidi.resolveBaseTextDir(desc)+'">'+desc+'</span>')).appendTo(container);
|
|
50886
50953
|
description.find(".red-ui-text-bidi-aware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" );
|
|
50887
50954
|
setTimeout(function () {
|
|
50888
|
-
mermaid.
|
|
50955
|
+
RED.editor.mermaid.render()
|
|
50889
50956
|
}, 200);
|
|
50890
50957
|
}
|
|
50891
50958
|
|
|
@@ -53493,9 +53560,9 @@ RED.sidebar.versionControl = (function() {
|
|
|
53493
53560
|
$.getJSON("projects/"+activeProject.name+"/commits/"+entry.sha,function(result) {
|
|
53494
53561
|
result.project = activeProject;
|
|
53495
53562
|
result.parents = entry.parents;
|
|
53496
|
-
result.oldRev = entry.sha+"~1";
|
|
53563
|
+
result.oldRev = entry.parents[0].length !== 0 ? entry.sha+"~1" : entry.sha;
|
|
53497
53564
|
result.newRev = entry.sha;
|
|
53498
|
-
result.oldRevTitle = RED._("sidebar.project.versionControl.commitCapital")+" "+entry.sha.substring(0,7)+"~1";
|
|
53565
|
+
result.oldRevTitle = entry.parents[0].length !== 0 ? RED._("sidebar.project.versionControl.commitCapital")+" "+entry.sha.substring(0,7)+"~1" : " ";
|
|
53499
53566
|
result.newRevTitle = RED._("sidebar.project.versionControl.commitCapital")+" "+entry.sha.substring(0,7);
|
|
53500
53567
|
result.date = humanizeSinceDate(parseInt(entry.date));
|
|
53501
53568
|
RED.diff.showCommitDiff(result);
|