Skip to content

Commit

Permalink
Merge remote-tracking branch 'node-red/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
biancode committed Jul 24, 2022
2 parents a8d5eab + dc7fef6 commit 27be6b3
Show file tree
Hide file tree
Showing 29 changed files with 311 additions and 668 deletions.
574 changes: 52 additions & 522 deletions CHANGELOG.md

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red",
"version": "3.0.0-beta.4",
"version": "3.0.1",
"description": "Low-code programming for event-driven applications",
"homepage": "http://nodered.org",
"license": "Apache-2.0",
Expand Down Expand Up @@ -49,7 +49,7 @@
"hash-sum": "2.0.0",
"hpagent": "1.0.0",
"https-proxy-agent": "5.0.1",
"i18next": "21.8.10",
"i18next": "21.8.14",
"iconv-lite": "0.6.3",
"is-utf8": "0.2.1",
"js-yaml": "4.1.0",
Expand All @@ -59,7 +59,7 @@
"media-typer": "1.1.0",
"memorystore": "1.6.7",
"mime": "3.0.0",
"moment": "2.29.3",
"moment": "2.29.4",
"moment-timezone": "0.5.34",
"mqtt": "4.3.7",
"multer": "1.4.5-lts.1",
Expand All @@ -69,14 +69,14 @@
"nopt": "5.0.0",
"oauth2orize": "1.11.1",
"on-headers": "1.0.2",
"passport": "0.5.2",
"passport": "0.6.0",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
"raw-body": "2.5.1",
"semver": "7.3.7",
"tar": "6.1.11",
"tough-cookie": "4.0.0",
"uglify-js": "3.16.0",
"uglify-js": "3.16.2",
"uuid": "8.3.2",
"ws": "7.5.6",
"xml2js": "0.4.23"
Expand All @@ -85,7 +85,7 @@
"bcrypt": "5.0.1"
},
"devDependencies": {
"dompurify": "2.3.8",
"dompurify": "2.3.9",
"grunt": "1.5.3",
"grunt-chmod": "~1.1.1",
"grunt-cli": "~1.4.3",
Expand All @@ -95,7 +95,7 @@
"grunt-contrib-concat": "2.1.0",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-jshint": "3.2.0",
"grunt-contrib-uglify": "5.2.1",
"grunt-contrib-uglify": "5.2.2",
"grunt-contrib-watch": "1.1.0",
"grunt-jsdoc": "2.4.1",
"grunt-jsdoc-to-markdown": "6.0.0",
Expand All @@ -108,17 +108,17 @@
"i18next-http-backend": "1.4.1",
"jquery-i18next": "1.2.1",
"jsdoc-nr-template": "github:node-red/jsdoc-nr-template",
"marked": "4.0.17",
"marked": "4.0.18",
"minami": "1.2.3",
"mocha": "9.2.2",
"node-red-node-test-helper": "^0.3.0",
"nodemon": "2.0.16",
"nodemon": "2.0.19",
"proxy": "^1.0.2",
"sass": "1.52.3",
"sass": "1.53.0",
"should": "13.2.3",
"sinon": "11.1.2",
"stoppable": "^1.1.0",
"supertest": "6.2.3"
"supertest": "6.2.4"
},
"engines": {
"node": ">=14"
Expand Down
64 changes: 62 additions & 2 deletions packages/node_modules/@node-red/editor-api/lib/editor/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,69 @@ module.exports = {
theme.page = theme.page || {_:{}}
theme.page._.scripts = scriptFiles.concat(theme.page._.scripts || [])
}
if(theme.codeEditor) {
theme.codeEditor.options = Object.assign({}, themePlugin.monacoOptions, theme.codeEditor.options);
// check and load page settings from theme
if (themePlugin.page) {
if (themePlugin.page.favicon && !theme.page.favicon) {
const result = serveFilesFromTheme(
[themePlugin.page.favicon],
themeApp,
"/",
themePlugin.path
)
if(result && result.length > 0) {
// update themeContext page favicon
themeContext.page.favicon = result[0]
theme.page = theme.page || {_:{}}
theme.page._.favicon = result[0]
}
}
if (themePlugin.page.tabicon && themePlugin.page.tabicon.icon && !theme.page.tabicon) {
const result = serveFilesFromTheme(
[themePlugin.page.tabicon.icon],
themeApp,
"/page/",
themePlugin.path
)
if(result && result.length > 0) {
// update themeContext page tabicon
themeContext.page.tabicon.icon = result[0]
themeContext.page.tabicon.colour = themeContext.page.tabicon.colour || themeContext.page.tabicon.colour
theme.page = theme.page || {_:{}}
theme.page._.tabicon = theme.page._.tabicon || {}
theme.page._.tabicon.icon = themeContext.page.tabicon.icon
theme.page._.tabicon.colour = themeContext.page.tabicon.colour
}
}
// if the plugin has a title AND the users settings.js does NOT
if (themePlugin.page.title && !theme.page.title) {
themeContext.page.title = themePlugin.page.title || themeContext.page.title
}
}
// check and load header settings from theme
if (themePlugin.header) {
if (themePlugin.header.image && !theme.header.image) {
const result = serveFilesFromTheme(
[themePlugin.header.image],
themeApp,
"/header/",
themePlugin.path
)
if(result && result.length > 0) {
// update themeContext header image
themeContext.header.image = result[0]
}
}
// if the plugin has a title AND the users settings.js does NOT have a title
if (themePlugin.header.title && !theme.header.title) {
themeContext.header.title = themePlugin.header.title || themeContext.header.title
}
// if the plugin has a header url AND the users settings.js does NOT
if (themePlugin.header.url && !theme.header.url) {
themeContext.header.url = themePlugin.header.url || themeContext.header.url
}
}
theme.codeEditor = theme.codeEditor || {}
theme.codeEditor.options = Object.assign({}, themePlugin.monacoOptions, theme.codeEditor.options);
}
activeThemeInitialised = true;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/node_modules/@node-red/editor-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-red/editor-api",
"version": "3.0.0-beta.4",
"version": "3.0.1",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
Expand All @@ -16,8 +16,8 @@
}
],
"dependencies": {
"@node-red/util": "3.0.0-beta.4",
"@node-red/editor-client": "3.0.0-beta.4",
"@node-red/util": "3.0.1",
"@node-red/editor-client": "3.0.1",
"bcryptjs": "2.4.3",
"body-parser": "1.20.0",
"clone": "2.1.2",
Expand All @@ -31,7 +31,7 @@
"oauth2orize": "1.11.1",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
"passport": "0.5.2",
"passport": "0.6.0",
"ws": "7.5.6"
},
"optionalDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/node_modules/@node-red/editor-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@node-red/editor-client",
"version": "3.0.0-beta.4",
"version": "3.0.1",
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ var RED = (function() {
$('<div id="red-ui-header-shade" class="hide"></div>').appendTo(header);
$('<div id="red-ui-main-container" class="red-ui-sidebar-closed hide">'+
'<div id="red-ui-workspace"></div>'+
'<div id="red-ui-editor-stack"></div>'+
'<div id="red-ui-editor-stack" tabindex="-1"></div>'+
'<div id="red-ui-palette"></div>'+
'<div id="red-ui-sidebar"></div>'+
'<div id="red-ui-sidebar-separator"></div>'+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
optEl.append(generateSpans(srcMatch));
optEl.appendTo(element);
}
matches.push({
value: optVal,
label: element,
i: (valMatch.found ? valMatch.index : srcMatch.index)
matches.push({
value: optVal,
label: element,
i: (valMatch.found ? valMatch.index : srcMatch.index)
});
}
})
Expand Down Expand Up @@ -501,7 +501,7 @@
this.options.types = this.options.types||Object.keys(allOptions);
}

this.selectTrigger = $('<button class="red-ui-typedInput-type-select" tabindex="0"></button>').prependTo(this.uiSelect);
this.selectTrigger = $('<button type="button" class="red-ui-typedInput-type-select" tabindex="0"></button>').prependTo(this.uiSelect);
$('<i class="red-ui-typedInput-icon fa fa-caret-down"></i>').toggle(this.options.types.length > 1).appendTo(this.selectTrigger);

this.selectLabel = $('<span class="red-ui-typedInput-type-label"></span>').appendTo(this.selectTrigger);
Expand Down Expand Up @@ -570,7 +570,7 @@
})

// explicitly set optionSelectTrigger display to inline-block otherwise jQ sets it to 'inline'
this.optionSelectTrigger = $('<button tabindex="0" class="red-ui-typedInput-option-trigger" style="display:inline-block"><span class="red-ui-typedInput-option-caret"><i class="red-ui-typedInput-icon fa fa-caret-down"></i></span></button>').appendTo(this.uiSelect);
this.optionSelectTrigger = $('<button type="button" tabindex="0" class="red-ui-typedInput-option-trigger" style="display:inline-block"><span class="red-ui-typedInput-option-caret"><i class="red-ui-typedInput-icon fa fa-caret-down"></i></span></button>').appendTo(this.uiSelect);
this.optionSelectLabel = $('<span class="red-ui-typedInput-option-label"></span>').prependTo(this.optionSelectTrigger);
// RED.popover.tooltip(this.optionSelectLabel,function() {
// return that.optionValue;
Expand All @@ -591,7 +591,7 @@
that.uiSelect.addClass('red-ui-typedInput-focus');
});

this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"></button>').appendTo(this.uiSelect);
this.optionExpandButton = $('<button type="button" tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"></button>').appendTo(this.uiSelect);
this.optionExpandButtonIcon = $('<i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i>').appendTo(this.optionExpandButton);

this.type(this.typeField.val() || this.options.default||this.typeList[0].value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,24 @@ RED.contextMenu = (function () {
}

const selection = RED.view.selection()
const noSelection = !selection || Object.keys(selection).length === 0
const hasSelection = (selection.nodes && selection.nodes.length > 0);
const hasMultipleSelection = hasSelection && selection.nodes.length > 1;
const hasLinks = selection.links && selection.links.length > 0;
const isSingleLink = !hasSelection && hasLinks && selection.links.length === 1
const isMultipleLinks = !hasSelection && hasLinks && selection.links.length > 1
const virtulLinks = (selection.links && selection.links.filter(e => !!e.link)) || [];
const wireLinks = (selection.links && selection.links.filter(e => !e.link)) || [];
const hasLinks = wireLinks.length > 0;
const isSingleLink = !hasSelection && hasLinks && wireLinks.length === 1
const isMultipleLinks = !hasSelection && hasLinks && wireLinks.length > 1
const canDelete = hasSelection || hasLinks
const isGroup = hasSelection && selection.nodes.length === 1 && selection.nodes[0].type === 'group'

const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
const offset = $("#red-ui-workspace-chart").offset()

let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
let addY = options.y - offset.top + $("#red-ui-workspace-chart").scrollTop()

if (RED.view.snapGrid) {
const gridSize = RED.view.gridSize()
addX = gridSize * Math.floor(addX / gridSize)
addY = gridSize * Math.floor(addY / gridSize)
}
// addX/addY must be the position in the workspace accounting for both scroll and scale
// The +5 is because we display the contextMenu -5,-5 to actual click position
let addX = (options.x + 5 - offset.left + $("#red-ui-workspace-chart").scrollLeft()) / RED.view.scale()
let addY = (options.y + 5 - offset.top + $("#red-ui-workspace-chart").scrollTop()) / RED.view.scale()

const menuItems = [
{ onselect: 'core:show-action-list', onpostselect: function () { } },
Expand All @@ -64,9 +63,13 @@ RED.contextMenu = (function () {
splice: isSingleLink ? selection.links[0] : undefined,
// spliceMultiple: isMultipleLinks
})
},
onpostselect: function() {
// ensure quick add dialog search input has focus
$('#red-ui-type-search-input').trigger('focus')
}
},
(hasSelection || hasLinks) ? {
(hasLinks) ? { // has least 1 wire selected
label: RED._("contextMenu.junction"),
onselect: 'core:split-wires-with-junctions',
disabled: !hasLinks
Expand All @@ -93,6 +96,7 @@ RED.contextMenu = (function () {
RED.nodes.addJunction(nn);
RED.history.push(historyEvent);
RED.nodes.dirty(true);
RED.view.select({nodes: [nn] });
RED.view.redraw(true)
}
},
Expand Down Expand Up @@ -140,7 +144,7 @@ RED.contextMenu = (function () {
($(window).width() -MENU_WIDTH)) {
direction = "left";
}

menu = RED.menu.init({
direction: direction,
onpreselect: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,10 @@ RED.editor = (function() {
if (editing_node) {
RED.sidebar.info.refresh(editing_node);
RED.sidebar.help.show(editing_node.type, false);
//ensure focused element is NOT body (for keyboard scope to operate correctly)
if (document.activeElement.tagName === 'BODY') {
$('#red-ui-editor-stack').trigger('focus')
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ RED.editor.codeEditor.monaco = (function() {


if(!options.stateId && options.stateId !== false) {
options.stateId = RED.editor.generateViewStateId("monaco", options, (options.mode || options.title).split("/").pop());
options.stateId = RED.editor.generateViewStateId("monaco", options, (options.mode || options.title || "").split("/").pop());
}
var el = options.element || $("#"+options.id)[0];
var toolbarRow = $("<div>").appendTo(el);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ RED.group = (function() {
RED.history.push(historyEvent);
RED.view.select({nodes:[group]});
RED.nodes.dirty(true);
RED.view.focus();
}
}
}
Expand All @@ -330,6 +331,7 @@ RED.group = (function() {
RED.history.push(historyEvent);
RED.view.select({nodes:newSelection})
RED.nodes.dirty(true);
RED.view.focus();
}
}

Expand Down Expand Up @@ -424,6 +426,7 @@ RED.group = (function() {
});
RED.history.push(historyEvent);
RED.nodes.dirty(true);
RED.view.focus();
}
}

Expand Down Expand Up @@ -451,6 +454,7 @@ RED.group = (function() {
}
}
RED.view.select({nodes:selection.nodes})
RED.view.focus();
}
}
function createGroup(nodes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ RED.search = (function() {
}
if (flags.hasOwnProperty("unused")) {
var isUnused = (node.node.type === 'subflow' && node.node.instances.length === 0) ||
(isConfigNode && node.node.users.length === 0)
(isConfigNode && node.node.users.length === 0 && node.node._def.hasUsers !== false)
if (flags.unused !== isUnused) {
continue;
}
Expand Down Expand Up @@ -538,7 +538,7 @@ RED.search = (function() {
$(previousActiveElement).trigger("focus");
}
previousActiveElement = null;
}
}
if(!keepSearchToolbar) {
clearActiveSearch();
}
Expand Down Expand Up @@ -630,7 +630,7 @@ RED.search = (function() {
$("#red-ui-sidebar-shade").on('mousedown',hide);

$("#red-ui-view-searchtools-close").on("click", function close() {
clearActiveSearch();
clearActiveSearch();
updateSearchToolbar();
});
$("#red-ui-view-searchtools-close").trigger("click");
Expand Down
Loading

0 comments on commit 27be6b3

Please sign in to comment.