File tree Expand file tree Collapse file tree 4 files changed +64
-0
lines changed
docs/src/pages/examples/ui-components/formatting-toolbar-buttons
libs/block-note-angular/src Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { ComponentFixture , TestBed } from '@angular/core/testing' ;
2
+ import { BlueButtonComponent } from './blue-button.component' ;
3
+
4
+ describe ( 'BlueButtonComponent' , ( ) => {
5
+ let component : BlueButtonComponent ;
6
+ let fixture : ComponentFixture < BlueButtonComponent > ;
7
+
8
+ beforeEach ( async ( ) => {
9
+ await TestBed . configureTestingModule ( {
10
+ imports : [ BlueButtonComponent ] ,
11
+ } ) . compileComponents ( ) ;
12
+
13
+ fixture = TestBed . createComponent ( BlueButtonComponent ) ;
14
+ component = fixture . componentInstance ;
15
+ fixture . detectChanges ( ) ;
16
+ } ) ;
17
+
18
+ it ( 'should create' , ( ) => {
19
+ expect ( component ) . toBeTruthy ( ) ;
20
+ } ) ;
21
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { CommonModule } from '@angular/common' ;
2
+ import { Component } from '@angular/core' ;
3
+ import { BlockNoteAngularService } from '@dytab/block-note-angular' ;
4
+ import { HlmButtonDirective } from '@spartan-ng/ui-button-helm' ;
5
+
6
+ @Component ( {
7
+ selector : 'bna-blue-button' ,
8
+ standalone : true ,
9
+ imports : [ CommonModule , HlmButtonDirective ] ,
10
+ template : ` <button
11
+ hlmBtn
12
+ size="icon"
13
+ variant="ghost"
14
+ (click)="changeToBlue()"
15
+ [ngClass]="{
16
+ 'bg-gray-900 text-gray-100': blockNoteAngularService.editor()
17
+ ? blockNoteAngularService.editor()!.getActiveStyles().textColor ===
18
+ 'blue' &&
19
+ blockNoteAngularService.editor()!.getActiveStyles()
20
+ .backgroundColor === 'blue'
21
+ : false
22
+ }"
23
+ >
24
+ Blue<button></button>
25
+ </button>` ,
26
+ styles : `` ,
27
+ } )
28
+ export class BlueButtonComponent {
29
+ constructor ( public blockNoteAngularService : BlockNoteAngularService ) { }
30
+
31
+ changeToBlue ( ) {
32
+ this . blockNoteAngularService . editor ( ) ?. toggleStyles ( {
33
+ textColor : 'blue' ,
34
+ backgroundColor : 'blue' ,
35
+ } ) ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change 7
7
BnaFormattingToolbarComponent ,
8
8
BnaFormattingToolbarControllerDirective ,
9
9
} from '@dytab/block-note-angular' ;
10
+ import { HlmButtonDirective } from '@spartan-ng/ui-button-helm' ;
11
+ import { BlueButtonComponent } from './blue-button.component' ;
10
12
11
13
@Component ( {
12
14
selector : 'bna-basic-setup-example' ,
@@ -17,10 +19,13 @@ import {
17
19
BnaFormattingToolbarControllerDirective ,
18
20
BasicTextStyleButtonComponent ,
19
21
BnaFormattingToolbarComponent ,
22
+ HlmButtonDirective ,
23
+ BlueButtonComponent ,
20
24
] ,
21
25
template : `<bna-editor [initialContent]="initialContent">
22
26
<bna-formatting-toolbar-controller>
23
27
<bna-formatting-toolbar>
28
+ <bna-blue-button />
24
29
<bna-basic-text-style-button [basicTextStyle]="'italic'" />
25
30
<bna-basic-text-style-button [basicTextStyle]="'bold'" />
26
31
</bna-formatting-toolbar>
Original file line number Diff line number Diff line change 1
1
export * from './lib/block-note-editor/bna-editor.component' ;
2
+ export * from './lib/services/block-note-angular.service' ;
2
3
export * from './lib/interfaces/block-note-editor-options.type' ;
3
4
export * from './lib/components/bna-formatting-toolbar/bna-formatting-toolbar-controller.directive' ;
4
5
export * from './lib/components/bna-formatting-toolbar/bna-formatting-toolbar.component' ;
You can’t perform that action at this time.
0 commit comments