@@ -9,7 +9,6 @@ import uml from "../../joint/table";
99joint . shapes . erd = erd ;
1010joint . shapes . uml = uml ;
1111import "jointjs/dist/joint.min.css" ;
12-
1312import "../editor/editorManager"
1413import "../editor/editorScroller"
1514import "../editor/editorActions"
@@ -185,7 +184,7 @@ const logicService = ($rootScope, ModelAPI, LogicFactory, LogicConversorService)
185184 ls . editorScroller . startPanning ( evt ) ;
186185 }
187186
188- ls . editorActions . setCopyContext ( evt ) ;
187+ ls . elementSelector . setCopyContext ( evt ) ;
189188 } ) ;
190189
191190 ls . getConnectionType = link => {
@@ -352,6 +351,7 @@ const logicService = ($rootScope, ModelAPI, LogicFactory, LogicConversorService)
352351 var name = "" ;
353352 if ( ls . selectedElement . model != null ) ls . selectedElement . unhighlight ( ) ;
354353 if ( cellView . model . attributes . name != null ) {
354+ ls . elementSelector . cancel ( ) ;
355355 ls . selectedElement = cellView ;
356356 name = ls . selectedElement . model . attributes . name ;
357357 ls . selectedElement . highlight ( ) ;
@@ -473,6 +473,18 @@ const logicService = ($rootScope, ModelAPI, LogicFactory, LogicConversorService)
473473 ls . editorScroller . zoom ( ) ;
474474 }
475475
476+ ls . copySelectedElements = function ( ) {
477+ const elements = ls . elementSelector . getSelectedElements ( ) ;
478+ const hasConnections = elements . some ( element => {
479+ return element . attributes . objects . some ( attr => attr . FK ) ;
480+ } ) ;
481+ if ( hasConnections ) {
482+ $rootScope . $broadcast ( 'model:warning-copy' ) ;
483+ } else {
484+ ls . elementSelector . copyAll ( ) ;
485+ }
486+ }
487+
476488 ls . registerShortcuts = ( ) => {
477489 ls . keyboardController . registerHandler ( types . UNDO , ( ) => ls . undo ( ) ) ;
478490 ls . keyboardController . registerHandler ( types . REDO , ( ) => ls . redo ( ) ) ;
@@ -482,11 +494,11 @@ const logicService = ($rootScope, ModelAPI, LogicFactory, LogicConversorService)
482494 ls . keyboardController . registerHandler ( types . ESC , ( ) => ls . clearSelectedElement ( ) ) ;
483495 ls . keyboardController . registerHandler ( types . SAVE , ( ) => {
484496 ls . updateModel ( ) ;
485- $rootScope . $broadcast ( 'model:saved' )
497+ $rootScope . $broadcast ( 'model:saved' ) ;
486498 } ) ;
487- ls . keyboardController . registerHandler ( types . COPY , ( ) => ls . editorActions . copyElement ( ls . selectedElement ) ) ;
488- ls . keyboardController . registerHandler ( types . PASTE , ( ) => ls . editorActions . pasteElement ( ) ) ;
489- ls . keyboardController . registerHandler ( types . DELETE , ( ) => ls . selectedActions ?. removeElement ( ) ) ;
499+ ls . keyboardController . registerHandler ( types . COPY , ( ) => ls . copySelectedElements ( ) ) ;
500+ ls . keyboardController . registerHandler ( types . PASTE , ( ) => ls . elementSelector . pasteAll ( ) ) ;
501+ ls . keyboardController . registerHandler ( types . DELETE , ( ) => ls . elementSelector . deleteAll ( ) ) ;
490502 }
491503
492504 ls . getTablesMap = function ( ) {
0 commit comments