Skip to content

Commit 58037de

Browse files
Merge pull request #2865 from WISE-Community/issue-2860-upgrade-html-authoring-to-angular
Upgrade HTMLAuthoring to Angular component
2 parents 98aedcb + 6c00dd8 commit 58037de

6 files changed

Lines changed: 52 additions & 71 deletions

File tree

src/main/webapp/site/src/app/teacher-hybrid-angular.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { NavItemProgressComponent } from './classroom-monitor/nav-item-progress/
4242
import { EditHTMLAdvancedComponent } from '../../../wise5/components/html/edit-html-advanced/edit-html-advanced.component';
4343
import { EditOutsideUrlAdvancedComponent } from '../../../wise5/components/outsideURL/edit-outside-url-advanced/edit-outside-url-advanced.component';
4444
import { OpenResponseAuthoring } from '../../../wise5/components/openResponse/open-response-authoring/open-response-authoring.component';
45+
import { HtmlAuthoring } from '../../../wise5/components/html/html-authoring/html-authoring.component';
4546

4647
@NgModule({
4748
declarations: [
@@ -59,6 +60,7 @@ import { OpenResponseAuthoring } from '../../../wise5/components/openResponse/op
5960
EditComponentWidthComponent,
6061
EditHTMLAdvancedComponent,
6162
EditOutsideUrlAdvancedComponent,
63+
HtmlAuthoring,
6264
ManageStudentsComponent,
6365
MilestonesComponent,
6466
MilestoneReportDataComponent,

src/main/webapp/wise5/components/html/authoring.html

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<wise-authoring-tinymce-editor
2+
[(model)]='html'
3+
(modelChange)='htmlChanged()'>
4+
</wise-authoring-tinymce-editor>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Component } from '@angular/core';
2+
import { ComponentAuthoring } from '../../../authoringTool/components/component-authoring.component';
3+
import { ConfigService } from '../../../services/configService';
4+
import { NodeService } from '../../../services/nodeService';
5+
import { TeacherProjectService } from '../../../services/teacherProjectService';
6+
import { UtilService } from '../../../services/utilService';
7+
8+
@Component({
9+
selector: 'html-authoring',
10+
templateUrl: 'html-authoring.component.html'
11+
})
12+
export class HtmlAuthoring extends ComponentAuthoring {
13+
html: string = '';
14+
15+
constructor(
16+
protected ConfigService: ConfigService,
17+
protected NodeService: NodeService,
18+
protected ProjectService: TeacherProjectService,
19+
protected UtilService: UtilService
20+
) {
21+
super(ConfigService, NodeService, ProjectService);
22+
}
23+
24+
ngOnInit() {
25+
super.ngOnInit();
26+
this.html = this.UtilService.replaceWISELinks(this.componentContent.html);
27+
}
28+
29+
htmlChanged(): void {
30+
this.authoringComponentContent.html = this.UtilService.insertWISELinks(
31+
this.ConfigService.removeAbsoluteAssetPaths(this.html)
32+
);
33+
this.componentChanged();
34+
}
35+
}

src/main/webapp/wise5/components/html/htmlAuthoring.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/main/webapp/wise5/components/html/htmlAuthoringComponentModule.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
import * as angular from 'angular';
44
import { downgradeComponent, downgradeInjectable } from '@angular/upgrade/static';
55
import { HTMLService } from './htmlService';
6-
import HTMLAuthoring from './htmlAuthoring';
76
import { EditHTMLAdvancedComponent } from './edit-html-advanced/edit-html-advanced.component';
7+
import { HtmlAuthoring } from './html-authoring/html-authoring.component';
88

9-
const htmlComponentModule = angular.module('htmlAuthoringComponentModule', [])
9+
const htmlComponentModule = angular
10+
.module('htmlAuthoringComponentModule', [])
1011
.service('HTMLService', downgradeInjectable(HTMLService))
11-
.component('htmlAuthoring', HTMLAuthoring)
12-
.directive('editHtmlAdvanced', downgradeComponent(
13-
{ component: EditHTMLAdvancedComponent }) as angular.IDirectiveFactory)
12+
.directive(
13+
'htmlAuthoring',
14+
downgradeComponent({ component: HtmlAuthoring }) as angular.IDirectiveFactory
15+
)
16+
.directive(
17+
'editHtmlAdvanced',
18+
downgradeComponent({ component: EditHTMLAdvancedComponent }) as angular.IDirectiveFactory
19+
)
1420
.config([
1521
'$translatePartialLoaderProvider',
1622
$translatePartialLoaderProvider => {

0 commit comments

Comments
 (0)