diff --git a/projects/demo/src/app/pages/starter/import/component.md b/projects/demo/src/app/pages/starter/import/component.md index a6a9c3867..c86496825 100644 --- a/projects/demo/src/app/pages/starter/import/component.md +++ b/projects/demo/src/app/pages/starter/import/component.md @@ -12,7 +12,11 @@ import {TUI_EDITOR_DEFAULT_TOOLS} from '@taiga-ui/editor'; providers: [ { provide: TUI_EDITOR_EXTENSIONS, - useValue: TUI_EDITOR_DEFAULT_EXTENSIONS, + deps: [Injector], + useFactory: (injector: Injector) => [ + ...TUI_EDITOR_DEFAULT_EXTENSIONS, + import('@taiga-ui/editor').then(({setup}) => setup({injector})), + ], }, ], // ... diff --git a/projects/demo/src/app/pages/starter/index.ts b/projects/demo/src/app/pages/starter/index.ts index 2935e425f..f99839f27 100644 --- a/projects/demo/src/app/pages/starter/index.ts +++ b/projects/demo/src/app/pages/starter/index.ts @@ -1,5 +1,5 @@ import {NgIf} from '@angular/common'; -import {ChangeDetectionStrategy, Component, inject} from '@angular/core'; +import {ChangeDetectionStrategy, Component, inject, Injector} from '@angular/core'; import {FormControl, ReactiveFormsModule} from '@angular/forms'; import {TuiAddonDoc} from '@taiga-ui/addon-doc'; import {TUI_IS_E2E, TuiAutoFocus} from '@taiga-ui/cdk'; @@ -32,7 +32,11 @@ import { providers: [ { provide: TUI_EDITOR_EXTENSIONS, - useValue: TUI_EDITOR_DEFAULT_EXTENSIONS, + deps: [Injector], + useFactory: (injector: Injector) => [ + ...TUI_EDITOR_DEFAULT_EXTENSIONS, + import('@taiga-ui/editor').then(({setup}) => setup({injector})), + ], }, ], }) diff --git a/projects/editor/src/components/editor-socket/editor-socket.component.ts b/projects/editor/src/components/editor-socket/editor-socket.component.ts index 419aeb86d..097945a02 100644 --- a/projects/editor/src/components/editor-socket/editor-socket.component.ts +++ b/projects/editor/src/components/editor-socket/editor-socket.component.ts @@ -8,9 +8,10 @@ import { signal, ViewEncapsulation, } from '@angular/core'; -import type {SafeHtml} from '@angular/platform-browser'; +import {EVENT_MANAGER_PLUGINS, type SafeHtml} from '@angular/platform-browser'; import {DomSanitizer} from '@angular/platform-browser'; import {tuiIsElement} from '@taiga-ui/cdk'; +import {PreventEventPlugin} from '@taiga-ui/event-plugins'; import {TuiTiptapEditor} from '../../directives/tiptap-editor/tiptap-editor.directive'; import {TUI_EDITOR_OPTIONS} from '../../tokens/editor-options'; @@ -37,6 +38,16 @@ export class TuiEditorSocket { protected readonly options = inject(TUI_EDITOR_OPTIONS); protected readonly html = signal(null); + constructor() { + ngDevMode && + console.assert( + !!inject(EVENT_MANAGER_PLUGINS).find( + (plugin) => plugin instanceof PreventEventPlugin, + ), + 'NG_EVENT_PLUGINS is missing from global providers', + ); + } + @Input() public set content(content: string | null) { if (!content) { diff --git a/projects/editor/src/components/editor/editor.component.less b/projects/editor/src/components/editor/editor.component.less index 96b50d4c8..1bb4742bf 100644 --- a/projects/editor/src/components/editor/editor.component.less +++ b/projects/editor/src/components/editor/editor.component.less @@ -51,7 +51,7 @@ } .t-editor-placeholder:not(:empty) { - margin: 1rem 1rem -1rem; + margin: 1rem 1rem -0.625rem; min-block-size: 1.625rem; } diff --git a/projects/editor/src/extensions/image-editor/image-editor.component.html b/projects/editor/src/extensions/image-editor/image-editor.component.html index 903328cde..be87d9de0 100644 --- a/projects/editor/src/extensions/image-editor/image-editor.component.html +++ b/projects/editor/src/extensions/image-editor/image-editor.component.html @@ -24,6 +24,8 @@ > ({ }, }); } + +export const setup = tuiCreateImageEditorExtension;