diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/panels.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/panels.js index 84e1d4c7e..22e415099 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/panels.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/panels.js @@ -23,53 +23,74 @@ RED.panels = (function() { if (children.length !== 2) { throw new Error("Container must have exactly two children"); } - + var vertical = (!options.dir || options.dir === "vertical"); container.addClass("red-ui-panels"); + if (!vertical) { + container.addClass("red-ui-panels-horizontal"); + } var separator = $('
').insertAfter(children[0]); var startPosition; - var panelHeights = []; - var modifiedHeights = false; + var panelSizes = []; + var modifiedSizes = false; var panelRatio; separator.draggable({ - axis: "y", + axis: vertical?"y":"x", containment: container, scroll: false, start:function(event,ui) { - var height = container.height(); - startPosition = ui.position.top; - panelHeights = [$(children[0]).height(),$(children[1]).height()]; + startPosition = vertical?ui.position.top:ui.position.left; + + panelSizes = [ + vertical?$(children[0]).height():$(children[0]).width(), + vertical?$(children[1]).height():$(children[1]).width() + ]; }, drag: function(event,ui) { - var height = container.height(); - var delta = ui.position.top-startPosition; - var newHeights = [panelHeights[0]+delta,panelHeights[1]-delta]; - $(children[0]).height(newHeights[0]); - $(children[1]).height(newHeights[1]); - if (options.resize) { - options.resize(newHeights[0],newHeights[1]); + var size = vertical?container.height():container.width(); + var delta = (vertical?ui.position.top:ui.position.left)-startPosition; + var newSizes = [panelSizes[0]+delta,panelSizes[1]-delta]; + if (vertical) { + $(children[0]).height(newSizes[0]); + $(children[1]).height(newSizes[1]); + ui.position.top -= delta; + } else { + $(children[0]).width(newSizes[0]); + $(children[1]).width(newSizes[1]); + ui.position.left -= delta; } - ui.position.top -= delta; - panelRatio = newHeights[0]/height; + if (options.resize) { + options.resize(newSizes[0],newSizes[1]); + } + panelRatio = newSizes[0]/size; }, stop:function(event,ui) { - modifiedHeights = true; + modifiedSizes = true; } }); return { - resize: function(height) { - var panelHeights = [$(children[0]).height(),$(children[1]).height()]; - container.height(height); - if (modifiedHeights) { - var topPanelHeight = panelRatio*height; - var bottomPanelHeight = height - topPanelHeight - 48; - panelHeights = [topPanelHeight,bottomPanelHeight]; - $(children[0]).height(panelHeights[0]); - $(children[1]).height(panelHeights[1]); + resize: function(size) { + var panelSizes = [$(children[0]).height(),$(children[1]).height()]; + if (vertical) { + container.height(size); + } else { + container.width(size); + } + if (modifiedSizes) { + var topPanelSize = panelRatio*size; + var bottomPanelSize = size - topPanelSize - 48; + panelSizes = [topPanelSize,bottomPanelSize]; + if (vertical) { + $(children[0]).height(panelSizes[0]); + $(children[1]).height(panelSizes[1]); + } else { + $(children[0]).width(panelSizes[0]); + $(children[1]).width(panelSizes[1]); + } } if (options.resize) { - options.resize(panelHeights[0],panelHeights[1]); + options.resize(panelSizes[0],panelSizes[1]); } } } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js index 73ef5e6b7..18e9e3ec5 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js @@ -884,7 +884,9 @@ RED.editor = (function() { function buildDescriptionForm(container,node) { var dialogForm = $('
').appendTo(container); - $('
').appendTo(dialogForm); + var row = $('
').appendTo(dialogForm); + $('
').appendTo(row); + $('
').appendTo(row); var nodeInfoEditor = RED.editor.createEditor({ id: "node-info-input-info-editor", mode: 'ace/mode/markdown', @@ -893,6 +895,23 @@ RED.editor = (function() { if (node.info) { nodeInfoEditor.getSession().setValue(node.info, -1); } + + $('#node-info-input-info-expand').click(function(e) { + e.preventDefault(); + var value = nodeInfoEditor.getValue(); + RED.editor.editMarkdown({ + value: value, + width: "Infinity", + cursor: nodeInfoEditor.getCursorPosition(), + complete: function(v,cursor) { + nodeInfoEditor.setValue(v, -1); + nodeInfoEditor.gotoLine(cursor.row+1,cursor.column,false); + setTimeout(function() { + nodeInfoEditor.focus(); + },300); + } + }) + }); return nodeInfoEditor; } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js index cce051275..92c3c933b 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js @@ -16,7 +16,34 @@ RED.editor.types._expression = (function() { - var template = ''; + var template = ''; var expressionTestCache = {}; return { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/markdown.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/markdown.js index 22d63b6be..161988150 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/markdown.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/markdown.js @@ -16,7 +16,18 @@ RED.editor.types._markdown = (function() { - var template = ''; + var template = ''; + + + var panels; return { init: function() { @@ -31,7 +42,7 @@ RED.editor.types._markdown = (function() { var trayOptions = { title: options.title, - width: "inherit", + width: options.width||Infinity, buttons: [ { id: "node-dialog-cancel", @@ -45,34 +56,55 @@ RED.editor.types._markdown = (function() { text: RED._("common.label.done"), class: "primary", click: function() { - onComplete(expressionEditor.getValue()); + onComplete(expressionEditor.getValue(),expressionEditor.getCursorPosition()); RED.tray.close(); } } ], resize: function(dimensions) { - var rows = $("#dialog-form>div:not(.node-text-editor-row)"); - var editorRow = $("#dialog-form>div.node-text-editor-row"); - var height = $("#dialog-form").height(); - for (var i=0;i div { // border: 1px solid red; box-sizing: border-box; @@ -38,3 +38,22 @@ overflow: auto; height: calc(50% - 4px); } + +.red-ui-panels.red-ui-panels-horizontal { + height: 100%; + .red-ui-panel { + display: inline-block; + height: 100%; + width: calc(50% - 4px); + } + .red-ui-panels-separator { + border-top: none; + border-bottom: none; + border-left: 1px solid $secondary-border-color; + border-right: 1px solid $secondary-border-color; + height: 100%; + width: 7px; + display: inline-block; + cursor: ew-resize; + } +}