diff --git a/projects/demo/src/app/app.pages.ts b/projects/demo/src/app/app.pages.ts index 44503d929..4a3377258 100644 --- a/projects/demo/src/app/app.pages.ts +++ b/projects/demo/src/app/app.pages.ts @@ -150,9 +150,21 @@ export const DEMO_PAGES: TuiDocPages = [ 'editor, processing, content, cleanup html, wysiwyg, редактор, текст, html, rich, text', route: `/${TuiDemoPath.ProcessingCleanupHtml}`, }, + ], + }, + { + section: 'Documentation', + title: 'Markdown', + subPages: [ + { + section: 'Documentation', + title: 'Extension', + keywords: 'editor, markdown, wysiwyg, редактор, текст, html, rich, text', + route: `/${TuiDemoPath.ProcessingMarkdownExtension}`, + }, { section: 'Documentation', - title: 'Markdown', + title: 'Custom parsing', keywords: 'editor, markdown, wysiwyg, редактор, текст, html, rich, text', route: `/${TuiDemoPath.ProcessingMarkdown}`, }, diff --git a/projects/demo/src/app/app.routes.ts b/projects/demo/src/app/app.routes.ts index 727ef485b..be115a69a 100644 --- a/projects/demo/src/app/app.routes.ts +++ b/projects/demo/src/app/app.routes.ts @@ -104,6 +104,11 @@ export const routes: Routes = [ loadComponent: async () => import('./pages/processing/markdown'), title: 'Editor — Markdown', }), + route({ + path: TuiDemoPath.ProcessingMarkdownExtension, + loadComponent: async () => import('./pages/processing/markdown-extension'), + title: 'Editor — Markdown', + }), route({ path: TuiDemoPath.HighlightCode, loadComponent: async () => import('./pages/highlight/code'), diff --git a/projects/demo/src/app/constants/demo-path.ts b/projects/demo/src/app/constants/demo-path.ts index 26db977dd..7e8ad1f2f 100644 --- a/projects/demo/src/app/constants/demo-path.ts +++ b/projects/demo/src/app/constants/demo-path.ts @@ -23,6 +23,7 @@ export const TuiDemoPath = { ProcessingCleanupHtml: 'processing/cleanup-html', ProcessingLegacyHtml: 'processing/legacy-html', ProcessingMarkdown: 'processing/markdown', + ProcessingMarkdownExtension: 'processing/markdown-extension', Stackblitz: 'stackblitz', StarterKit: 'starter-kit', UploadFiles: 'upload-files', diff --git a/projects/demo/src/app/pages/processing/markdown-extension/examples/1/index.html b/projects/demo/src/app/pages/processing/markdown-extension/examples/1/index.html new file mode 100644 index 000000000..ec41d53eb --- /dev/null +++ b/projects/demo/src/app/pages/processing/markdown-extension/examples/1/index.html @@ -0,0 +1,15 @@ + + Placeholder + + + + Markdown + diff --git a/projects/demo/src/app/pages/processing/markdown-extension/examples/1/index.ts b/projects/demo/src/app/pages/processing/markdown-extension/examples/1/index.ts new file mode 100644 index 000000000..3ec1960e8 --- /dev/null +++ b/projects/demo/src/app/pages/processing/markdown-extension/examples/1/index.ts @@ -0,0 +1,86 @@ +import type {OnInit} from '@angular/core'; +import {ChangeDetectionStrategy, Component, inject, ViewChild} from '@angular/core'; +import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {TuiDestroyService} from '@taiga-ui/cdk'; +import {TuiTextareaModule} from '@taiga-ui/kit'; +import { + TUI_EDITOR_EXTENSIONS, + TuiEditorComponent, + TuiEditorTool, +} from '@tinkoff/tui-editor'; +import type {Editor} from '@tiptap/core'; +import {debounceTime, Subject, takeUntil} from 'rxjs'; + +const markdown = `# h1 Heading 😎 + +## h2 Heading + +### h3 Heading + +#### h4 Heading + +##### h5 Heading + +###### h6 Heading + +---- + +![image info](./assets/icons/logo.svg) +`; + +@Component({ + standalone: true, + imports: [TuiEditorComponent, ReactiveFormsModule, TuiTextareaModule, FormsModule], + templateUrl: './index.html', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: TUI_EDITOR_EXTENSIONS, + useValue: [ + import('@tiptap/starter-kit').then(({StarterKit}) => StarterKit), + import('@tiptap/extension-image').then(({Image}) => + Image.configure({inline: true}), + ), + import('@tinkoff/tui-editor').then(({TuiMarkdown}) => + TuiMarkdown.configure({ + html: true, // Allow HTML input/output + tightLists: true, // No

inside

  • in markdown output + tightListClass: 'tight', // Add class to