@@ -518,9 +518,8 @@ RED.editor = (function() {
518518 return title ;
519519 }
520520
521- function buildEditForm ( tray , formId , type , ns ) {
522- var trayBody = tray . find ( '.editor-tray-body' ) ;
523- var dialogForm = $ ( '<form id="' + formId + '" class="form-horizontal" autocomplete="off"></form>' ) . appendTo ( trayBody ) ;
521+ function buildEditForm ( container , formId , type , ns ) {
522+ var dialogForm = $ ( '<form id="' + formId + '" class="form-horizontal" autocomplete="off"></form>' ) . appendTo ( container ) ;
524523 dialogForm . html ( $ ( "script[data-template-name='" + type + "']" ) . html ( ) ) ;
525524 ns = ns || "node-red" ;
526525 dialogForm . find ( '[data-i18n]' ) . each ( function ( ) {
@@ -773,6 +772,7 @@ RED.editor = (function() {
773772 ] ,
774773 resize : function ( dimensions ) {
775774 editTrayWidthCache [ type ] = dimensions . width ;
775+ $ ( ".editor-tray-content" ) . height ( dimensions . height - 78 ) ;
776776 if ( editing_node && editing_node . _def . oneditresize ) {
777777 var form = $ ( "#dialog-form" ) ;
778778 try {
@@ -783,6 +783,64 @@ RED.editor = (function() {
783783 }
784784 } ,
785785 open : function ( tray ) {
786+ var trayFooter = tray . find ( ".editor-tray-footer" ) ;
787+ var trayBody = tray . find ( '.editor-tray-body' ) ;
788+ var editFormBody = tray . find ( '.editor-tray-body' ) ;
789+
790+ var buildThing = function ( el ) {
791+ var icon = el . find ( ".palette-header > i" ) ;
792+ var body = el . find ( ".editor-tray-content" ) ;
793+ var result = {
794+ el :el ,
795+ body :body ,
796+ expand : function ( ) {
797+ icon . addClass ( "expanded" ) ;
798+ body . slideDown ( ) ;
799+ } ,
800+ collapse : function ( ) {
801+ icon . removeClass ( "expanded" ) ;
802+ body . slideUp ( ) ;
803+ } ,
804+ toggle : function ( ) {
805+ if ( icon . hasClass ( "expanded" ) ) {
806+ result . collapse ( ) ;
807+ return false ;
808+ } else {
809+ result . expand ( ) ;
810+ return true ;
811+ }
812+ }
813+ }
814+ return result ;
815+ }
816+
817+ var nodePropertiesSection = buildThing ( $ ( '<div class="palette-category">' +
818+ '<div class="palette-header"><i class="fa fa-angle-down expanded"></i><span>node properties</span></div>' +
819+ '<div class="editor-tray-content"></div>' +
820+ '</div>' ) . appendTo ( trayBody ) ) ;
821+
822+ var portLabelsSection = buildThing ( $ ( '<div class="palette-category">' +
823+ '<div class="palette-header"><i class="fa fa-angle-down"></i><span>port labels</span></div>' +
824+ '<div class="editor-tray-content hide"></div>' +
825+ '</div>' ) . appendTo ( trayBody ) ) ;
826+
827+ portLabelsSection . el . find ( ".palette-header" ) . click ( function ( el ) {
828+ var res = portLabelsSection . toggle ( ) ;
829+ if ( res ) {
830+ nodePropertiesSection . collapse ( ) ;
831+ } else {
832+ nodePropertiesSection . expand ( ) ;
833+ }
834+ } ) ;
835+ nodePropertiesSection . el . find ( ".palette-header" ) . click ( function ( el ) {
836+ var res = nodePropertiesSection . toggle ( ) ;
837+ if ( res ) {
838+ portLabelsSection . collapse ( ) ;
839+ } else {
840+ portLabelsSection . expand ( ) ;
841+ }
842+ } ) ;
843+
786844 if ( editing_node ) {
787845 RED . sidebar . info . refresh ( editing_node ) ;
788846 }
@@ -792,7 +850,7 @@ RED.editor = (function() {
792850 } else {
793851 ns = node . _def . set . id ;
794852 }
795- var dialogForm = buildEditForm ( tray , "dialog-form" , type , ns ) ;
853+ var dialogForm = buildEditForm ( nodePropertiesSection . body , "dialog-form" , type , ns ) ;
796854 prepareEditDialog ( node , node . _def , "node-input" ) ;
797855 dialogForm . i18n ( ) ;
798856 } ,
@@ -892,7 +950,7 @@ RED.editor = (function() {
892950 }
893951 trayFooter . append ( '<span id="node-config-dialog-scope-container"><span id="node-config-dialog-scope-warning" data-i18n="[title]editor.errors.scopeChange"><i class="fa fa-warning"></i></span><select id="node-config-dialog-scope"></select></span>' ) ;
894952
895- var dialogForm = buildEditForm ( tray , "node-config-dialog-edit-form" , type , ns ) ;
953+ var dialogForm = buildEditForm ( tray . find ( '.editor-tray-body' ) , "node-config-dialog-edit-form" , type , ns ) ;
896954
897955 prepareEditDialog ( editing_config_node , node_def , "node-config-input" ) ;
898956 if ( editing_config_node . _def . exclusive ) {
@@ -1317,7 +1375,7 @@ RED.editor = (function() {
13171375 if ( editing_node ) {
13181376 RED . sidebar . info . refresh ( editing_node ) ;
13191377 }
1320- var dialogForm = buildEditForm ( tray , "dialog-form" , "subflow-template" ) ;
1378+ var dialogForm = buildEditForm ( tray . find ( '.editor-tray-body' ) , "dialog-form" , "subflow-template" ) ;
13211379 subflowEditor = RED . editor . createEditor ( {
13221380 id : 'subflow-input-info-editor' ,
13231381 mode : 'ace/mode/markdown' ,
@@ -1398,7 +1456,7 @@ RED.editor = (function() {
13981456 } ,
13991457 open : function ( tray ) {
14001458 var trayBody = tray . find ( '.editor-tray-body' ) ;
1401- var dialogForm = buildEditForm ( tray , 'dialog-form' , '_expression' , 'editor' ) ;
1459+ var dialogForm = buildEditForm ( tray . find ( '.editor-tray-body' ) , 'dialog-form' , '_expression' , 'editor' ) ;
14021460 var funcSelect = $ ( "#node-input-expression-func" ) ;
14031461 Object . keys ( jsonata . functions ) . forEach ( function ( f ) {
14041462 funcSelect . append ( $ ( "<option></option>" ) . val ( f ) . text ( f ) ) ;
0 commit comments