@notectl/angular 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, makeEnvironmentProviders, inject, DestroyRef, input, model, output, signal, computed, viewChild, afterNextRender, effect, ChangeDetectionStrategy, Component, forwardRef, Directive, Injectable } from '@angular/core';
|
|
3
3
|
import { ThemePreset, NotectlEditor } from '@notectl/core';
|
|
4
|
-
export { AlignmentPlugin, BlockquotePlugin, CodeBlockPlugin, DARK_THEME, FontPlugin, FontSizePlugin, HardBreakPlugin, HeadingPlugin, HighlightPlugin, HorizontalRulePlugin, ImagePlugin, LIGHT_THEME, LinkPlugin, ListPlugin,
|
|
4
|
+
export { AlignmentPlugin, BlockquotePlugin, CodeBlockPlugin, DARK_THEME, FontPlugin, FontSizePlugin, HardBreakPlugin, HeadingPlugin, HighlightPlugin, HorizontalRulePlugin, ImagePlugin, LIGHT_THEME, LinkPlugin, ListPlugin, StrikethroughPlugin, SuperSubPlugin, TablePlugin, TextColorPlugin, TextFormattingPlugin, ThemePreset, ToolbarPlugin, createTheme } from '@notectl/core';
|
|
5
5
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
6
|
import { Subject } from 'rxjs';
|
|
7
|
+
export { STARTER_FONTS } from '@notectl/core/fonts';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Default configuration applied to all `<notectl-editor>` instances within
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notectl-angular.mjs","sources":["../../src/lib/tokens.ts","../../src/lib/notectl-editor.component.ts","../../src/lib/value-accessor.directive.ts","../../src/lib/notectl-editor.service.ts","../../src/public-api.ts","../../src/notectl-angular.ts"],"sourcesContent":["import { type EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport type { NotectlEditorConfig } from '@notectl/core';\n\n/**\n * Default configuration applied to all `<notectl-editor>` instances within\n * the injector scope. Component-level inputs override these defaults.\n */\nexport const NOTECTL_DEFAULT_CONFIG: InjectionToken<Partial<NotectlEditorConfig>> =\n\tnew InjectionToken<Partial<NotectlEditorConfig>>('notectl-default-config');\n\n/**\n * Content format used by the `ControlValueAccessor` for forms integration.\n * Determines how editor content is serialized when reading/writing form values.\n *\n * - `'json'` — `Document` objects (default)\n * - `'html'` — sanitized HTML strings\n * - `'text'` — plain text strings\n */\nexport const NOTECTL_CONTENT_FORMAT: InjectionToken<ContentFormat> =\n\tnew InjectionToken<ContentFormat>('notectl-content-format');\n\n/** Supported content serialization formats for forms integration. */\nexport type ContentFormat = 'json' | 'html' | 'text';\n\n/** Options for `provideNotectl()`. */\nexport interface NotectlProviderOptions {\n\t/** Default editor configuration applied to all instances. */\n\treadonly config?: Partial<NotectlEditorConfig>;\n\t/** Content serialization format for forms integration. Defaults to `'json'`. */\n\treadonly contentFormat?: ContentFormat;\n}\n\n/**\n * Configures the notectl editor at the environment injector level.\n *\n * @example\n * ```typescript\n * bootstrapApplication(App, {\n * providers: [\n * provideNotectl({\n * config: { theme: ThemePreset.Light, placeholder: 'Start typing...' },\n * contentFormat: 'json',\n * }),\n * ],\n * });\n * ```\n */\nexport function provideNotectl(options: NotectlProviderOptions = {}): EnvironmentProviders {\n\tconst providers = [];\n\n\tif (options.config) {\n\t\tproviders.push({ provide: NOTECTL_DEFAULT_CONFIG, useValue: options.config });\n\t}\n\n\tif (options.contentFormat) {\n\t\tproviders.push({ provide: NOTECTL_CONTENT_FORMAT, useValue: options.contentFormat });\n\t}\n\n\treturn makeEnvironmentProviders(providers);\n}\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tDestroyRef,\n\ttype ElementRef,\n\ttype ModelSignal,\n\tafterNextRender,\n\tcomputed,\n\teffect,\n\tinject,\n\tinput,\n\tmodel,\n\toutput,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport type {\n\tDocument,\n\tEditorSelection,\n\tEditorState,\n\tNotectlEditorConfig,\n\tPlugin,\n\tPluginConfig,\n\tStateChangeEvent,\n\tTextFormattingConfig,\n\tTheme,\n\tTransaction,\n} from '@notectl/core';\nimport { NotectlEditor, ThemePreset } from '@notectl/core';\n\nimport { NOTECTL_DEFAULT_CONFIG } from './tokens';\nimport type { SelectionChangeEvent } from './types';\n\n/**\n * Angular standalone component wrapping the `<ntl-editor>` Web Component.\n *\n * Uses `afterNextRender()` for SSR-safe initialization and `effect()` for\n * reactive input tracking — no lifecycle interfaces needed.\n *\n * @example\n * ```html\n * <!-- Basic usage -->\n * <ntl-editor [toolbar]=\"toolbar\" [plugins]=\"plugins\" />\n *\n * <!-- Two-way content binding -->\n * <ntl-editor [(content)]=\"myDocument\" [toolbar]=\"toolbar\" />\n *\n * <!-- Reactive forms -->\n * <ntl-editor [formControl]=\"editorControl\" [toolbar]=\"toolbar\" />\n * ```\n */\n@Component({\n\tselector: 'ntl-editor',\n\ttemplate: '<div #host></div>',\n\tstyles: ':host { display: block; }',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NotectlEditorComponent {\n\t// --- Injected dependencies ---\n\n\tprivate readonly destroyRef: DestroyRef = inject(DestroyRef);\n\tprivate readonly defaultConfig: Partial<NotectlEditorConfig> | null = inject(\n\t\tNOTECTL_DEFAULT_CONFIG,\n\t\t{ optional: true },\n\t);\n\n\t// --- Signal Inputs (1:1 with Web Component config) ---\n\n\treadonly plugins = input<Plugin[]>([]);\n\treadonly toolbar = input<ReadonlyArray<ReadonlyArray<Plugin>>>();\n\treadonly features = input<Partial<TextFormattingConfig>>();\n\treadonly placeholder = input<string>('Start typing...');\n\treadonly readonlyMode = input<boolean>(false);\n\treadonly autofocus = input<boolean>(false);\n\treadonly maxHistoryDepth = input<number>();\n\treadonly theme = input<ThemePreset | Theme>(ThemePreset.Light);\n\n\t// --- Two-way content binding via model() ---\n\n\t/**\n\t * Two-way bindable document content.\n\t *\n\t * `undefined` means no external content was provided — the editor manages\n\t * its own state. Once the editor emits changes, the model updates to the\n\t * current `Document`.\n\t *\n\t * @example\n\t * ```html\n\t * <ntl-editor [(content)]=\"myDocument\" />\n\t * ```\n\t */\n\treadonly content: ModelSignal<Document | undefined> = model<Document>();\n\n\t// --- Signal Outputs (events bridged from Web Component) ---\n\n\treadonly stateChange = output<StateChangeEvent>();\n\treadonly selectionChange = output<SelectionChangeEvent>();\n\treadonly editorFocus = output<void>();\n\treadonly editorBlur = output<void>();\n\treadonly ready = output<void>();\n\n\t// --- Reactive State ---\n\n\treadonly editorState = signal<EditorState | null>(null);\n\n\treadonly isEmpty = computed<boolean>(() => {\n\t\tconst state: EditorState | null = this.editorState();\n\t\tif (!state) return true;\n\t\tconst doc: Document = state.doc;\n\t\tif (doc.children.length === 0) return true;\n\t\tif (doc.children.length > 1) return false;\n\t\tconst block = doc.children[0];\n\t\tif (!block) return true;\n\t\treturn block.type === 'paragraph' && block.children.length === 0;\n\t});\n\n\t// --- Internal state ---\n\n\tprivate readonly hostRef = viewChild.required<ElementRef<HTMLDivElement>>('host');\n\tprivate editorRef: NotectlEditor | null = null;\n\tprivate readyResolve: (() => void) | null = null;\n\tprivate readonly readyPromise: Promise<void> = new Promise<void>((resolve) => {\n\t\tthis.readyResolve = resolve;\n\t});\n\tprivate readonly initialized = signal(false);\n\n\t/** Tracks the last document set from within the editor to prevent feedback loops. */\n\tprivate lastEditorDoc: Document | null = null;\n\n\tconstructor() {\n\t\t// SSR-safe: only runs in the browser after first render\n\t\tafterNextRender(() => {\n\t\t\tthis.initEditor();\n\t\t});\n\n\t\t// React to input changes via effect() — replaces ngOnChanges\n\t\teffect(() => {\n\t\t\tconst currentTheme: ThemePreset | Theme = this.theme();\n\t\t\tconst currentPlaceholder: string = this.placeholder();\n\t\t\tconst currentReadonly: boolean = this.readonlyMode();\n\n\t\t\tconst editor: NotectlEditor | null = this.editorRef;\n\t\t\tif (!this.initialized() || !editor) return;\n\n\t\t\teditor.setTheme(currentTheme);\n\t\t\teditor.configure({\n\t\t\t\tplaceholder: currentPlaceholder,\n\t\t\t\treadonly: currentReadonly,\n\t\t\t});\n\t\t});\n\n\t\t// Sync external content model changes into the editor.\n\t\t// Skips when the document was set by the editor itself (feedback loop prevention).\n\t\teffect(() => {\n\t\t\tconst doc: Document | undefined = this.content();\n\t\t\tconst editor: NotectlEditor | null = this.editorRef;\n\t\t\tif (!this.initialized() || !editor || !doc) return;\n\n\t\t\t// Skip if this document originated from the editor's own state change\n\t\t\tif (doc === this.lastEditorDoc) return;\n\n\t\t\teditor.setJSON(doc);\n\t\t});\n\n\t\tthis.destroyRef.onDestroy(() => {\n\t\t\tthis.destroyEditor();\n\t\t});\n\t}\n\n\t// --- Public API (proxy to Web Component) ---\n\n\t/** Returns the document as JSON. */\n\tgetJSON(): Document {\n\t\treturn this.requireEditor().getJSON();\n\t}\n\n\t/** Sets the document from JSON. */\n\tsetJSON(doc: Document): void {\n\t\tthis.requireEditor().setJSON(doc);\n\t}\n\n\t/** Returns sanitized HTML representation of the document. */\n\tgetHTML(): string {\n\t\treturn this.requireEditor().getHTML();\n\t}\n\n\t/** Sets content from HTML (sanitized). */\n\tsetHTML(html: string): void {\n\t\tthis.requireEditor().setHTML(html);\n\t}\n\n\t/** Returns plain text content. */\n\tgetText(): string {\n\t\treturn this.requireEditor().getText();\n\t}\n\n\t/** Proxy to the Web Component's `commands` object. */\n\tget commands(): NotectlEditor['commands'] {\n\t\treturn this.requireEditor().commands;\n\t}\n\n\t/** Proxy to the Web Component's `can()` capability checker. */\n\tcan(): ReturnType<NotectlEditor['can']> {\n\t\treturn this.requireEditor().can();\n\t}\n\n\t/** Executes a named command registered by a plugin. */\n\texecuteCommand(name: string): boolean {\n\t\tif (!this.editorRef) return false;\n\t\treturn this.editorRef.executeCommand(name);\n\t}\n\n\t/** Configures a plugin at runtime. */\n\tconfigurePlugin(pluginId: string, config: PluginConfig): void {\n\t\tthis.editorRef?.configurePlugin(pluginId, config);\n\t}\n\n\t/** Dispatches a transaction. */\n\tdispatch(tr: Transaction): void {\n\t\tthis.editorRef?.dispatch(tr);\n\t}\n\n\t/** Returns the current editor state. */\n\tgetState(): EditorState {\n\t\treturn this.requireEditor().getState();\n\t}\n\n\t/** Changes the theme at runtime. */\n\tsetTheme(theme: ThemePreset | Theme): void {\n\t\tthis.editorRef?.setTheme(theme);\n\t}\n\n\t/** Returns the current theme setting. */\n\tgetTheme(): ThemePreset | Theme {\n\t\treturn this.editorRef?.getTheme() ?? this.theme();\n\t}\n\n\t/** Sets the readonly state programmatically (used by ControlValueAccessor). */\n\tsetReadonly(readonlyState: boolean): void {\n\t\tthis.editorRef?.configure({ readonly: readonlyState });\n\t}\n\n\t/** Resolves when the editor is ready. */\n\twhenReady(): Promise<void> {\n\t\treturn this.readyPromise;\n\t}\n\n\t// --- Private ---\n\n\tprivate initEditor(): void {\n\t\tconst hostElement: HTMLDivElement = this.hostRef().nativeElement;\n\t\tconst config: NotectlEditorConfig = this.buildConfig();\n\n\t\tconst editor: NotectlEditor = new NotectlEditor();\n\t\tthis.editorRef = editor;\n\n\t\t// Register event listeners BEFORE appending to DOM, because\n\t\t// appendChild triggers connectedCallback → init() synchronously.\n\t\teditor.on('stateChange', (event: StateChangeEvent) => {\n\t\t\tthis.editorState.set(event.newState);\n\t\t\tthis.syncContentModel(event.newState.doc);\n\t\t\tthis.stateChange.emit(event);\n\t\t});\n\n\t\teditor.on('selectionChange', (event: { selection: EditorSelection }) => {\n\t\t\tthis.selectionChange.emit(event);\n\t\t});\n\n\t\teditor.on('focus', () => {\n\t\t\tthis.editorFocus.emit();\n\t\t});\n\n\t\teditor.on('blur', () => {\n\t\t\tthis.editorBlur.emit();\n\t\t});\n\n\t\teditor.on('ready', () => {\n\t\t\tthis.initialized.set(true);\n\t\t\tconst state: EditorState = editor.getState();\n\t\t\tthis.editorState.set(state);\n\n\t\t\t// Apply initial content model if set before editor was ready\n\t\t\tconst initialContent: Document | undefined = this.content();\n\t\t\tif (initialContent) {\n\t\t\t\teditor.setJSON(initialContent);\n\t\t\t}\n\n\t\t\tthis.readyResolve?.();\n\t\t\tthis.ready.emit();\n\t\t});\n\n\t\t// Init with config BEFORE appending to DOM. appendChild triggers\n\t\t// connectedCallback which calls init() without config — by calling\n\t\t// init(config) first, the editor initializes with the full config\n\t\t// and connectedCallback's init() becomes a no-op (already initialized).\n\t\teditor.init(config);\n\t\thostElement.appendChild(editor);\n\t}\n\n\tprivate buildConfig(): NotectlEditorConfig {\n\t\tconst defaults: Partial<NotectlEditorConfig> = this.defaultConfig ?? {};\n\t\tconst toolbar: ReadonlyArray<ReadonlyArray<Plugin>> | undefined = this.toolbar();\n\t\tconst features: Partial<TextFormattingConfig> | undefined = this.features();\n\t\tconst maxHistory: number | undefined = this.maxHistoryDepth();\n\n\t\tconst config: NotectlEditorConfig = {\n\t\t\t...defaults,\n\t\t\tplugins: this.plugins(),\n\t\t\tplaceholder: this.placeholder(),\n\t\t\treadonly: this.readonlyMode(),\n\t\t\tautofocus: this.autofocus(),\n\t\t\ttheme: this.theme(),\n\t\t};\n\n\t\tif (toolbar !== undefined) {\n\t\t\tconfig.toolbar = toolbar;\n\t\t}\n\t\tif (features !== undefined) {\n\t\t\tconfig.features = features;\n\t\t}\n\t\tif (maxHistory !== undefined) {\n\t\t\tconfig.maxHistoryDepth = maxHistory;\n\t\t}\n\n\t\treturn config;\n\t}\n\n\t/** Syncs editor document changes to the content model without feedback loops. */\n\tprivate syncContentModel(doc: Document): void {\n\t\tthis.lastEditorDoc = doc;\n\t\tthis.content.set(doc);\n\t}\n\n\tprivate destroyEditor(): void {\n\t\tif (this.editorRef) {\n\t\t\tthis.editorRef.destroy();\n\t\t\tthis.editorRef = null;\n\t\t}\n\t\tthis.initialized.set(false);\n\t}\n\n\tprivate requireEditor(): NotectlEditor {\n\t\tconst editor: NotectlEditor | null = this.editorRef;\n\t\tif (!editor) {\n\t\t\tthrow new Error('NotectlEditor is not initialized. Await whenReady() first.');\n\t\t}\n\t\treturn editor;\n\t}\n}\n","import { DestroyRef, Directive, forwardRef, inject } from '@angular/core';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { Document, StateChangeEvent } from '@notectl/core';\n\nimport { NotectlEditorComponent } from './notectl-editor.component';\nimport { type ContentFormat, NOTECTL_CONTENT_FORMAT } from './tokens';\n\ntype OnChangeFn = (value: Document | string | null) => void;\ntype OnTouchedFn = () => void;\n\n/** Escapes HTML special characters to prevent XSS when inserting plain text. */\nfunction escapeHtml(text: string): string {\n\treturn text\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"')\n\t\t.replace(/'/g, ''');\n}\n\n/**\n * `ControlValueAccessor` directive for Angular forms integration.\n *\n * Supports Reactive Forms (`formControl`, `formControlName`) and\n * template-driven forms (`ngModel`).\n *\n * The content format is configurable via `provideNotectl({ contentFormat })` or\n * the `NOTECTL_CONTENT_FORMAT` injection token:\n * - `'json'` (default) — form value is a `Document` object\n * - `'html'` — form value is a sanitized HTML string\n * - `'text'` — form value is a plain text string\n */\n@Directive({\n\tselector: 'ntl-editor[formControl], ntl-editor[formControlName], ntl-editor[ngModel]',\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: forwardRef(() => NotectlValueAccessorDirective),\n\t\t\tmulti: true,\n\t\t},\n\t],\n})\nexport class NotectlValueAccessorDirective implements ControlValueAccessor {\n\tprivate readonly editor: NotectlEditorComponent = inject(NotectlEditorComponent);\n\tprivate readonly destroyRef: DestroyRef = inject(DestroyRef);\n\tprivate readonly format: ContentFormat =\n\t\tinject(NOTECTL_CONTENT_FORMAT, { optional: true }) ?? 'json';\n\n\tprivate onChange: OnChangeFn = () => {};\n\tprivate onTouched: OnTouchedFn = () => {};\n\tprivate pendingValue: Document | string | null = null;\n\tprivate suppressEmit = false;\n\n\tprivate readonly stateChangeSub = this.editor.stateChange.subscribe(\n\t\t(_event: StateChangeEvent) => {\n\t\t\tif (this.suppressEmit) return;\n\t\t\tconst value: Document | string | null = this.readValue();\n\t\t\tthis.onChange(value);\n\t\t},\n\t);\n\n\tprivate readonly blurSub = this.editor.editorBlur.subscribe(() => {\n\t\tthis.onTouched();\n\t});\n\n\tconstructor() {\n\t\tthis.destroyRef.onDestroy(() => {\n\t\t\tthis.stateChangeSub.unsubscribe();\n\t\t\tthis.blurSub.unsubscribe();\n\t\t});\n\t}\n\n\twriteValue(value: Document | string | null): void {\n\t\tif (!value) return;\n\n\t\ttry {\n\t\t\tthis.editor.getState();\n\t\t\tthis.writeValueToEditor(value);\n\t\t\treturn;\n\t\t} catch {\n\t\t\t// Editor not ready yet — defer\n\t\t}\n\n\t\tthis.pendingValue = value;\n\t\tthis.editor.whenReady().then(() => {\n\t\t\tif (this.pendingValue !== null) {\n\t\t\t\tthis.writeValueToEditor(this.pendingValue);\n\t\t\t\tthis.pendingValue = null;\n\t\t\t}\n\t\t});\n\t}\n\n\tregisterOnChange(fn: OnChangeFn): void {\n\t\tthis.onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: OnTouchedFn): void {\n\t\tthis.onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis.editor.setReadonly(isDisabled);\n\t}\n\n\tprivate writeValueToEditor(value: Document | string): void {\n\t\tthis.suppressEmit = true;\n\t\ttry {\n\t\t\tif (this.format === 'json' && typeof value === 'object') {\n\t\t\t\tthis.editor.setJSON(value as Document);\n\t\t\t} else if (this.format === 'html' && typeof value === 'string') {\n\t\t\t\tthis.editor.setHTML(value);\n\t\t\t} else if (this.format === 'text' && typeof value === 'string') {\n\t\t\t\tthis.editor.setHTML(`<p>${escapeHtml(value)}</p>`);\n\t\t\t} else if (typeof value === 'string') {\n\t\t\t\tthis.editor.setHTML(value);\n\t\t\t} else {\n\t\t\t\tthis.editor.setJSON(value as Document);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.suppressEmit = false;\n\t\t}\n\t}\n\n\tprivate readValue(): Document | string | null {\n\t\ttry {\n\t\t\tswitch (this.format) {\n\t\t\t\tcase 'html':\n\t\t\t\t\treturn this.editor.getHTML();\n\t\t\t\tcase 'text':\n\t\t\t\t\treturn this.editor.getText();\n\t\t\t\tdefault:\n\t\t\t\t\treturn this.editor.getJSON();\n\t\t\t}\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","import { DestroyRef, Injectable, computed, inject, signal } from '@angular/core';\nimport type { EditorState, StateChangeEvent, Transaction } from '@notectl/core';\nimport { type Observable, Subject } from 'rxjs';\n\nimport type { NotectlEditorComponent } from './notectl-editor.component';\n\n/**\n * Optional injectable service for programmatic editor access via DI.\n *\n * Useful when a toolbar or other component needs to interact with\n * the editor without a direct template reference.\n *\n * The service must be provided at a shared injector level and\n * connected to the editor component via `register()`.\n *\n * @example\n * ```typescript\n * @Component({\n * providers: [NotectlEditorService],\n * template: `\n * <app-toolbar />\n * <ntl-editor #editor [plugins]=\"plugins\" />\n * `,\n * })\n * export class EditorPage {\n * private readonly editor = viewChild.required<NotectlEditorComponent>('editor');\n * private readonly service = inject(NotectlEditorService);\n *\n * constructor() {\n * afterNextRender(() => {\n * this.service.register(this.editor());\n * });\n * }\n * }\n * ```\n */\n@Injectable()\nexport class NotectlEditorService {\n\tprivate readonly destroyRef: DestroyRef = inject(DestroyRef);\n\tprivate readonly editorRef = signal<NotectlEditorComponent | null>(null);\n\tprivate readonly stateChangeSubject = new Subject<StateChangeEvent>();\n\n\t/** Whether an editor is currently registered with this service. */\n\treadonly hasEditor = computed<boolean>(() => this.editorRef() !== null);\n\n\t/** Observable stream of state change events from the editor. */\n\treadonly stateChanges$: Observable<StateChangeEvent> = this.stateChangeSubject.asObservable();\n\n\tprivate stateChangeSub: { unsubscribe(): void } | null = null;\n\n\tconstructor() {\n\t\tthis.destroyRef.onDestroy(() => {\n\t\t\tthis.unregister();\n\t\t\tthis.stateChangeSubject.complete();\n\t\t});\n\t}\n\n\t/** Registers an editor component with this service. */\n\tregister(editor: NotectlEditorComponent): void {\n\t\tthis.unregister();\n\t\tthis.editorRef.set(editor);\n\n\t\tthis.stateChangeSub = editor.stateChange.subscribe((event: StateChangeEvent) => {\n\t\t\tthis.stateChangeSubject.next(event);\n\t\t});\n\t}\n\n\t/** Unregisters the current editor from this service. */\n\tunregister(): void {\n\t\tthis.stateChangeSub?.unsubscribe();\n\t\tthis.stateChangeSub = null;\n\t\tthis.editorRef.set(null);\n\t}\n\n\t/** Executes a named command on the registered editor. */\n\texecuteCommand(name: string): boolean {\n\t\tconst editor: NotectlEditorComponent | null = this.editorRef();\n\t\tif (!editor) return false;\n\t\treturn editor.executeCommand(name);\n\t}\n\n\t/** Returns the current editor state, or `null` if no editor is registered. */\n\tgetState(): EditorState | null {\n\t\tconst editor: NotectlEditorComponent | null = this.editorRef();\n\t\tif (!editor) return null;\n\t\ttry {\n\t\t\treturn editor.getState();\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/** Dispatches a transaction on the registered editor. */\n\tdispatch(tr: Transaction): void {\n\t\tthis.editorRef()?.dispatch(tr);\n\t}\n}\n","/**\n * @notectl/angular — Angular integration for the notectl rich text editor.\n * @packageDocumentation\n */\n\n// --- Angular Bindings ---\nexport { NotectlEditorComponent } from './lib/notectl-editor.component';\nexport { NotectlValueAccessorDirective } from './lib/value-accessor.directive';\nexport { NotectlEditorService } from './lib/notectl-editor.service';\n\n// --- Provider Function ---\nexport {\n\tprovideNotectl,\n\ttype NotectlProviderOptions,\n} from './lib/tokens';\n\n// --- Injection Tokens ---\nexport {\n\tNOTECTL_DEFAULT_CONFIG,\n\tNOTECTL_CONTENT_FORMAT,\n\ttype ContentFormat,\n} from './lib/tokens';\n\n// --- Angular-specific Types ---\nexport type { SelectionChangeEvent } from './lib/types';\n\n// --- Re-exports from @notectl/core (convenience) ---\n\n// Model types\nexport type {\n\tDocument,\n\tBlockNode,\n\tTextNode,\n\tInlineNode,\n\tMark,\n\tBlockAttrs,\n} from '@notectl/core';\n\n// Selection types\nexport type { EditorSelection, Position, Selection } from '@notectl/core';\n\n// State types\nexport type {\n\tEditorState,\n\tTransaction,\n\tTransactionMetadata,\n\tStateChangeEvent,\n} from '@notectl/core';\n\n// Plugin types\nexport type { Plugin, PluginConfig, PluginContext } from '@notectl/core';\n\n// Theme types\nexport type { Theme, PartialTheme, ThemePrimitives } from '@notectl/core';\nexport { ThemePreset, LIGHT_THEME, DARK_THEME, createTheme } from '@notectl/core';\n\n// Editor config\nexport type {\n\tNotectlEditorConfig,\n\tTextFormattingConfig,\n} from '@notectl/core';\n\n// Plugin config types\nexport type { FontDefinition } from '@notectl/core';\n\n// Starter fonts\nexport { STARTER_FONTS } from '@notectl/core';\n\n// Plugins (tree-shakable re-exports)\nexport {\n\tTextFormattingPlugin,\n\tHeadingPlugin,\n\tListPlugin,\n\tLinkPlugin,\n\tBlockquotePlugin,\n\tCodeBlockPlugin,\n\tTablePlugin,\n\tImagePlugin,\n\tHorizontalRulePlugin,\n\tHardBreakPlugin,\n\tStrikethroughPlugin,\n\tHighlightPlugin,\n\tTextColorPlugin,\n\tFontPlugin,\n\tFontSizePlugin,\n\tAlignmentPlugin,\n\tSuperSubPlugin,\n\tToolbarPlugin,\n} from '@notectl/core';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAGA;;;AAGG;MACU,sBAAsB,GAClC,IAAI,cAAc,CAA+B,wBAAwB;AAE1E;;;;;;;AAOG;MACU,sBAAsB,GAClC,IAAI,cAAc,CAAgB,wBAAwB;AAa3D;;;;;;;;;;;;;;AAcG;AACG,SAAU,cAAc,CAAC,OAAA,GAAkC,EAAE,EAAA;IAClE,MAAM,SAAS,GAAG,EAAE;AAEpB,IAAA,IAAI,OAAO,CAAC,MAAM,EAAE;AACnB,QAAA,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,OAAO,C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A,CAAC,CAAC;IACH;;IAGA,UAAU,GAAA;AACT,QAAA,IAAI,CAAC,cAAc,EAAE,WAAW,EAAE;AAClC,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI;AAC1B,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;IACzB;;AAGA,IAAA,cAAc,CAAC,IAAY,EAAA;AAC1B,QAAA,MAAM,MAAM,GAAkC,IAAI,CAAC,SAAS,EAAE;AAC9D,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,KAAK;AACzB,QAAA,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;IACnC;;IAGA,QAAQ,GAAA;AACP,QAAA,MAAM,MAAM,GAAkC,IAAI,CAAC,SAAS,EAAE;AAC9D,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,IAAI;AACxB,QAAA,IAAI;AACH,YAAA,OAAO,MAAM,CAAC,QAAQ,EAAE;QACzB;AAAE,QAAA,MAAM;AACP,YAAA,OAAO,IAAI;QACZ;IACD;;AAGA,IAAA,QAAQ,CAAC,EAAe,EAAA;QACvB,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC;IAC/B;uGA1DY,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAApB,oBAAoB,EAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC;;;ACpCD;;;AAGG;AAEH;;ACLA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"notectl-angular.mjs","sources":["../../src/lib/tokens.ts","../../src/lib/notectl-editor.component.ts","../../src/lib/value-accessor.directive.ts","../../src/lib/notectl-editor.service.ts","../../src/public-api.ts","../../src/notectl-angular.ts"],"sourcesContent":["import { type EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport type { NotectlEditorConfig } from '@notectl/core';\n\n/**\n * Default configuration applied to all `<notectl-editor>` instances within\n * the injector scope. Component-level inputs override these defaults.\n */\nexport const NOTECTL_DEFAULT_CONFIG: InjectionToken<Partial<NotectlEditorConfig>> =\n\tnew InjectionToken<Partial<NotectlEditorConfig>>('notectl-default-config');\n\n/**\n * Content format used by the `ControlValueAccessor` for forms integration.\n * Determines how editor content is serialized when reading/writing form values.\n *\n * - `'json'` — `Document` objects (default)\n * - `'html'` — sanitized HTML strings\n * - `'text'` — plain text strings\n */\nexport const NOTECTL_CONTENT_FORMAT: InjectionToken<ContentFormat> =\n\tnew InjectionToken<ContentFormat>('notectl-content-format');\n\n/** Supported content serialization formats for forms integration. */\nexport type ContentFormat = 'json' | 'html' | 'text';\n\n/** Options for `provideNotectl()`. */\nexport interface NotectlProviderOptions {\n\t/** Default editor configuration applied to all instances. */\n\treadonly config?: Partial<NotectlEditorConfig>;\n\t/** Content serialization format for forms integration. Defaults to `'json'`. */\n\treadonly contentFormat?: ContentFormat;\n}\n\n/**\n * Configures the notectl editor at the environment injector level.\n *\n * @example\n * ```typescript\n * bootstrapApplication(App, {\n * providers: [\n * provideNotectl({\n * config: { theme: ThemePreset.Light, placeholder: 'Start typing...' },\n * contentFormat: 'json',\n * }),\n * ],\n * });\n * ```\n */\nexport function provideNotectl(options: NotectlProviderOptions = {}): EnvironmentProviders {\n\tconst providers = [];\n\n\tif (options.config) {\n\t\tproviders.push({ provide: NOTECTL_DEFAULT_CONFIG, useValue: options.config });\n\t}\n\n\tif (options.contentFormat) {\n\t\tproviders.push({ provide: NOTECTL_CONTENT_FORMAT, useValue: options.contentFormat });\n\t}\n\n\treturn makeEnvironmentProviders(providers);\n}\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tDestroyRef,\n\ttype ElementRef,\n\ttype ModelSignal,\n\tafterNextRender,\n\tcomputed,\n\teffect,\n\tinject,\n\tinput,\n\tmodel,\n\toutput,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport type {\n\tDocument,\n\tEditorSelection,\n\tEditorState,\n\tNotectlEditorConfig,\n\tPlugin,\n\tPluginConfig,\n\tStateChangeEvent,\n\tTextFormattingConfig,\n\tTheme,\n\tTransaction,\n} from '@notectl/core';\nimport { NotectlEditor, ThemePreset } from '@notectl/core';\n\nimport { NOTECTL_DEFAULT_CONFIG } from './tokens';\nimport type { SelectionChangeEvent } from './types';\n\n/**\n * Angular standalone component wrapping the `<ntl-editor>` Web Component.\n *\n * Uses `afterNextRender()` for SSR-safe initialization and `effect()` for\n * reactive input tracking — no lifecycle interfaces needed.\n *\n * @example\n * ```html\n * <!-- Basic usage -->\n * <ntl-editor [toolbar]=\"toolbar\" [plugins]=\"plugins\" />\n *\n * <!-- Two-way content binding -->\n * <ntl-editor [(content)]=\"myDocument\" [toolbar]=\"toolbar\" />\n *\n * <!-- Reactive forms -->\n * <ntl-editor [formControl]=\"editorControl\" [toolbar]=\"toolbar\" />\n * ```\n */\n@Component({\n\tselector: 'ntl-editor',\n\ttemplate: '<div #host></div>',\n\tstyles: ':host { display: block; }',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NotectlEditorComponent {\n\t// --- Injected dependencies ---\n\n\tprivate readonly destroyRef: DestroyRef = inject(DestroyRef);\n\tprivate readonly defaultConfig: Partial<NotectlEditorConfig> | null = inject(\n\t\tNOTECTL_DEFAULT_CONFIG,\n\t\t{ optional: true },\n\t);\n\n\t// --- Signal Inputs (1:1 with Web Component config) ---\n\n\treadonly plugins = input<Plugin[]>([]);\n\treadonly toolbar = input<ReadonlyArray<ReadonlyArray<Plugin>>>();\n\treadonly features = input<Partial<TextFormattingConfig>>();\n\treadonly placeholder = input<string>('Start typing...');\n\treadonly readonlyMode = input<boolean>(false);\n\treadonly autofocus = input<boolean>(false);\n\treadonly maxHistoryDepth = input<number>();\n\treadonly theme = input<ThemePreset | Theme>(ThemePreset.Light);\n\n\t// --- Two-way content binding via model() ---\n\n\t/**\n\t * Two-way bindable document content.\n\t *\n\t * `undefined` means no external content was provided — the editor manages\n\t * its own state. Once the editor emits changes, the model updates to the\n\t * current `Document`.\n\t *\n\t * @example\n\t * ```html\n\t * <ntl-editor [(content)]=\"myDocument\" />\n\t * ```\n\t */\n\treadonly content: ModelSignal<Document | undefined> = model<Document>();\n\n\t// --- Signal Outputs (events bridged from Web Component) ---\n\n\treadonly stateChange = output<StateChangeEvent>();\n\treadonly selectionChange = output<SelectionChangeEvent>();\n\treadonly editorFocus = output<void>();\n\treadonly editorBlur = output<void>();\n\treadonly ready = output<void>();\n\n\t// --- Reactive State ---\n\n\treadonly editorState = signal<EditorState | null>(null);\n\n\treadonly isEmpty = computed<boolean>(() => {\n\t\tconst state: EditorState | null = this.editorState();\n\t\tif (!state) return true;\n\t\tconst doc: Document = state.doc;\n\t\tif (doc.children.length === 0) return true;\n\t\tif (doc.children.length > 1) return false;\n\t\tconst block = doc.children[0];\n\t\tif (!block) return true;\n\t\treturn block.type === 'paragraph' && block.children.length === 0;\n\t});\n\n\t// --- Internal state ---\n\n\tprivate readonly hostRef = viewChild.required<ElementRef<HTMLDivElement>>('host');\n\tprivate editorRef: NotectlEditor | null = null;\n\tprivate readyResolve: (() => void) | null = null;\n\tprivate readonly readyPromise: Promise<void> = new Promise<void>((resolve) => {\n\t\tthis.readyResolve = resolve;\n\t});\n\tprivate readonly initialized = signal(false);\n\n\t/** Tracks the last document set from within the editor to prevent feedback loops. */\n\tprivate lastEditorDoc: Document | null = null;\n\n\tconstructor() {\n\t\t// SSR-safe: only runs in the browser after first render\n\t\tafterNextRender(() => {\n\t\t\tthis.initEditor();\n\t\t});\n\n\t\t// React to input changes via effect() — replaces ngOnChanges\n\t\teffect(() => {\n\t\t\tconst currentTheme: ThemePreset | Theme = this.theme();\n\t\t\tconst currentPlaceholder: string = this.placeholder();\n\t\t\tconst currentReadonly: boolean = this.readonlyMode();\n\n\t\t\tconst editor: NotectlEditor | null = this.editorRef;\n\t\t\tif (!this.initialized() || !editor) return;\n\n\t\t\teditor.setTheme(currentTheme);\n\t\t\teditor.configure({\n\t\t\t\tplaceholder: currentPlaceholder,\n\t\t\t\treadonly: currentReadonly,\n\t\t\t});\n\t\t});\n\n\t\t// Sync external content model changes into the editor.\n\t\t// Skips when the document was set by the editor itself (feedback loop prevention).\n\t\teffect(() => {\n\t\t\tconst doc: Document | undefined = this.content();\n\t\t\tconst editor: NotectlEditor | null = this.editorRef;\n\t\t\tif (!this.initialized() || !editor || !doc) return;\n\n\t\t\t// Skip if this document originated from the editor's own state change\n\t\t\tif (doc === this.lastEditorDoc) return;\n\n\t\t\teditor.setJSON(doc);\n\t\t});\n\n\t\tthis.destroyRef.onDestroy(() => {\n\t\t\tthis.destroyEditor();\n\t\t});\n\t}\n\n\t// --- Public API (proxy to Web Component) ---\n\n\t/** Returns the document as JSON. */\n\tgetJSON(): Document {\n\t\treturn this.requireEditor().getJSON();\n\t}\n\n\t/** Sets the document from JSON. */\n\tsetJSON(doc: Document): void {\n\t\tthis.requireEditor().setJSON(doc);\n\t}\n\n\t/** Returns sanitized HTML representation of the document. */\n\tgetHTML(): string {\n\t\treturn this.requireEditor().getHTML();\n\t}\n\n\t/** Sets content from HTML (sanitized). */\n\tsetHTML(html: string): void {\n\t\tthis.requireEditor().setHTML(html);\n\t}\n\n\t/** Returns plain text content. */\n\tgetText(): string {\n\t\treturn this.requireEditor().getText();\n\t}\n\n\t/** Proxy to the Web Component's `commands` object. */\n\tget commands(): NotectlEditor['commands'] {\n\t\treturn this.requireEditor().commands;\n\t}\n\n\t/** Proxy to the Web Component's `can()` capability checker. */\n\tcan(): ReturnType<NotectlEditor['can']> {\n\t\treturn this.requireEditor().can();\n\t}\n\n\t/** Executes a named command registered by a plugin. */\n\texecuteCommand(name: string): boolean {\n\t\tif (!this.editorRef) return false;\n\t\treturn this.editorRef.executeCommand(name);\n\t}\n\n\t/** Configures a plugin at runtime. */\n\tconfigurePlugin(pluginId: string, config: PluginConfig): void {\n\t\tthis.editorRef?.configurePlugin(pluginId, config);\n\t}\n\n\t/** Dispatches a transaction. */\n\tdispatch(tr: Transaction): void {\n\t\tthis.editorRef?.dispatch(tr);\n\t}\n\n\t/** Returns the current editor state. */\n\tgetState(): EditorState {\n\t\treturn this.requireEditor().getState();\n\t}\n\n\t/** Changes the theme at runtime. */\n\tsetTheme(theme: ThemePreset | Theme): void {\n\t\tthis.editorRef?.setTheme(theme);\n\t}\n\n\t/** Returns the current theme setting. */\n\tgetTheme(): ThemePreset | Theme {\n\t\treturn this.editorRef?.getTheme() ?? this.theme();\n\t}\n\n\t/** Sets the readonly state programmatically (used by ControlValueAccessor). */\n\tsetReadonly(readonlyState: boolean): void {\n\t\tthis.editorRef?.configure({ readonly: readonlyState });\n\t}\n\n\t/** Resolves when the editor is ready. */\n\twhenReady(): Promise<void> {\n\t\treturn this.readyPromise;\n\t}\n\n\t// --- Private ---\n\n\tprivate initEditor(): void {\n\t\tconst hostElement: HTMLDivElement = this.hostRef().nativeElement;\n\t\tconst config: NotectlEditorConfig = this.buildConfig();\n\n\t\tconst editor: NotectlEditor = new NotectlEditor();\n\t\tthis.editorRef = editor;\n\n\t\t// Register event listeners BEFORE appending to DOM, because\n\t\t// appendChild triggers connectedCallback → init() synchronously.\n\t\teditor.on('stateChange', (event: StateChangeEvent) => {\n\t\t\tthis.editorState.set(event.newState);\n\t\t\tthis.syncContentModel(event.newState.doc);\n\t\t\tthis.stateChange.emit(event);\n\t\t});\n\n\t\teditor.on('selectionChange', (event: { selection: EditorSelection }) => {\n\t\t\tthis.selectionChange.emit(event);\n\t\t});\n\n\t\teditor.on('focus', () => {\n\t\t\tthis.editorFocus.emit();\n\t\t});\n\n\t\teditor.on('blur', () => {\n\t\t\tthis.editorBlur.emit();\n\t\t});\n\n\t\teditor.on('ready', () => {\n\t\t\tthis.initialized.set(true);\n\t\t\tconst state: EditorState = editor.getState();\n\t\t\tthis.editorState.set(state);\n\n\t\t\t// Apply initial content model if set before editor was ready\n\t\t\tconst initialContent: Document | undefined = this.content();\n\t\t\tif (initialContent) {\n\t\t\t\teditor.setJSON(initialContent);\n\t\t\t}\n\n\t\t\tthis.readyResolve?.();\n\t\t\tthis.ready.emit();\n\t\t});\n\n\t\t// Init with config BEFORE appending to DOM. appendChild triggers\n\t\t// connectedCallback which calls init() without config — by calling\n\t\t// init(config) first, the editor initializes with the full config\n\t\t// and connectedCallback's init() becomes a no-op (already initialized).\n\t\teditor.init(config);\n\t\thostElement.appendChild(editor);\n\t}\n\n\tprivate buildConfig(): NotectlEditorConfig {\n\t\tconst defaults: Partial<NotectlEditorConfig> = this.defaultConfig ?? {};\n\t\tconst toolbar: ReadonlyArray<ReadonlyArray<Plugin>> | undefined = this.toolbar();\n\t\tconst features: Partial<TextFormattingConfig> | undefined = this.features();\n\t\tconst maxHistory: number | undefined = this.maxHistoryDepth();\n\n\t\tconst config: NotectlEditorConfig = {\n\t\t\t...defaults,\n\t\t\tplugins: this.plugins(),\n\t\t\tplaceholder: this.placeholder(),\n\t\t\treadonly: this.readonlyMode(),\n\t\t\tautofocus: this.autofocus(),\n\t\t\ttheme: this.theme(),\n\t\t};\n\n\t\tif (toolbar !== undefined) {\n\t\t\tconfig.toolbar = toolbar;\n\t\t}\n\t\tif (features !== undefined) {\n\t\t\tconfig.features = features;\n\t\t}\n\t\tif (maxHistory !== undefined) {\n\t\t\tconfig.maxHistoryDepth = maxHistory;\n\t\t}\n\n\t\treturn config;\n\t}\n\n\t/** Syncs editor document changes to the content model without feedback loops. */\n\tprivate syncContentModel(doc: Document): void {\n\t\tthis.lastEditorDoc = doc;\n\t\tthis.content.set(doc);\n\t}\n\n\tprivate destroyEditor(): void {\n\t\tif (this.editorRef) {\n\t\t\tthis.editorRef.destroy();\n\t\t\tthis.editorRef = null;\n\t\t}\n\t\tthis.initialized.set(false);\n\t}\n\n\tprivate requireEditor(): NotectlEditor {\n\t\tconst editor: NotectlEditor | null = this.editorRef;\n\t\tif (!editor) {\n\t\t\tthrow new Error('NotectlEditor is not initialized. Await whenReady() first.');\n\t\t}\n\t\treturn editor;\n\t}\n}\n","import { DestroyRef, Directive, forwardRef, inject } from '@angular/core';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { Document, StateChangeEvent } from '@notectl/core';\n\nimport { NotectlEditorComponent } from './notectl-editor.component';\nimport { type ContentFormat, NOTECTL_CONTENT_FORMAT } from './tokens';\n\ntype OnChangeFn = (value: Document | string | null) => void;\ntype OnTouchedFn = () => void;\n\n/** Escapes HTML special characters to prevent XSS when inserting plain text. */\nfunction escapeHtml(text: string): string {\n\treturn text\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"')\n\t\t.replace(/'/g, ''');\n}\n\n/**\n * `ControlValueAccessor` directive for Angular forms integration.\n *\n * Supports Reactive Forms (`formControl`, `formControlName`) and\n * template-driven forms (`ngModel`).\n *\n * The content format is configurable via `provideNotectl({ contentFormat })` or\n * the `NOTECTL_CONTENT_FORMAT` injection token:\n * - `'json'` (default) — form value is a `Document` object\n * - `'html'` — form value is a sanitized HTML string\n * - `'text'` — form value is a plain text string\n */\n@Directive({\n\tselector: 'ntl-editor[formControl], ntl-editor[formControlName], ntl-editor[ngModel]',\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: forwardRef(() => NotectlValueAccessorDirective),\n\t\t\tmulti: true,\n\t\t},\n\t],\n})\nexport class NotectlValueAccessorDirective implements ControlValueAccessor {\n\tprivate readonly editor: NotectlEditorComponent = inject(NotectlEditorComponent);\n\tprivate readonly destroyRef: DestroyRef = inject(DestroyRef);\n\tprivate readonly format: ContentFormat =\n\t\tinject(NOTECTL_CONTENT_FORMAT, { optional: true }) ?? 'json';\n\n\tprivate onChange: OnChangeFn = () => {};\n\tprivate onTouched: OnTouchedFn = () => {};\n\tprivate pendingValue: Document | string | null = null;\n\tprivate suppressEmit = false;\n\n\tprivate readonly stateChangeSub = this.editor.stateChange.subscribe(\n\t\t(_event: StateChangeEvent) => {\n\t\t\tif (this.suppressEmit) return;\n\t\t\tconst value: Document | string | null = this.readValue();\n\t\t\tthis.onChange(value);\n\t\t},\n\t);\n\n\tprivate readonly blurSub = this.editor.editorBlur.subscribe(() => {\n\t\tthis.onTouched();\n\t});\n\n\tconstructor() {\n\t\tthis.destroyRef.onDestroy(() => {\n\t\t\tthis.stateChangeSub.unsubscribe();\n\t\t\tthis.blurSub.unsubscribe();\n\t\t});\n\t}\n\n\twriteValue(value: Document | string | null): void {\n\t\tif (!value) return;\n\n\t\ttry {\n\t\t\tthis.editor.getState();\n\t\t\tthis.writeValueToEditor(value);\n\t\t\treturn;\n\t\t} catch {\n\t\t\t// Editor not ready yet — defer\n\t\t}\n\n\t\tthis.pendingValue = value;\n\t\tthis.editor.whenReady().then(() => {\n\t\t\tif (this.pendingValue !== null) {\n\t\t\t\tthis.writeValueToEditor(this.pendingValue);\n\t\t\t\tthis.pendingValue = null;\n\t\t\t}\n\t\t});\n\t}\n\n\tregisterOnChange(fn: OnChangeFn): void {\n\t\tthis.onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: OnTouchedFn): void {\n\t\tthis.onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis.editor.setReadonly(isDisabled);\n\t}\n\n\tprivate writeValueToEditor(value: Document | string): void {\n\t\tthis.suppressEmit = true;\n\t\ttry {\n\t\t\tif (this.format === 'json' && typeof value === 'object') {\n\t\t\t\tthis.editor.setJSON(value as Document);\n\t\t\t} else if (this.format === 'html' && typeof value === 'string') {\n\t\t\t\tthis.editor.setHTML(value);\n\t\t\t} else if (this.format === 'text' && typeof value === 'string') {\n\t\t\t\tthis.editor.setHTML(`<p>${escapeHtml(value)}</p>`);\n\t\t\t} else if (typeof value === 'string') {\n\t\t\t\tthis.editor.setHTML(value);\n\t\t\t} else {\n\t\t\t\tthis.editor.setJSON(value as Document);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.suppressEmit = false;\n\t\t}\n\t}\n\n\tprivate readValue(): Document | string | null {\n\t\ttry {\n\t\t\tswitch (this.format) {\n\t\t\t\tcase 'html':\n\t\t\t\t\treturn this.editor.getHTML();\n\t\t\t\tcase 'text':\n\t\t\t\t\treturn this.editor.getText();\n\t\t\t\tdefault:\n\t\t\t\t\treturn this.editor.getJSON();\n\t\t\t}\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","import { DestroyRef, Injectable, computed, inject, signal } from '@angular/core';\nimport type { EditorState, StateChangeEvent, Transaction } from '@notectl/core';\nimport { type Observable, Subject } from 'rxjs';\n\nimport type { NotectlEditorComponent } from './notectl-editor.component';\n\n/**\n * Optional injectable service for programmatic editor access via DI.\n *\n * Useful when a toolbar or other component needs to interact with\n * the editor without a direct template reference.\n *\n * The service must be provided at a shared injector level and\n * connected to the editor component via `register()`.\n *\n * @example\n * ```typescript\n * @Component({\n * providers: [NotectlEditorService],\n * template: `\n * <app-toolbar />\n * <ntl-editor #editor [plugins]=\"plugins\" />\n * `,\n * })\n * export class EditorPage {\n * private readonly editor = viewChild.required<NotectlEditorComponent>('editor');\n * private readonly service = inject(NotectlEditorService);\n *\n * constructor() {\n * afterNextRender(() => {\n * this.service.register(this.editor());\n * });\n * }\n * }\n * ```\n */\n@Injectable()\nexport class NotectlEditorService {\n\tprivate readonly destroyRef: DestroyRef = inject(DestroyRef);\n\tprivate readonly editorRef = signal<NotectlEditorComponent | null>(null);\n\tprivate readonly stateChangeSubject = new Subject<StateChangeEvent>();\n\n\t/** Whether an editor is currently registered with this service. */\n\treadonly hasEditor = computed<boolean>(() => this.editorRef() !== null);\n\n\t/** Observable stream of state change events from the editor. */\n\treadonly stateChanges$: Observable<StateChangeEvent> = this.stateChangeSubject.asObservable();\n\n\tprivate stateChangeSub: { unsubscribe(): void } | null = null;\n\n\tconstructor() {\n\t\tthis.destroyRef.onDestroy(() => {\n\t\t\tthis.unregister();\n\t\t\tthis.stateChangeSubject.complete();\n\t\t});\n\t}\n\n\t/** Registers an editor component with this service. */\n\tregister(editor: NotectlEditorComponent): void {\n\t\tthis.unregister();\n\t\tthis.editorRef.set(editor);\n\n\t\tthis.stateChangeSub = editor.stateChange.subscribe((event: StateChangeEvent) => {\n\t\t\tthis.stateChangeSubject.next(event);\n\t\t});\n\t}\n\n\t/** Unregisters the current editor from this service. */\n\tunregister(): void {\n\t\tthis.stateChangeSub?.unsubscribe();\n\t\tthis.stateChangeSub = null;\n\t\tthis.editorRef.set(null);\n\t}\n\n\t/** Executes a named command on the registered editor. */\n\texecuteCommand(name: string): boolean {\n\t\tconst editor: NotectlEditorComponent | null = this.editorRef();\n\t\tif (!editor) return false;\n\t\treturn editor.executeCommand(name);\n\t}\n\n\t/** Returns the current editor state, or `null` if no editor is registered. */\n\tgetState(): EditorState | null {\n\t\tconst editor: NotectlEditorComponent | null = this.editorRef();\n\t\tif (!editor) return null;\n\t\ttry {\n\t\t\treturn editor.getState();\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/** Dispatches a transaction on the registered editor. */\n\tdispatch(tr: Transaction): void {\n\t\tthis.editorRef()?.dispatch(tr);\n\t}\n}\n","/**\n * @notectl/angular — Angular integration for the notectl rich text editor.\n * @packageDocumentation\n */\n\n// --- Angular Bindings ---\nexport { NotectlEditorComponent } from './lib/notectl-editor.component';\nexport { NotectlValueAccessorDirective } from './lib/value-accessor.directive';\nexport { NotectlEditorService } from './lib/notectl-editor.service';\n\n// --- Provider Function ---\nexport {\n\tprovideNotectl,\n\ttype NotectlProviderOptions,\n} from './lib/tokens';\n\n// --- Injection Tokens ---\nexport {\n\tNOTECTL_DEFAULT_CONFIG,\n\tNOTECTL_CONTENT_FORMAT,\n\ttype ContentFormat,\n} from './lib/tokens';\n\n// --- Angular-specific Types ---\nexport type { SelectionChangeEvent } from './lib/types';\n\n// --- Re-exports from @notectl/core (convenience) ---\n\n// Model types\nexport type {\n\tDocument,\n\tBlockNode,\n\tTextNode,\n\tInlineNode,\n\tMark,\n\tBlockAttrs,\n} from '@notectl/core';\n\n// Selection types\nexport type { EditorSelection, Position, Selection } from '@notectl/core';\n\n// State types\nexport type {\n\tEditorState,\n\tTransaction,\n\tTransactionMetadata,\n\tStateChangeEvent,\n} from '@notectl/core';\n\n// Plugin types\nexport type { Plugin, PluginConfig, PluginContext } from '@notectl/core';\n\n// Theme types\nexport type { Theme, PartialTheme, ThemePrimitives } from '@notectl/core';\nexport { ThemePreset, LIGHT_THEME, DARK_THEME, createTheme } from '@notectl/core';\n\n// Editor config\nexport type {\n\tNotectlEditorConfig,\n\tTextFormattingConfig,\n} from '@notectl/core';\n\n// Plugin config types\nexport type { FontDefinition } from '@notectl/core';\n\n// Starter fonts\n/** @deprecated Import from '@notectl/core/fonts' instead. */\nexport { STARTER_FONTS } from '@notectl/core/fonts';\n\n// Plugins (tree-shakable re-exports)\nexport {\n\tTextFormattingPlugin,\n\tHeadingPlugin,\n\tListPlugin,\n\tLinkPlugin,\n\tBlockquotePlugin,\n\tCodeBlockPlugin,\n\tTablePlugin,\n\tImagePlugin,\n\tHorizontalRulePlugin,\n\tHardBreakPlugin,\n\tStrikethroughPlugin,\n\tHighlightPlugin,\n\tTextColorPlugin,\n\tFontPlugin,\n\tFontSizePlugin,\n\tAlignmentPlugin,\n\tSuperSubPlugin,\n\tToolbarPlugin,\n} from '@notectl/core';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAGA;;;AAGG;MACU,sBAAsB,GAClC,IAAI,cAAc,CAA+B,wBAAwB;AAE1E;;;;;;;AAOG;MACU,sBAAsB,GAClC,IAAI,cAAc,CAAgB,wBAAwB;AAa3D;;;;;;;;;;;;;;AAcG;AACG,SAAU,cAAc,CAAC,OAAA,GAAkC,EAAE,EAAA;IAClE,MAAM,SAAS,GAAG,EAAE;AAEpB,IAAA,IAAI,OAAO,CAAC,MAAM,EAAE;AACnB,QAAA,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,E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CAAC,IAAI,CAAC,KAAK,CAAC;AACpC,QAAA,CAAC,CAAC;IACH;;IAGA,UAAU,GAAA;AACT,QAAA,IAAI,CAAC,cAAc,EAAE,WAAW,EAAE;AAClC,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI;AAC1B,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;IACzB;;AAGA,IAAA,cAAc,CAAC,IAAY,EAAA;AAC1B,QAAA,MAAM,MAAM,GAAkC,IAAI,CAAC,SAAS,EAAE;AAC9D,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,KAAK;AACzB,QAAA,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;IACnC;;IAGA,QAAQ,GAAA;AACP,QAAA,MAAM,MAAM,GAAkC,IAAI,CAAC,SAAS,EAAE;AAC9D,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,IAAI;AACxB,QAAA,IAAI;AACH,YAAA,OAAO,MAAM,CAAC,QAAQ,EAAE;QACzB;AAAE,QAAA,MAAM;AACP,YAAA,OAAO,IAAI;QACZ;IACD;;AAGA,IAAA,QAAQ,CAAC,EAAe,EAAA;QACvB,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC;IAC/B;uGA1DY,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAApB,oBAAoB,EAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC;;;ACpCD;;;AAGG;AAEH;;ACLA;;AAEG;;;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { ModelSignal, InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { EditorSelection, Plugin, TextFormattingConfig, ThemePreset, Theme, Document, StateChangeEvent, EditorState, NotectlEditor, PluginConfig, Transaction, NotectlEditorConfig } from '@notectl/core';
|
|
4
|
-
export { AlignmentPlugin, BlockAttrs, BlockNode, BlockquotePlugin, CodeBlockPlugin, DARK_THEME, Document, EditorSelection, EditorState, FontDefinition, FontPlugin, FontSizePlugin, HardBreakPlugin, HeadingPlugin, HighlightPlugin, HorizontalRulePlugin, ImagePlugin, InlineNode, LIGHT_THEME, LinkPlugin, ListPlugin, Mark, NotectlEditorConfig, PartialTheme, Plugin, PluginConfig, PluginContext, Position,
|
|
4
|
+
export { AlignmentPlugin, BlockAttrs, BlockNode, BlockquotePlugin, CodeBlockPlugin, DARK_THEME, Document, EditorSelection, EditorState, FontDefinition, FontPlugin, FontSizePlugin, HardBreakPlugin, HeadingPlugin, HighlightPlugin, HorizontalRulePlugin, ImagePlugin, InlineNode, LIGHT_THEME, LinkPlugin, ListPlugin, Mark, NotectlEditorConfig, PartialTheme, Plugin, PluginConfig, PluginContext, Position, Selection, StateChangeEvent, StrikethroughPlugin, SuperSubPlugin, TablePlugin, TextColorPlugin, TextFormattingConfig, TextFormattingPlugin, TextNode, Theme, ThemePreset, ThemePrimitives, ToolbarPlugin, Transaction, TransactionMetadata, createTheme } from '@notectl/core';
|
|
5
5
|
import { ControlValueAccessor } from '@angular/forms';
|
|
6
6
|
import { Observable } from 'rxjs';
|
|
7
|
+
export { STARTER_FONTS } from '@notectl/core/fonts';
|
|
7
8
|
|
|
8
9
|
/** Event payload emitted on selection changes. */
|
|
9
10
|
interface SelectionChangeEvent {
|
package/package.json
CHANGED