@@ -96,84 +96,6 @@ export abstract class EditComponentController {
9696 } ) ;
9797 }
9898
99- connectedComponentTypeChanged ( connectedComponent ) {
100- this . authoringViewComponentChanged ( ) ;
101- }
102-
103- connectedComponentNodeIdChanged ( connectedComponent ) {
104- connectedComponent . componentId = null ;
105- connectedComponent . type = null ;
106- this . automaticallySetConnectedComponentComponentIdIfPossible ( connectedComponent ) ;
107- this . authoringViewComponentChanged ( ) ;
108- }
109-
110- connectedComponentComponentIdChanged ( connectedComponent ) {
111- this . automaticallySetConnectedComponentTypeIfPossible ( connectedComponent ) ;
112- this . authoringViewComponentChanged ( ) ;
113- }
114-
115- isConnectedComponentTypeAllowed ( componentType : string ) {
116- return this . allowedConnectedComponentTypes . includes ( componentType ) ;
117- }
118-
119- addConnectedComponent ( ) {
120- this . addConnectedComponentAndSetComponentIdIfPossible ( ) ;
121- this . authoringViewComponentChanged ( ) ;
122- }
123-
124- addConnectedComponentAndSetComponentIdIfPossible ( ) {
125- const connectedComponent = this . createConnectedComponent ( ) ;
126- if ( this . authoringComponentContent . connectedComponents == null ) {
127- this . authoringComponentContent . connectedComponents = [ ] ;
128- }
129- this . authoringComponentContent . connectedComponents . push ( connectedComponent ) ;
130- this . automaticallySetConnectedComponentComponentIdIfPossible ( connectedComponent ) ;
131- }
132-
133- automaticallySetConnectedComponentComponentIdIfPossible ( connectedComponent ) {
134- let numberOfAllowedComponents = 0 ;
135- let allowedComponent = null ;
136- for ( const component of this . ProjectService . getComponentsByNodeId ( connectedComponent . nodeId ) ) {
137- if ( this . isConnectedComponentTypeAllowed ( component . type ) &&
138- component . id != this . componentId ) {
139- numberOfAllowedComponents += 1 ;
140- allowedComponent = component ;
141- }
142- }
143- if ( numberOfAllowedComponents === 1 ) {
144- connectedComponent . componentId = allowedComponent . id ;
145- connectedComponent . type = 'importWork' ;
146- }
147- this . automaticallySetConnectedComponentTypeIfPossible ( connectedComponent ) ;
148- }
149-
150- automaticallySetConnectedComponentTypeIfPossible ( connectedComponent ) {
151- if ( connectedComponent . componentId != null ) {
152- connectedComponent . type = 'importWork' ;
153- }
154- this . automaticallySetConnectedComponentFieldsIfPossible ( connectedComponent ) ;
155- }
156-
157- automaticallySetConnectedComponentFieldsIfPossible ( connectedComponent ) {
158- }
159-
160- createConnectedComponent ( ) {
161- return {
162- nodeId : this . nodeId ,
163- componentId : null ,
164- type : null
165- } ;
166- }
167-
168- deleteConnectedComponent ( index ) {
169- if ( confirm ( this . $translate ( 'areYouSureYouWantToDeleteThisConnectedComponent' ) ) ) {
170- if ( this . authoringComponentContent . connectedComponents != null ) {
171- this . authoringComponentContent . connectedComponents . splice ( index , 1 ) ;
172- }
173- this . authoringViewComponentChanged ( ) ;
174- }
175- }
176-
17799 getNodePositionAndTitleByNodeId ( nodeId ) {
178100 return this . ProjectService . getNodePositionAndTitleByNodeId ( nodeId ) ;
179101 }
@@ -186,15 +108,6 @@ export abstract class EditComponentController {
186108 return this . ProjectService . getComponentsByNodeId ( nodeId ) ;
187109 }
188110
189- getConnectedComponentType (
190- { nodeId, componentId} : { nodeId : string , componentId : string } ) {
191- const component = this . ProjectService . getComponentByNodeIdAndComponentId ( nodeId , componentId ) ;
192- if ( component != null ) {
193- return component . type ;
194- }
195- return null ;
196- }
197-
198111 isForThisComponent ( object ) {
199112 return this . nodeId == object . nodeId && this . componentId == object . componentId ;
200113 }
0 commit comments