-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
165 additions
and
19 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
apps/docs/src/pages/examples/custom/custom-editor/custom-editor.example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { Component } from '@angular/core'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { | ||
Block, | ||
BlockNoteEditor, | ||
BlockNoteSchema, | ||
defaultBlockSpecs, | ||
defaultInlineContentSpecs, | ||
defaultStyleSpecs, | ||
PartialBlock, | ||
} from '@blocknote/core'; | ||
import { | ||
BlockNoteAngularService, | ||
BlockNoteEditorOptionsType, | ||
BnaAddBlockButtonComponent, | ||
BnaDeleteBlockItemComponent, | ||
BnaDragHandleMenuComponent, | ||
BnaEditorComponent, | ||
BnaSideMenuComponent, | ||
BnaSideMenuControllerDirective, | ||
} from '@dytab/ngx-blocknote'; | ||
import { | ||
BrnDialogContentDirective, | ||
BrnDialogDescriptionDirective, | ||
BrnDialogTitleDirective, | ||
BrnDialogTriggerDirective, | ||
} from '@spartan-ng/ui-dialog-brain'; | ||
import { ResetBlockButtonComponent } from '../../ui-components/adding-side-menu-drag-handle-items/reset-block-button.component'; | ||
import { | ||
HlmButtonDirective, | ||
HlmCheckboxComponent, | ||
HlmDialogComponent, | ||
HlmDialogContentComponent, | ||
HlmDialogFooterComponent, | ||
HlmDialogHeaderComponent, | ||
HlmInputDirective, | ||
} from '@dytab/ui'; | ||
import { alertBlock } from '../alert-block/alert-block'; | ||
|
||
const schema = BlockNoteSchema.create({ | ||
blockSpecs: { | ||
...defaultBlockSpecs, | ||
alert: alertBlock, | ||
}, | ||
inlineContentSpecs: { ...defaultInlineContentSpecs }, | ||
styleSpecs: { ...defaultStyleSpecs }, | ||
}); | ||
|
||
@Component({ | ||
selector: 'bna-custom-editor-example', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
BnaEditorComponent, | ||
HlmButtonDirective, | ||
BnaAddBlockButtonComponent, | ||
BnaDeleteBlockItemComponent, | ||
BnaDragHandleMenuComponent, | ||
BnaSideMenuComponent, | ||
BnaSideMenuControllerDirective, | ||
ResetBlockButtonComponent, | ||
HlmDialogComponent, | ||
HlmDialogContentComponent, | ||
BrnDialogContentDirective, | ||
HlmDialogHeaderComponent, | ||
BrnDialogTitleDirective, | ||
BrnDialogDescriptionDirective, | ||
BrnDialogTriggerDirective, | ||
HlmDialogFooterComponent, | ||
HlmCheckboxComponent, | ||
ReactiveFormsModule, | ||
HlmInputDirective, | ||
], | ||
providers: [BlockNoteAngularService], | ||
template: ` | ||
<bna-editor | ||
[initialContent]="initialContent" | ||
[editor]="editor" | ||
/> | ||
`, | ||
}) | ||
export class CustomEditorExample { | ||
editor = BlockNoteEditor.create({ schema }); | ||
|
||
initialContent: PartialBlock<typeof schema.blockSchema>[] = [ | ||
{ | ||
type: 'paragraph', | ||
content: 'test', | ||
}, | ||
{ | ||
type: 'alert', | ||
props: { | ||
type: 'warning', | ||
}, | ||
content: 'Hallo Welt.', | ||
}, | ||
]; | ||
} | ||
|
||
export const apiContentBlockExampleCode = ``; |
43 changes: 43 additions & 0 deletions
43
apps/docs/src/pages/examples/custom/custom-editor/custom-editor.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { Component } from '@angular/core'; | ||
import { BnaEditorComponent } from '@dytab/ngx-blocknote'; | ||
import { CodeComponent } from '../../../../shared/code/code.component'; | ||
import { DemoBoxComponent } from '../../../../shared/layout/demo-box.component'; | ||
import { TabsComponent } from '../../../../shared/layout/example-tabs.component'; | ||
import { SectionIntroComponent } from '../../../../shared/layout/section-intro.component'; | ||
import { | ||
CustomEditorExample, | ||
apiContentBlockExampleCode, | ||
} from './custom-editor.example'; | ||
import { HlmButtonDirective, hlmP, HlmTabsComponent } from '@dytab/ui'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
BnaEditorComponent, | ||
HlmButtonDirective, | ||
SectionIntroComponent, | ||
CodeComponent, | ||
DemoBoxComponent, | ||
HlmTabsComponent, | ||
TabsComponent, | ||
CustomEditorExample, | ||
], | ||
template: `<bna-section-intro name="Custom Editor"> | ||
<p class="${hlmP} mb-8"> | ||
In this example, we want to give a custom editor as input | ||
</p> | ||
</bna-section-intro> | ||
<hlm-tabs tab="preview"> | ||
<bna-example-tabs firstTab="Preview" secondTab="Code"> | ||
<bna-demo-box firstTab> | ||
<bna-custom-editor-example /> | ||
</bna-demo-box> | ||
<bna-code [code]="exampleCode" secondTab /> | ||
</bna-example-tabs> | ||
</hlm-tabs>`, | ||
}) | ||
export class CustomEditorPage { | ||
exampleCode = apiContentBlockExampleCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters