@@ -141,7 +141,7 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
141141 doGetRecursiveData : function ( node ) {
142142 var children = [ ] ;
143143 node . eachChild ( function ( child ) {
144- var attributes = child . data . configAttributes ;
144+ var attributes = child . data . configAttributes ?? [ ] ;
145145 attributes . children = this . doGetRecursiveData ( child ) ;
146146 var childConfig = {
147147 "isOperator" : child . data . isOperator ? true : false ,
@@ -265,6 +265,22 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
265265 }
266266 } ,
267267
268+ addToDragData : function ( record , dragData , removeFromParent = false ) {
269+ if ( ! this . checkSupported ( record ) ) {
270+ return ;
271+ }
272+
273+ let copy = Ext . apply ( { } , record . data ) ;
274+ delete copy . id ;
275+ dragData . push (
276+ record . createNode ( copy )
277+ ) ;
278+
279+ if ( removeFromParent ) {
280+ record . parentNode . removeChild ( record ) ;
281+ }
282+ } ,
283+
268284 getSelectionPanel : function ( ) {
269285 if ( ! this . selectionPanel ) {
270286 this . selectedConfigItems = [ ] ;
@@ -340,15 +356,54 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
340356
341357 var dragData = [ ] ;
342358 records . forEach ( function ( record ) {
343- if ( ! this . selectionPanel . getRootNode ( ) . findChild ( "key" , record . data . key ) ) {
344- if ( ! this . checkSupported ( record ) ) {
359+ let realOverModel = overModel ;
360+
361+ if ( target !== source ) {
362+ if ( record . data . isOperator || this . parentIsOperator ( realOverModel ) ) {
363+ let attr = record . data ;
364+ if ( record . data . configAttributes ) {
365+ attr = record . data . configAttributes ;
366+ }
367+ let elementConfig = {
368+ "isOperator" : true ,
369+ "attributes" : attr
370+ }
371+
372+ let element = this . getConfigElement ( elementConfig ) ;
373+ let copy = element . getCopyNode ( record ) ;
374+ dragData . push ( copy ) ;
375+ this . openConfigDialog ( element , copy ) ;
376+
377+ return ;
378+ }
379+
380+ this . addToDragData ( record , dragData ) ;
381+ return ;
382+ }
383+
384+ if ( dropPosition === "before" || dropPosition === "after" ) {
385+ realOverModel = overModel . parentNode ;
386+ }
387+
388+ if ( record . data . isOperator || this . parentIsOperator ( realOverModel ) ) {
389+ let attr = record . data ;
390+ if ( record . data . isOperator && record . data . configAttributes ) {
345391 return ;
346392 }
347- var copy = Ext . apply ( { } , record . data ) ;
348- delete copy . id ;
349- copy = record . createNode ( copy ) ;
393+ let element = this . getConfigElement ( attr ) ;
394+
395+ let copy = element . getCopyNode ( record ) ;
350396 dragData . push ( copy ) ;
397+
398+ this . openConfigDialog ( element , copy ) ;
399+
400+ record . parentNode . removeChild ( record ) ;
401+
402+ return ;
351403 }
404+
405+ this . addToDragData ( record , dragData , true ) ;
406+
352407 } . bind ( this ) ) ;
353408
354409 if ( dragData . length === 0 ) {
0 commit comments