File tree Expand file tree Collapse file tree
src/assets/wise5/authoringTool/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,17 +60,25 @@ export class ComponentAuthoringComponent {
6060 private projectTranslationService : TeacherProjectTranslationService
6161 ) {
6262 effect ( ( ) => {
63- // apply translations to a copy of the component content so the original component content
64- // is not modified for subsequent use.
65- const componentContent = copy ( this . componentContent ) ;
66- this . projectTranslationService . applyTranslations (
67- componentContent ,
68- this . projectTranslationService . currentTranslations ( )
69- ) ;
70- this . component = new ComponentFactory ( ) . getComponent (
71- this . projectService . injectAssetPaths ( componentContent ) ,
72- this . nodeId
73- ) ;
63+ this . setComponent ( ) ;
7464 } ) ;
7565 }
66+
67+ ngOnChanges ( ) : void {
68+ this . setComponent ( ) ;
69+ }
70+
71+ private setComponent ( ) : void {
72+ // when current translations change, apply translations to a copy of the component content
73+ // so the original component content is not modified for subsequent use.
74+ const componentContent = copy ( this . componentContent ) ;
75+ this . projectTranslationService . applyTranslations (
76+ componentContent ,
77+ this . projectTranslationService . currentTranslations ( )
78+ ) ;
79+ this . component = new ComponentFactory ( ) . getComponent (
80+ this . projectService . injectAssetPaths ( componentContent ) ,
81+ this . nodeId
82+ ) ;
83+ }
7684}
You can’t perform that action at this time.
0 commit comments