Skip to content

Commit 476daca

Browse files
authored
feat(components/text-editor): add inline help example for text editor (#502)
* feat(components/text-editor): add inline help example for text editor * Use SkyTabIndex type
1 parent cce8c67 commit 476daca

File tree

7 files changed

+120
-2
lines changed

7 files changed

+120
-2
lines changed

apps/code-examples/src/app/app-routing.module.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ const routes: Routes = [
115115
(m) => m.DataManagerFeatureModule
116116
),
117117
},
118+
{
119+
path: 'text-editor',
120+
loadChildren: () =>
121+
import('./features/text-editor.module').then(
122+
(m) => m.TextEditorFeatureModule
123+
),
124+
},
118125
];
119126

120127
@NgModule({

apps/code-examples/src/app/app.component.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,22 @@
321321
</li>
322322
</ul>
323323
</li>
324+
325+
<li>
326+
Text Editor
327+
<ul>
328+
<li>
329+
<a routerLink="text-editor/rich-text-display">Rich text display</a>
330+
</li>
331+
<li><a routerLink="text-editor/text-editor">Text Editor</a></li>
332+
<li>
333+
<a routerLink="text-editor/text-editor-inline-help"
334+
>Text Editor with inline help</a
335+
>
336+
</li>
337+
</ul>
338+
</li>
339+
324340
<li>
325341
Tiles
326342
<ul>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<form novalidate [formGroup]="myForm">
2+
<sky-input-box>
3+
<label skyId #textEditorLabel="skyId" class="sky-control-label">
4+
Text editor demo
5+
</label>
6+
<sky-help-inline class="sky-control-help"></sky-help-inline>
7+
<sky-text-editor
8+
formControlName="myText"
9+
[attr.aria-labelledby]="textEditorLabel.id"
10+
class="sky-form-control"
11+
>
12+
</sky-text-editor>
13+
</sky-input-box>
14+
</form>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
3+
4+
@Component({
5+
selector: 'app-text-editor-demo',
6+
templateUrl: './text-editor-demo.component.html',
7+
})
8+
export class TextEditorDemoComponent implements OnInit {
9+
public myForm: FormGroup;
10+
11+
private richText = `<font style="font-size: 18px" face="Arial" color="#a25353"><b>Exclusively committed to your impact</b></font><p>Since day one, Blackbaud has been 100% focused on driving impact for social good organizations.</p><p>We equip change agents with <b>cloud software</b>, <i>services</i>, <u>expertise</u>, and <font color="#a25353">data intelligence</font> designed with unmatched insight and supported with unparalleled commitment. Every day, our <b>customers</b> achieve unmatched impact as they advance their missions.</p><ul><li><a href="#">Build a better world</a></li><li><a href="#">Explore our solutions</a></li></ul>`;
12+
13+
constructor(private formBuilder: FormBuilder) {}
14+
15+
public ngOnInit(): void {
16+
this.myForm = this.formBuilder.group({
17+
myText: new FormControl(this.richText),
18+
});
19+
}
20+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { CommonModule } from '@angular/common';
2+
import { NgModule } from '@angular/core';
3+
import { ReactiveFormsModule } from '@angular/forms';
4+
import { SkyIdModule } from '@skyux/core';
5+
import { SkyInputBoxModule } from '@skyux/forms';
6+
import { SkyHelpInlineModule } from '@skyux/indicators';
7+
import { SkyTextEditorModule } from '@skyux/text-editor';
8+
9+
import { TextEditorDemoComponent } from './text-editor-demo.component';
10+
11+
@NgModule({
12+
imports: [
13+
CommonModule,
14+
ReactiveFormsModule,
15+
SkyInputBoxModule,
16+
SkyIdModule,
17+
SkyTextEditorModule,
18+
SkyHelpInlineModule,
19+
],
20+
declarations: [TextEditorDemoComponent],
21+
exports: [TextEditorDemoComponent],
22+
})
23+
export class TextEditorDemoModule {}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
4+
import { RichTextDisplayDemoComponent as RichTextDisplayRichTextDisplayDemoComponent } from '../code-examples/text-editor/rich-text-display/rich-text-display-demo.component';
5+
import { RichTextDisplayDemoModule as RichTextDisplayRichTextDisplayDemoModule } from '../code-examples/text-editor/rich-text-display/rich-text-display-demo.module';
6+
import { TextEditorDemoComponent as TextEditorInlineHelpTextEditorDemoComponent } from '../code-examples/text-editor/text-editor-inline-help/text-editor-demo.component';
7+
import { TextEditorDemoModule as TextEditorInlineHelpTextEditorDemoModule } from '../code-examples/text-editor/text-editor-inline-help/text-editor-demo.module';
8+
import { TextEditorDemoComponent as TextEditorTextEditorDemoComponent } from '../code-examples/text-editor/text-editor/text-editor-demo.component';
9+
import { TextEditorDemoModule as TextEditorTextEditorDemoModule } from '../code-examples/text-editor/text-editor/text-editor-demo.module';
10+
11+
const routes: Routes = [
12+
{
13+
path: 'rich-text-display',
14+
component: RichTextDisplayRichTextDisplayDemoComponent,
15+
},
16+
{ path: 'text-editor', component: TextEditorTextEditorDemoComponent },
17+
{
18+
path: 'text-editor-inline-help',
19+
component: TextEditorInlineHelpTextEditorDemoComponent,
20+
},
21+
];
22+
23+
@NgModule({
24+
imports: [RouterModule.forChild(routes)],
25+
exports: [RouterModule],
26+
})
27+
export class TextEditorFeatureRoutingModule {}
28+
29+
@NgModule({
30+
imports: [
31+
RichTextDisplayRichTextDisplayDemoModule,
32+
TextEditorInlineHelpTextEditorDemoModule,
33+
TextEditorTextEditorDemoModule,
34+
TextEditorFeatureRoutingModule,
35+
],
36+
})
37+
export class TextEditorFeatureModule {}

libs/components/text-editor/src/lib/modules/text-editor/url-modal/text-editor-url-modal.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component } from '@angular/core';
22
import { SkyModalInstance } from '@skyux/modals';
3+
import { SkyTabIndex } from '@skyux/tabs';
34
import { SkyValidation } from '@skyux/validation';
45

56
import { SkyUrlModalContext } from './text-editor-url-modal-context';
@@ -89,8 +90,8 @@ export class SkyTextEditorUrlModalComponent {
8990
}
9091
}
9192

92-
public activeTabChanged(value: number): void {
93-
this.activeTab = value;
93+
public activeTabChanged(value: SkyTabIndex): void {
94+
this.activeTab = Number(value);
9495
}
9596

9697
public save(): void {

0 commit comments

Comments
 (0)