@malva-ui/editor 0.1.13 → 0.1.14
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.
- package/README.md +5 -5
- package/fesm2022/malva-ui-editor-ai.mjs +17 -0
- package/fesm2022/malva-ui-editor-ai.mjs.map +1 -0
- package/fesm2022/malva-ui-editor.mjs +10227 -0
- package/fesm2022/malva-ui-editor.mjs.map +1 -0
- package/package.json +35 -26
- package/types/malva-ui-editor-ai.d.ts +1 -0
- package/types/malva-ui-editor.d.ts +2995 -0
- package/ai/index.d.ts +0 -12
- package/ai/malva-ui-editor-ai.d.ts +0 -5
- package/esm2022/ai/index.js +0 -12
- package/esm2022/ai/index.js.map +0 -1
- package/esm2022/ai/malva-ui-editor-ai.js +0 -5
- package/esm2022/ai/malva-ui-editor-ai.js.map +0 -1
- package/esm2022/index.js +0 -37
- package/esm2022/index.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-actions.js +0 -69
- package/esm2022/lib/ai/editor-ai-actions.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-context.js +0 -612
- package/esm2022/lib/ai/editor-ai-context.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-menu.js +0 -288
- package/esm2022/lib/ai/editor-ai-menu.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-review-bar.js +0 -223
- package/esm2022/lib/ai/editor-ai-review-bar.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-stream.js +0 -677
- package/esm2022/lib/ai/editor-ai-stream.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-suggestions.js +0 -751
- package/esm2022/lib/ai/editor-ai-suggestions.js.map +0 -1
- package/esm2022/lib/ai/editor-ai.tokens.js +0 -10
- package/esm2022/lib/ai/editor-ai.tokens.js.map +0 -1
- package/esm2022/lib/ai/editor-ai.types.js +0 -1
- package/esm2022/lib/ai/editor-ai.types.js.map +0 -1
- package/esm2022/lib/editor/editor.js +0 -985
- package/esm2022/lib/editor/editor.js.map +0 -1
- package/esm2022/lib/editor-extension-preflight.js +0 -83
- package/esm2022/lib/editor-extension-preflight.js.map +0 -1
- package/esm2022/lib/editor-serialization.js +0 -152
- package/esm2022/lib/editor-serialization.js.map +0 -1
- package/esm2022/lib/editor-toolbar-context.js +0 -259
- package/esm2022/lib/editor-toolbar-context.js.map +0 -1
- package/esm2022/lib/editor.tokens.js +0 -10
- package/esm2022/lib/editor.tokens.js.map +0 -1
- package/esm2022/lib/editor.types.js +0 -48
- package/esm2022/lib/editor.types.js.map +0 -1
- package/esm2022/lib/extensions/editor-block-handle.js +0 -760
- package/esm2022/lib/extensions/editor-block-handle.js.map +0 -1
- package/esm2022/lib/extensions/editor-extensions.js +0 -321
- package/esm2022/lib/extensions/editor-extensions.js.map +0 -1
- package/esm2022/lib/extensions/editor-markdown-compatibility.js +0 -162
- package/esm2022/lib/extensions/editor-markdown-compatibility.js.map +0 -1
- package/esm2022/lib/extensions/editor-upload-placeholder.js +0 -156
- package/esm2022/lib/extensions/editor-upload-placeholder.js.map +0 -1
- package/esm2022/lib/status/editor-status.js +0 -64
- package/esm2022/lib/status/editor-status.js.map +0 -1
- package/esm2022/lib/toolbar/editor-alignment.js +0 -203
- package/esm2022/lib/toolbar/editor-alignment.js.map +0 -1
- package/esm2022/lib/toolbar/editor-block-insert.js +0 -101
- package/esm2022/lib/toolbar/editor-block-insert.js.map +0 -1
- package/esm2022/lib/toolbar/editor-color-control.js +0 -71
- package/esm2022/lib/toolbar/editor-color-control.js.map +0 -1
- package/esm2022/lib/toolbar/editor-command-button.js +0 -115
- package/esm2022/lib/toolbar/editor-command-button.js.map +0 -1
- package/esm2022/lib/toolbar/editor-heading.js +0 -266
- package/esm2022/lib/toolbar/editor-heading.js.map +0 -1
- package/esm2022/lib/toolbar/editor-highlight.js +0 -84
- package/esm2022/lib/toolbar/editor-highlight.js.map +0 -1
- package/esm2022/lib/toolbar/editor-image-upload-dialog.js +0 -289
- package/esm2022/lib/toolbar/editor-image-upload-dialog.js.map +0 -1
- package/esm2022/lib/toolbar/editor-image-upload.js +0 -315
- package/esm2022/lib/toolbar/editor-image-upload.js.map +0 -1
- package/esm2022/lib/toolbar/editor-inline-marks.js +0 -124
- package/esm2022/lib/toolbar/editor-inline-marks.js.map +0 -1
- package/esm2022/lib/toolbar/editor-link.js +0 -265
- package/esm2022/lib/toolbar/editor-link.js.map +0 -1
- package/esm2022/lib/toolbar/editor-list.js +0 -249
- package/esm2022/lib/toolbar/editor-list.js.map +0 -1
- package/esm2022/lib/toolbar/editor-table.js +0 -292
- package/esm2022/lib/toolbar/editor-table.js.map +0 -1
- package/esm2022/lib/toolbar/editor-text-color.js +0 -82
- package/esm2022/lib/toolbar/editor-text-color.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar-widget.js +0 -41
- package/esm2022/lib/toolbar/editor-toolbar-widget.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar.defs.js +0 -60
- package/esm2022/lib/toolbar/editor-toolbar.defs.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar.js +0 -826
- package/esm2022/lib/toolbar/editor-toolbar.js.map +0 -1
- package/esm2022/lib/toolbar/editor-undo-redo.js +0 -72
- package/esm2022/lib/toolbar/editor-undo-redo.js.map +0 -1
- package/esm2022/lib/toolbar/editor-zoom.js +0 -330
- package/esm2022/lib/toolbar/editor-zoom.js.map +0 -1
- package/esm2022/lib/upload/editor-image-upload-coordinator.js +0 -480
- package/esm2022/lib/upload/editor-image-upload-coordinator.js.map +0 -1
- package/esm2022/malva-ui-editor.js +0 -5
- package/esm2022/malva-ui-editor.js.map +0 -1
- package/index.d.ts +0 -35
- package/lib/ai/editor-ai-actions.d.ts +0 -27
- package/lib/ai/editor-ai-context.d.ts +0 -307
- package/lib/ai/editor-ai-menu.d.ts +0 -142
- package/lib/ai/editor-ai-review-bar.d.ts +0 -116
- package/lib/ai/editor-ai-stream.d.ts +0 -207
- package/lib/ai/editor-ai-suggestions.d.ts +0 -219
- package/lib/ai/editor-ai.tokens.d.ts +0 -10
- package/lib/ai/editor-ai.types.d.ts +0 -176
- package/lib/editor/editor.d.ts +0 -243
- package/lib/editor-extension-preflight.d.ts +0 -23
- package/lib/editor-serialization.d.ts +0 -74
- package/lib/editor-toolbar-context.d.ts +0 -116
- package/lib/editor.tokens.d.ts +0 -6
- package/lib/editor.types.d.ts +0 -194
- package/lib/extensions/editor-block-handle.d.ts +0 -59
- package/lib/extensions/editor-extensions.d.ts +0 -165
- package/lib/extensions/editor-markdown-compatibility.d.ts +0 -11
- package/lib/extensions/editor-upload-placeholder.d.ts +0 -75
- package/lib/status/editor-status.d.ts +0 -24
- package/lib/toolbar/editor-alignment.d.ts +0 -61
- package/lib/toolbar/editor-block-insert.d.ts +0 -26
- package/lib/toolbar/editor-color-control.d.ts +0 -32
- package/lib/toolbar/editor-command-button.d.ts +0 -29
- package/lib/toolbar/editor-heading.d.ts +0 -68
- package/lib/toolbar/editor-highlight.d.ts +0 -21
- package/lib/toolbar/editor-image-upload-dialog.d.ts +0 -96
- package/lib/toolbar/editor-image-upload.d.ts +0 -71
- package/lib/toolbar/editor-inline-marks.d.ts +0 -30
- package/lib/toolbar/editor-link.d.ts +0 -78
- package/lib/toolbar/editor-list.d.ts +0 -67
- package/lib/toolbar/editor-table.d.ts +0 -133
- package/lib/toolbar/editor-text-color.d.ts +0 -21
- package/lib/toolbar/editor-toolbar-widget.d.ts +0 -19
- package/lib/toolbar/editor-toolbar.d.ts +0 -157
- package/lib/toolbar/editor-toolbar.defs.d.ts +0 -35
- package/lib/toolbar/editor-undo-redo.d.ts +0 -26
- package/lib/toolbar/editor-zoom.d.ts +0 -108
- package/lib/upload/editor-image-upload-coordinator.d.ts +0 -55
- package/malva-ui-editor.d.ts +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../../../../libs/editor/src/lib/editor/editor.ts","../../../../../../libs/editor/src/lib/editor/editor.html"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,SAAS,EAClE,MAAM,CAAC,gCAAgC,CAAC,CACzC,CAAC;4BACJ,CAAC;yBACF;qBACF,QACK;wBACJ,KAAK,EAAE,YAAY;wBACnB,SAAS,EAAE,+CAA+C;wBAC1D,8BAA8B,EAAE,oBAAoB;wBACpD,8BAA8B,EAAE,YAAY;wBAC5C,6BAA6B,EAAE,WAAW;wBAC1C,sBAAsB,EAAE,4BAA4B;wBACpD,cAAc,EAAE,gCAAgC;wBAChD,2BAA2B,EAAE,cAAc;qBAC5C;2yDAqGgD,SAAS,+DAWK,MAAM,gGAGnB,mBAAmB,sGAInE,wBAAwB,oGAI2B,sBAAsB","sourcesContent":["import { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChildren,\n DestroyRef,\n ElementRef,\n effect,\n forwardRef,\n inject,\n Injector,\n input,\n model,\n output,\n PLATFORM_ID,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { AfterViewInit } from '@angular/core';\nimport type { Content, Extensions, SetContentOptions } from '@tiptap/core';\nimport type { Mark } from '@tiptap/pm/model';\nimport { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/markdown';\nimport { MlvFade, MlvSpacer } from '@malva-ui/cdk/utils';\nimport type { MlvFormControl } from '@malva-ui/core/form-utils';\nimport {\n MlvFormControlWrapper,\n MlvFormControlWrapperControl,\n MlvHint,\n MlvLabel,\n MlvMessage,\n MlvSignalFormControlBase,\n MLV_FORM_CONTROL,\n} from '@malva-ui/core/form-utils';\nimport { MlvToolbar } from '@malva-ui/core/toolbar';\nimport { MlvDivider } from '@malva-ui/core/divider';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_ROVING,\n MLV_EDITOR_TOOLBAR_REVISION,\n MLV_EDITOR_UPLOAD_ABORT_REGISTRY,\n MlvEditorOverlayRegistry,\n MlvEditorToolbarRevision,\n MlvEditorToolbarRovingRegistry,\n MlvEditorUploadAbortRegistry,\n type MlvEditorToolbarContext,\n} from '../editor-toolbar-context';\nimport {\n MLV_EDITOR_DEFAULT_IMAGE_UPLOAD_OPTIONS,\n MLV_EDITOR_IMAGE_UPLOADER,\n} from '../editor.tokens';\nimport {\n MLV_EDITOR_AI_CONTEXT,\n MLV_EDITOR_AI_INPUT_PROVIDER,\n MlvEditorAiContext,\n} from '../ai/editor-ai-context';\nimport type { MlvEditorAiProvider } from '../ai/editor-ai.types';\nimport {\n editorValuesAreEquivalent,\n normalizeEditorValue,\n parseEditorJsonDocument,\n serializeEditorValue,\n} from '../editor-serialization';\nimport { preflightMlvEditorExtensions } from '../editor-extension-preflight';\nimport type {\n MlvEditorContentWidth,\n MlvEditorError,\n MlvEditorFocusEvent,\n MlvEditorFormat,\n MlvEditorImageUploadCancelled,\n MlvEditorImageUploadFailure,\n MlvEditorImageUploadControl,\n MlvEditorImageUploadOptions,\n MlvEditorImageUploadSuccess,\n MlvEditorImageUploader,\n MlvEditorSelectionChange,\n MlvEditorTransactionEvent,\n} from '../editor.types';\nimport type { MlvEditorBlockMove } from '../extensions/editor-block-handle';\nimport { mlvEditorDefaultExtensions } from '../extensions/editor-extensions';\nimport {\n createMlvEditorImageUploadCoordinator,\n MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n} from '../upload/editor-image-upload-coordinator';\nimport { MlvEditorAlignment } from '../toolbar/editor-alignment';\nimport { MlvEditorBlockInsert } from '../toolbar/editor-block-insert';\nimport { MlvEditorHeading } from '../toolbar/editor-heading';\nimport { MlvEditorHighlight } from '../toolbar/editor-highlight';\nimport { MlvEditorInlineMarks } from '../toolbar/editor-inline-marks';\nimport { MlvEditorList } from '../toolbar/editor-list';\nimport { MlvEditorLink } from '../toolbar/editor-link';\nimport {\n MlvEditorImageUpload,\n MlvEditorImageUploadStatus,\n} from '../toolbar/editor-image-upload';\nimport { MlvEditorTable } from '../toolbar/editor-table';\nimport {\n MlvEditorToolbarDef,\n MlvEditorToolbarEndDef,\n MlvEditorToolbarStartDef,\n} from '../toolbar/editor-toolbar.defs';\nimport {\n MlvEditorToolbarOverflow,\n MlvEditorToolbarRoot,\n} from '../toolbar/editor-toolbar';\nimport { MlvEditorUndoRedo } from '../toolbar/editor-undo-redo';\nimport { MlvEditorZoom } from '../toolbar/editor-zoom';\nimport { MlvEditorTextColor } from '../toolbar/editor-text-color';\nimport { MlvEditorStatus } from '../status/editor-status';\n\n/** @internal Tiptap content and options prepared from one external value. */\ntype MlvEditorPreparedContent =\n | {\n readonly ok: true;\n readonly content: Content;\n readonly options: SetContentOptions;\n }\n | { readonly ok: false; readonly cause: unknown };\n\n/**\n * Browser-only Tiptap form control with nullable HTML, Markdown, or JSON\n * values.\n *\n * The component is a pure Angular `FormValueControl`; it deliberately does\n * not implement a `ControlValueAccessor` or provide `NG_VALUE_ACCESSOR`.\n */\n@Component({\n selector: 'mlv-editor',\n imports: [\n MlvFormControlWrapper,\n MlvFormControlWrapperControl,\n MlvHint,\n MlvLabel,\n MlvMessage,\n NgTemplateOutlet,\n MlvFade,\n MlvToolbar,\n MlvDivider,\n MlvEditorToolbarRoot,\n MlvEditorToolbarOverflow,\n MlvEditorUndoRedo,\n MlvEditorZoom,\n MlvEditorHeading,\n MlvEditorList,\n MlvEditorInlineMarks,\n MlvEditorTextColor,\n MlvEditorStatus,\n MlvEditorHighlight,\n MlvEditorLink,\n MlvEditorImageUpload,\n MlvEditorImageUploadStatus,\n MlvEditorTable,\n MlvEditorAlignment,\n MlvEditorBlockInsert,\n MlvSpacer,\n ],\n templateUrl: './editor.html',\n styleUrl: './editor.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n MlvEditorOverlayRegistry,\n MlvEditorToolbarRevision,\n MlvEditorToolbarRovingRegistry,\n MlvEditorUploadAbortRegistry,\n {\n provide: MLV_FORM_CONTROL,\n useExisting: forwardRef(() => MlvEditor),\n },\n {\n provide: MLV_EDITOR_TOOLBAR_CONTEXT,\n useExisting: forwardRef(() => MlvEditor),\n },\n {\n provide: MLV_EDITOR_TOOLBAR_REVISION,\n useFactory: (state: MlvEditorToolbarRevision) => state.revision,\n deps: [MlvEditorToolbarRevision],\n },\n {\n provide: MLV_EDITOR_TOOLBAR_ROVING,\n useExisting: MlvEditorToolbarRovingRegistry,\n },\n {\n provide: MLV_EDITOR_OVERLAY_REGISTRY,\n useExisting: MlvEditorOverlayRegistry,\n },\n {\n provide: MLV_EDITOR_UPLOAD_ABORT_REGISTRY,\n useExisting: MlvEditorUploadAbortRegistry,\n },\n MlvEditorAiContext,\n {\n provide: MLV_EDITOR_AI_CONTEXT,\n useExisting: MlvEditorAiContext,\n },\n {\n provide: MLV_EDITOR_AI_INPUT_PROVIDER,\n useFactory: () => {\n const owner = inject(\n forwardRef(() => MlvEditor),\n ) as unknown as MlvEditor;\n return owner.aiProvider;\n },\n },\n {\n provide: MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n useFactory: () => {\n const owner = inject(\n forwardRef(() => MlvEditor),\n ) as unknown as MlvEditor;\n return createMlvEditorImageUploadCoordinator(\n {\n editor: owner.editor,\n imageUploader: owner.imageUploader,\n imageUploadOptions: owner.imageUploadOptions,\n disabled: () => owner.computedDisabled(),\n readonly: () => owner.readonly(),\n emitSuccess: (event) => owner.imageUploadSuccess.emit(event),\n emitFailure: (event) => owner.imageUploadFailure.emit(event),\n emitCancelled: (event) => owner.imageUploadCancelled.emit(event),\n emitError: (error) => owner.editorError.emit(error),\n },\n inject(MLV_EDITOR_IMAGE_UPLOADER, { optional: true }) ?? undefined,\n inject(MLV_EDITOR_UPLOAD_ABORT_REGISTRY),\n );\n },\n },\n ],\n host: {\n class: 'mlv-editor',\n '[class]': '\"mlv-editor--content-width-\" + contentWidth()',\n '[class.mlv-editor--disabled]': 'computedDisabled()',\n '[class.mlv-editor--readonly]': 'readonly()',\n '[class.mlv-editor--focused]': 'focused()',\n '[attr.aria-disabled]': 'computedDisabled() || null',\n '[attr.inert]': 'computedDisabled() ? \"\" : null',\n '[style.--mlv-editor-zoom]': 'zoom() / 100',\n },\n})\nexport class MlvEditor\n extends MlvSignalFormControlBase<string | null>\n implements MlvFormControl, AfterViewInit, MlvEditorToolbarContext\n{\n /** @private Tiptap instance owned exclusively by this component. */\n private readonly _editor = signal<Editor | null>(null);\n\n /** Nullable editor model used by direct, reactive, template, and signal forms. */\n readonly value = model<string | null>(null);\n\n /** Serialization format for the visual editor. */\n readonly format = input<MlvEditorFormat>('html');\n\n /** Width of the centred content column; a gutter is reserved at every value. */\n readonly contentWidth = input<MlvEditorContentWidth>('default');\n\n /** Complete Tiptap extension replacement; omit it for Malva's fresh preset. */\n readonly extensions = input<Extensions | undefined>(undefined);\n\n /** Placeholder displayed by the default extension preset. */\n readonly placeholder = input('Write something…');\n\n /** Maximum character count for Malva's default extension preset. */\n readonly characterLimit = input<number | null>(null);\n\n /** IDREF(s) naming the editable content region. */\n readonly ariaLabelledBy = input<string | undefined>(undefined);\n\n /** IDREF(s) describing the editable content region. */\n readonly ariaDescribedBy = input<string | undefined>(undefined);\n\n /** Per-editor image upload adapter, taking precedence over an injected adapter. */\n readonly imageUploader = input<MlvEditorImageUploader | undefined>(undefined);\n\n /** Image upload restrictions used by the later upload controls. */\n readonly imageUploadOptions = input<MlvEditorImageUploadOptions>(\n MLV_EDITOR_DEFAULT_IMAGE_UPLOAD_OPTIONS,\n );\n\n /**\n * Per-editor AI transport, taking precedence over an injected\n * `MLV_EDITOR_AI_PROVIDER`. Without either, AI UI modules hide and AI\n * commands report a recoverable `configuration` error.\n */\n readonly aiProvider = input<MlvEditorAiProvider | undefined>(undefined);\n\n /** Read-only signal exposing the one Tiptap editor instance after browser mount. */\n readonly editor = this._editor.asReadonly();\n\n /** Exact editor-owned image upload capability forwarded to public toolbars. */\n get imageUpload(): MlvEditorImageUploadControl {\n return this._injector.get(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR);\n }\n\n /** View-only zoom percentage shared with the nearest toolbar. */\n readonly zoom = signal(100);\n\n /** Whether the mounted editor currently accepts document mutations. */\n readonly editable = computed(\n () =>\n this._editor() !== null && !this.computedDisabled() && !this.readonly(),\n );\n\n /** Emits after the browser-only Tiptap editor has been created. */\n readonly editorReady = output<Editor>();\n\n /** Emits when focus enters the editable Tiptap content. */\n // The public API deliberately mirrors the documented editor focus event.\n // eslint-disable-next-line @angular-eslint/no-output-native\n readonly focus = output<MlvEditorFocusEvent>();\n\n /** Emits when focus leaves the editor composite. */\n // The public API deliberately mirrors the documented editor blur event.\n // eslint-disable-next-line @angular-eslint/no-output-native\n readonly blur = output<MlvEditorFocusEvent>();\n\n /** Emits Tiptap selection updates. */\n readonly selectionChange = output<MlvEditorSelectionChange>();\n\n /** Emits every Tiptap transaction. */\n readonly transaction = output<MlvEditorTransactionEvent>();\n\n /** Emits recoverable construction, parsing, and serialization errors. */\n readonly editorError = output<MlvEditorError>();\n\n /** Emits after an image upload succeeds. */\n readonly imageUploadSuccess = output<MlvEditorImageUploadSuccess>();\n\n /** Emits after an image upload fails. */\n readonly imageUploadFailure = output<MlvEditorImageUploadFailure>();\n\n /** Emits after an image upload is cancelled. */\n readonly imageUploadCancelled = output<MlvEditorImageUploadCancelled>();\n\n /** Whether the nullable model contains meaningful serialized content. */\n readonly hasValue = computed(() => this.value() !== null);\n\n /** @private Browser-only mount element for Tiptap's ProseMirror DOM. */\n private readonly _content =\n viewChild.required<ElementRef<HTMLDivElement>>('content');\n\n /**\n * @private Zoom-transformed layer the floating block handle is mounted into.\n *\n * Deliberately optional rather than `viewChild.required`: the block-handle\n * `mount` capability is typed `() => HTMLElement | null`, and the extension\n * may call it from a ProseMirror plugin view during a user interaction. A\n * required query throws `NG0951` while unresolved, which would surface as an\n * uncaught error rather than the absent mount the contract already allows.\n */\n private readonly _view = viewChild<ElementRef<HTMLDivElement>>('view');\n\n /** @protected Complete projected toolbar replacement, if the consumer provides one. */\n protected readonly _toolbarDefs = contentChildren(MlvEditorToolbarDef);\n\n /** @protected Projected controls displayed before the built-in toolbar groups. */\n protected readonly _toolbarStartDefs = contentChildren(\n MlvEditorToolbarStartDef,\n );\n\n /** @protected Projected controls displayed after the built-in toolbar groups. */\n protected readonly _toolbarEndDefs = contentChildren(MlvEditorToolbarEndDef);\n\n /** @protected Whether a consumer declared a complete toolbar replacement. */\n protected readonly _hasToolbarDef = computed(\n () => this._toolbarDefs().length > 0,\n );\n\n /** @protected Context supplied as the implicit value of projected toolbar templates. */\n protected readonly _toolbarContext: MlvEditorToolbarContext = this;\n\n /** @private Platform marker used to keep all editor construction out of SSR. */\n private readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** @private Teardown registration for the browser editor instance. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Registry for overlay roots logically owned by this composite control. */\n private readonly _overlayRegistry = inject(MlvEditorOverlayRegistry);\n\n /** @private Injector used after construction to resolve the editor coordinator safely. */\n private readonly _injector = inject(Injector);\n\n /** @private Invalidates built-in command state after Tiptap state changes. */\n private readonly _toolbarRevision = inject(MlvEditorToolbarRevision);\n\n /** @private Registry of in-flight upload abort callbacks. */\n private readonly _uploadAbortRegistry = inject(MlvEditorUploadAbortRegistry);\n\n /** @private Physical host used to determine the composite focus boundary. */\n private readonly _host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** @private Optional translated accessible defaults. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @private Announces block moves politely; the editor content itself is not a live region. */\n private readonly _liveAnnouncer = inject(LiveAnnouncer);\n\n /** @private Last external value applied to Tiptap without an update event. */\n private _lastAppliedValue: string | null | undefined;\n\n /** @private Last value emitted from a user transaction or format conversion. */\n private _lastEmittedValue: string | null | undefined;\n\n /** @private Active serialization mode for the current editor document. */\n private _activeFormat: MlvEditorFormat | undefined;\n\n /** @private Guards against duplicate Tiptap teardown. */\n private _destroyed = false;\n\n /** @private Suppresses document-transaction serialization while applying an external value. */\n private _applyingExternalValue = false;\n\n /** @private Tracks the disabled edge so overlays/uploads close once per transition. */\n private _wasDisabled = false;\n\n /** @private Tracks the readonly edge so uploads stop before they can mutate content. */\n private _wasReadonly = false;\n\n /** @private Text selection retained while ProseMirror is made non-editable. */\n private _disabledSelection: { from: number; to: number } | undefined;\n\n /** @private Stored marks retained with a collapsed selection while disabled. */\n private _disabledStoredMarks: readonly Mark[] | null | undefined;\n\n /** @private Avoids duplicate queued focus-leave checks. */\n private _blurCheckQueued = false;\n\n /** @private The last boundary event, retained until the microtask resolves focus ownership. */\n private _pendingBlurEvent: FocusEvent | undefined;\n\n /** @private Stable capture listener for focus entering the physical host. */\n private readonly _onHostFocusIn = (event: FocusEvent): void =>\n this._handleCompositeFocusIn(event);\n\n /** @private Stable capture listener for focus leaving the physical host. */\n private readonly _onHostFocusOut = (event: FocusEvent): void =>\n this._handleCompositeFocusOut(event);\n\n /** @private Stable capture listener that blocks disabled projected controls. */\n private readonly _onDisabledPointerOrClick = (event: Event): void =>\n this._blockDisabledInteraction(event);\n\n /** @private Stable capture listener that blocks disabled keyboard activation. */\n private readonly _onDisabledKeydown = (event: KeyboardEvent): void => {\n if (\n event.key !== 'Enter' &&\n event.key !== ' ' &&\n event.key !== 'Spacebar'\n ) {\n return;\n }\n this._blockDisabledInteraction(event);\n };\n\n /** @protected Fallback-accessible name when no visible label is supplied. */\n protected readonly _resolvedAriaLabel = computed(\n () => this.ariaLabel() ?? this._i18n?.().editorLabel ?? 'Rich text editor',\n );\n\n /** @protected Descriptions supplied explicitly or by the inherited validation message. */\n protected readonly _resolvedAriaDescribedBy = computed(\n () =>\n this.ariaDescribedBy() ??\n (this.message() ? `${this.id()}-message` : undefined),\n );\n\n /** @protected ID used to connect a visible inherited label to ProseMirror. */\n protected readonly _labelId = computed(() => `${this.id()}-label`);\n\n /** @protected Accessible label for the projected toolbar region. */\n protected readonly _toolbarAriaLabel = computed(\n () => this._i18n?.().toolbarLabel ?? 'Editor toolbar',\n );\n\n constructor() {\n super();\n\n effect(() => {\n const editor = this._editor();\n const disabled = this.computedDisabled();\n const readonly = this.readonly();\n const wasDisabled = this._wasDisabled;\n if (disabled && !wasDisabled) {\n this._disabledSelection = editor\n ? { from: editor.state.selection.from, to: editor.state.selection.to }\n : undefined;\n this._disabledStoredMarks = editor\n ? (editor.state.storedMarks ?? editor.state.selection.$from.marks())\n : undefined;\n this._removeCompositeFocusForDisabledState();\n this._overlayRegistry.closeAll();\n this._abortInFlightUploads();\n }\n this._wasDisabled = disabled;\n if (readonly && !this._wasReadonly) {\n this._abortInFlightUploads();\n }\n this._wasReadonly = readonly;\n\n if (!editor) return;\n editor.setEditable(!disabled && !readonly);\n if (!disabled && wasDisabled && this._disabledSelection) {\n editor.commands.setTextSelection(this._disabledSelection);\n if (this._disabledStoredMarks) {\n editor.view.dispatch(\n editor.state.tr.setStoredMarks(this._disabledStoredMarks),\n );\n }\n this._disabledSelection = undefined;\n this._disabledStoredMarks = undefined;\n }\n this._synchronizeContentSurfaceState(editor);\n });\n\n effect(() => this._synchronizeEditor());\n\n this._overlayRegistry.setFocusHandlers(\n (event) => this._handleCompositeFocusIn(event),\n (event) => this._handleCompositeFocusOut(event),\n );\n this._destroyRef.onDestroy(() => {\n this._destroyed = true;\n this._removeCompositeFocusForDisabledState();\n this._overlayRegistry.closeAll();\n this._abortInFlightUploads();\n this._overlayRegistry.destroy();\n this._destroyEditor();\n });\n }\n\n /** Creates the one Tiptap editor after Angular has rendered the mount element. */\n ngAfterViewInit(): void {\n if (!this._isBrowser || this._editor() || this._destroyed) return;\n this._bindCompositeFocusEvents();\n\n const initialFormat = this.format();\n const initialRawValue = this.value();\n const initialValue = normalizeEditorValue(initialRawValue);\n if (initialRawValue !== initialValue) {\n this._lastEmittedValue = initialValue;\n this.value.set(initialValue);\n }\n\n try {\n // A consumer array remains a literal replacement. Defaults are selected\n // once so preflight and Tiptap receive the identical extension objects.\n const selectedExtensions =\n this.extensions() ??\n mlvEditorDefaultExtensions({\n format: 'markdown',\n placeholder: this.placeholder(),\n characterLimit: this.characterLimit(),\n allowedMimeTypes: ['image/*'],\n fileHandlingEnabled: () => {\n if (this._destroyed || this.computedDisabled() || this.readonly()) {\n return false;\n }\n return this._injector\n .get(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR)\n .available();\n },\n acceptsMimeType: (mimeType) => this._acceptsImageMimeType(mimeType),\n onFiles: ({ files, source, position }) => {\n if (this._destroyed || this.computedDisabled() || this.readonly()) {\n return;\n }\n const acceptedImages = files.filter(\n (file) =>\n file.type.startsWith('image/') &&\n this._acceptsImageMimeType(file.type),\n );\n if (!acceptedImages.length) return;\n this._injector\n .get(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR)\n .start(acceptedImages, source, {\n ...(position === undefined ? {} : { position }),\n });\n },\n blockHandle: {\n mount: () => this._view()?.nativeElement ?? null,\n label: () => this._i18n?.().dragBlock ?? 'Drag block',\n enabled: () =>\n !this._destroyed && !this.computedDisabled() && !this.readonly(),\n announceMove: (move) => this._announceBlockMove(move),\n },\n });\n const preflight = preflightMlvEditorExtensions(\n selectedExtensions,\n initialFormat,\n );\n if (!preflight.ok) {\n this.editorError.emit(preflight.error);\n return;\n }\n\n const editor = new Editor({\n element: this._content().nativeElement,\n ...this._emptyDocumentOptions(initialFormat),\n // The factory itself deliberately adds Markdown only for `format:\n // 'markdown'`. The shell always keeps that capability so an in-place\n // switch between any two formats can serialize the existing document\n // without constructing a second editor. A supplied array remains\n // literal.\n extensions: selectedExtensions,\n editable: !this.computedDisabled() && !this.readonly(),\n enableContentCheck: true,\n editorProps: { attributes: this._editorAttributes() },\n onTransaction: ({ editor: changedEditor, transaction }) => {\n if (this._destroyed) return;\n this.transaction.emit({ editor: changedEditor, transaction });\n this._toolbarRevision.revision.update((revision) => revision + 1);\n if (transaction.docChanged && !this._applyingExternalValue) {\n this._serializeAndWrite(changedEditor, this.format());\n }\n },\n onSelectionUpdate: ({ editor: changedEditor, transaction }) => {\n if (this._destroyed) return;\n this.selectionChange.emit({ editor: changedEditor, transaction });\n this._toolbarRevision.revision.update((revision) => revision + 1);\n },\n onContentError: ({ error }) => {\n if (this._destroyed) return;\n this.editorError.emit({\n code: 'parse',\n message:\n 'Unable to parse the editor value with the configured extensions.',\n recoverable: true,\n cause: error,\n });\n },\n });\n\n this._activeFormat = initialFormat;\n this._lastAppliedValue = null;\n this._editor.set(editor);\n this._applyInitialValue(editor, initialValue, initialFormat);\n // Consumers may immediately issue commands from `editorReady`; emit only\n // after the initial model has either been applied or recovered from.\n this.editorReady.emit(editor);\n } catch (cause: unknown) {\n this.editorError.emit({\n code: 'configuration',\n message: 'Unable to create the editor with the configured extensions.',\n recoverable: true,\n cause,\n });\n }\n }\n\n /** Clears the document through Tiptap when the shared form wrapper is clearable. */\n clearValue(): void {\n if (this.computedDisabled() || this.readonly()) return;\n this._editor()?.commands.clearContent();\n }\n\n /** @private Formats a completed block move and announces it politely. */\n private _announceBlockMove(move: MlvEditorBlockMove): void {\n if (this._destroyed) return;\n const template = this._i18n?.().blockMoved;\n const message = template\n ? template\n .replace('{type}', move.type)\n .replace('{position}', String(move.position))\n .replace('{total}', String(move.total))\n : `Moved ${move.type} to position ${move.position} of ${move.total}`;\n this._liveAnnouncer.announce(message, 'polite');\n }\n\n /** @private Whether a browser MIME type matches the current coordinator options. */\n private _acceptsImageMimeType(mimeType: string): boolean {\n const normalizedMimeType = mimeType.trim().toLowerCase();\n if (!normalizedMimeType.startsWith('image/')) return false;\n return this.imageUploadOptions().accept.some((pattern) => {\n const normalizedPattern = pattern.trim().toLowerCase();\n if (normalizedPattern === '*/*') return true;\n if (normalizedPattern.endsWith('/*')) {\n return normalizedMimeType.startsWith(normalizedPattern.slice(0, -1));\n }\n return normalizedMimeType === normalizedPattern;\n });\n }\n\n /** Runs a Tiptap mutation command when the editor is available and editable. */\n run(command: (editor: Editor) => boolean): boolean {\n if (this.computedDisabled() || this.readonly()) return false;\n const editor = this._editor();\n if (!editor) return false;\n try {\n return command(editor) === true;\n } catch {\n return false;\n }\n }\n\n /** Checks a Tiptap command when the editor is available and editable. */\n can(command: (editor: Editor) => boolean): boolean {\n if (this.computedDisabled() || this.readonly()) return false;\n const editor = this._editor();\n if (!editor) return false;\n try {\n return command(editor) === true;\n } catch {\n return false;\n }\n }\n\n /** Safely reads a Tiptap active state without requiring a particular extension. */\n isActive(name: string, attributes?: Record<string, unknown>): boolean {\n this._toolbarRevision.revision();\n const editor = this._editor();\n if (!editor) return false;\n try {\n return editor.isActive(name, attributes);\n } catch {\n return false;\n }\n }\n\n /** Reports a typed recoverable error through the owning editor output. */\n reportError(error: MlvEditorError): void {\n this.editorError.emit(error);\n }\n\n /** @private Applies the current inputs to the already-created editor instance. */\n private _synchronizeEditor(): void {\n const editor = this._editor();\n if (!editor) return;\n\n const requestedFormat = this.format();\n editor.setOptions({\n editorProps: { attributes: this._editorAttributes() },\n });\n this._synchronizeContentSurfaceState(editor);\n const rawIncoming = this.value();\n const incoming = normalizeEditorValue(rawIncoming);\n // Tracked values were produced under the currently active format, so the\n // comparison runs in that format rather than the requested one. JSON is\n // compared structurally there; a host value that only reorders keys or\n // reflows whitespace describes the mounted document and is not an\n // external change.\n const trackedFormat = this._activeFormat ?? requestedFormat;\n const hasExternalValue =\n !editorValuesAreEquivalent(\n incoming,\n this._lastAppliedValue,\n trackedFormat,\n ) &&\n !editorValuesAreEquivalent(\n incoming,\n this._lastEmittedValue,\n trackedFormat,\n );\n\n if (this._activeFormat !== requestedFormat) {\n if (hasExternalValue) {\n if (requestedFormat === 'markdown' && !this._supportsMarkdown(editor)) {\n this._emitUnsupportedMarkdownError('configuration');\n return;\n }\n this._activeFormat = requestedFormat;\n this._applyExternalValue(editor, incoming, requestedFormat);\n return;\n }\n if (this._activeFormat !== undefined) {\n if (!this._supportsMarkdown(editor) && requestedFormat === 'markdown') {\n this._emitUnsupportedMarkdownError('configuration');\n return;\n }\n if (!this._serializeAndWrite(editor, requestedFormat)) return;\n }\n this._activeFormat = requestedFormat;\n }\n\n if (rawIncoming !== incoming) {\n this._lastEmittedValue = incoming;\n this.value.set(incoming);\n }\n if (!hasExternalValue) {\n this._lastAppliedValue = incoming;\n return;\n }\n\n this._applyExternalValue(editor, incoming, requestedFormat);\n }\n\n /** @private Applies an external value without reflecting it back through `onUpdate`. */\n private _applyExternalValue(\n editor: Editor,\n value: string | null,\n format: MlvEditorFormat,\n ): void {\n const prepared =\n value === null ? null : this._prepareContent(editor, value, format);\n if (prepared !== null && !prepared.ok) {\n this._recoverFromInvalidValue(prepared.cause);\n return;\n }\n\n try {\n this._applyingExternalValue = true;\n // External applications must stay invisible to user undo history:\n // Tiptap's setContent/clearContent never set `addToHistory`, so a bare\n // command would land the initial or programmatic document as an undoable\n // step whose undo empties the editor. The chain shares one transaction,\n // so the meta covers the whole application.\n if (prepared === null) {\n editor.chain().setMeta('addToHistory', false).clearContent(false).run();\n } else {\n editor\n .chain()\n .setMeta('addToHistory', false)\n .setContent(prepared.content, prepared.options)\n .run();\n }\n this._lastAppliedValue = value;\n this._lastEmittedValue = undefined;\n } catch (cause: unknown) {\n this._recoverFromInvalidValue(cause);\n } finally {\n this._applyingExternalValue = false;\n }\n }\n\n /**\n * @private Converts one nonempty external value into Tiptap content and\n * options.\n *\n * The branch is exhaustive over every format rather than special-casing one:\n * HTML is parsed from its own markup, Markdown declares its content type so\n * the Markdown manager parses it, and JSON is handed over as an\n * already-parsed document node because Tiptap reads any string argument as\n * HTML. A rejected JSON value carries its cause instead of a document.\n */\n private _prepareContent(\n editor: Editor,\n value: string,\n format: MlvEditorFormat,\n ): MlvEditorPreparedContent {\n switch (format) {\n case 'html':\n return {\n ok: true,\n content: value,\n options: { emitUpdate: false, errorOnInvalidContent: true },\n };\n case 'markdown':\n return {\n ok: true,\n content: value,\n options: {\n emitUpdate: false,\n errorOnInvalidContent: true,\n contentType: 'markdown',\n },\n };\n case 'json': {\n const parsed = parseEditorJsonDocument(\n value,\n editor.schema.topNodeType.name,\n );\n return parsed.ok\n ? {\n ok: true,\n content: parsed.document,\n options: { emitUpdate: false, errorOnInvalidContent: true },\n }\n : { ok: false, cause: parsed.cause };\n }\n }\n }\n\n /**\n * @private Construction options mounting an empty document for one format.\n *\n * Tiptap is always constructed against an empty document so every real\n * value travels the same strict parsing path. Markdown still declares its\n * content type here because the Markdown manager validates that declaration\n * against the supplied content before the first document is published. HTML\n * needs no declaration, and JSON never reaches Tiptap as a string at all.\n */\n private _emptyDocumentOptions(format: MlvEditorFormat): {\n readonly content: string;\n readonly contentType?: 'markdown';\n } {\n switch (format) {\n case 'html':\n return { content: '' };\n case 'markdown':\n return { content: '', contentType: 'markdown' };\n case 'json':\n return { content: '' };\n }\n }\n\n /** @private Restores the last valid value and reports a recoverable parse failure. */\n private _recoverFromInvalidValue(cause: unknown): void {\n const lastValidValue = this._lastAppliedValue ?? null;\n this._lastEmittedValue = lastValidValue;\n if (this.value() !== lastValidValue) {\n this.value.set(lastValidValue);\n }\n this.editorError.emit({\n code: 'parse',\n message:\n 'Unable to parse the editor value with the configured extensions.',\n recoverable: true,\n cause,\n });\n }\n\n /**\n * @private Serializes an editor transaction and writes only valid distinct\n * values.\n *\n * The distinctness check runs in the serialized format, so a JSON document\n * that differs from the model only by key order or whitespace is not\n * re-emitted. An emission therefore follows only a real user transaction or\n * an explicit format conversion.\n */\n private _serializeAndWrite(editor: Editor, format: MlvEditorFormat): boolean {\n const result = serializeEditorValue(editor, format);\n if (!result.ok) {\n this.editorError.emit(result.error);\n return false;\n }\n\n this._lastAppliedValue = result.value;\n this._lastEmittedValue = result.value;\n if (!editorValuesAreEquivalent(this.value(), result.value, format)) {\n this.value.set(result.value);\n }\n return true;\n }\n\n /**\n * @private Applies the initial model through the same strict parsing path as\n * later updates.\n *\n * Only Markdown has a capability requirement; HTML and JSON mount against\n * any valid extension set.\n */\n private _applyInitialValue(\n editor: Editor,\n value: string | null,\n format: MlvEditorFormat,\n ): void {\n switch (format) {\n case 'markdown':\n if (!this._supportsMarkdown(editor)) {\n this._emitUnsupportedMarkdownError('configuration');\n this._lastAppliedValue = null;\n this._lastEmittedValue = null;\n if (this.value() !== null) this.value.set(null);\n return;\n }\n break;\n case 'html':\n case 'json':\n break;\n }\n\n this._applyExternalValue(editor, value, format);\n }\n\n /** @private Whether the runtime editor exposes Tiptap Markdown serialization. */\n private _supportsMarkdown(editor: Editor): boolean {\n return typeof editor.getMarkdown === 'function';\n }\n\n /** @private Emits the stable unsupported-Markdown error without throwing through Angular. */\n private _emitUnsupportedMarkdownError(\n code: Extract<MlvEditorError['code'], 'configuration' | 'serialize'>,\n ): void {\n this.editorError.emit({\n code,\n message:\n 'Markdown requires the configured extensions to include Tiptap Markdown.',\n recoverable: true,\n });\n }\n\n /** @private Builds the exact accessible attributes assigned to Tiptap's contenteditable root. */\n private _editorAttributes(): Record<string, string> {\n const attributes: Record<string, string> = {\n id: this.id(),\n role: 'textbox',\n 'aria-multiline': 'true',\n };\n\n const labelledBy = this.ariaLabelledBy();\n if (labelledBy) {\n attributes['aria-labelledby'] = labelledBy;\n } else if (this.ariaLabel()) {\n attributes['aria-label'] = this._resolvedAriaLabel();\n } else if (this.label()) {\n attributes['aria-labelledby'] = this._labelId();\n } else {\n attributes['aria-label'] = this._resolvedAriaLabel();\n }\n\n const describedBy = this._resolvedAriaDescribedBy();\n if (describedBy) {\n attributes['aria-describedby'] = describedBy;\n }\n\n if (this.resolvedState() === 'error') {\n attributes['aria-invalid'] = 'true';\n }\n\n if (this.computedDisabled()) {\n attributes['aria-disabled'] = 'true';\n attributes['tabindex'] = '-1';\n } else {\n attributes['tabindex'] = '0';\n }\n\n if (this.readonly()) {\n attributes['aria-readonly'] = 'true';\n }\n\n return attributes;\n }\n\n /** @internal Capture handler for focus entering the host or an owned overlay root. */\n _handleCompositeFocusIn(event: FocusEvent): void {\n if (this._destroyed || this.computedDisabled() || this.focused()) return;\n const editor = this._editor();\n if (!editor) return;\n this.setFocused(true);\n this.focus.emit({ editor, event });\n }\n\n /** @internal Capture handler for focus leaving the host or an owned overlay root. */\n _handleCompositeFocusOut(event: FocusEvent): void {\n if (this._destroyed || !this.focused()) return;\n this._pendingBlurEvent = event;\n if (this._blurCheckQueued) return;\n this._blurCheckQueued = true;\n queueMicrotask(() => {\n this._blurCheckQueued = false;\n const pendingEvent = this._pendingBlurEvent;\n this._pendingBlurEvent = undefined;\n if (\n !pendingEvent ||\n this._destroyed ||\n this._isFocusInsideComposite(pendingEvent.relatedTarget)\n ) {\n return;\n }\n const editor = this._editor();\n if (!editor) return;\n this.setFocused(false);\n this._markTouched();\n this.blur.emit({ editor, event: pendingEvent });\n });\n }\n\n /** @private Whether the browser's current focus remains in the host or an owned overlay. */\n private _isFocusInsideComposite(relatedTarget: EventTarget | null): boolean {\n if (typeof Node !== 'undefined' && relatedTarget instanceof Node) {\n return this._isOwnedFocusNode(relatedTarget);\n }\n if (typeof document === 'undefined') return false;\n return this._isOwnedFocusNode(document.activeElement);\n }\n\n /** @private Whether a node belongs to the physical shell or an owned overlay. */\n private _isOwnedFocusNode(node: Node | null): boolean {\n return (\n node !== null &&\n (this._host.nativeElement.contains(node) ||\n this._overlayRegistry.contains(node))\n );\n }\n\n /** @private Installs native capture listeners because overlay focus is outside Angular's view tree. */\n private _bindCompositeFocusEvents(): void {\n const host = this._host.nativeElement;\n host.addEventListener('focusin', this._onHostFocusIn, true);\n host.addEventListener('focusout', this._onHostFocusOut, true);\n host.addEventListener('pointerdown', this._onDisabledPointerOrClick, true);\n host.addEventListener('click', this._onDisabledPointerOrClick, true);\n host.addEventListener('keydown', this._onDisabledKeydown, true);\n this._destroyRef.onDestroy(() => {\n host.removeEventListener('focusin', this._onHostFocusIn, true);\n host.removeEventListener('focusout', this._onHostFocusOut, true);\n host.removeEventListener(\n 'pointerdown',\n this._onDisabledPointerOrClick,\n true,\n );\n host.removeEventListener('click', this._onDisabledPointerOrClick, true);\n host.removeEventListener('keydown', this._onDisabledKeydown, true);\n });\n }\n\n /** @private Stops all pointer/click/activation-key command surfaces while disabled. */\n private _blockDisabledInteraction(event: Event): void {\n if (!this.computedDisabled()) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n\n /** @private Removes browser focus when the composite becomes disabled without marking it touched. */\n private _removeCompositeFocusForDisabledState(): void {\n if (typeof document === 'undefined' || typeof HTMLElement === 'undefined') {\n return;\n }\n const activeElement = document.activeElement;\n if (\n !(activeElement instanceof HTMLElement) ||\n !this._isOwnedFocusNode(activeElement)\n ) {\n return;\n }\n this.setFocused(false);\n activeElement.blur();\n }\n\n /** @private Keeps the real ProseMirror root in sync with dynamic ARIA/tabindex state. */\n private _synchronizeContentSurfaceState(editor: Editor): void {\n const element = editor.view.dom as HTMLElement;\n const attributes = this._editorAttributes();\n const managedAttributes = [\n 'aria-disabled',\n 'aria-readonly',\n 'tabindex',\n 'aria-invalid',\n ];\n for (const name of managedAttributes) {\n const value = attributes[name];\n if (value === undefined) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value);\n }\n }\n }\n\n /** @private Aborts registered upload work while preserving the document/editor instance. */\n private _abortInFlightUploads(): void {\n this._uploadAbortRegistry.abortAll();\n }\n\n /** @private Destroys the owned Tiptap editor exactly once. */\n private _destroyEditor(): void {\n const editor = this._editor();\n if (!editor) return;\n this._editor.set(null);\n editor?.destroy();\n }\n}\n","<mlv-form-control-wrapper (clear)=\"clearValue()\">\n @if (label() || hint()) {\n <mlv-label [for]=\"id()\" [id]=\"_labelId()\">\n {{ label() }} @if (hint()) {\n <mlv-hint>{{ hint() }}</mlv-hint>\n }\n </mlv-label>\n }\n\n <ng-template mlvFormControlWrapperControl>\n <div class=\"mlv-editor__surface\">\n <div\n mlvEditorToolbarRoot\n #toolbarRoot=\"mlvEditorToolbarRoot\"\n class=\"mlv-editor__toolbar\"\n [ariaLabel]=\"_toolbarAriaLabel()\"\n [disabled]=\"computedDisabled()\"\n >\n @if (_hasToolbarDef()) {\n <ng-content select=\"[mlvEditorToolbar]\" />\n @for (definition of _toolbarDefs(); track definition) { @if\n (definition.templateRef; as toolbarTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: _toolbarContext }\"\n />\n } } } @else {\n <ng-content select=\"[mlvEditorToolbarStart]\" />\n @for (definition of _toolbarStartDefs(); track definition) { @if\n (definition.templateRef; as startTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"startTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: _toolbarContext }\"\n />\n } }\n <div mlvFade class=\"mlv-editor__toolbar-scroll\">\n <mlv-toolbar>\n <mlv-editor-undo-redo />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n />\n <mlv-editor-zoom />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n />\n <mlv-editor-heading />\n <mlv-editor-list />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-inline-marks [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-text-color />\n <mlv-editor-highlight />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-alignment [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-link />\n <mlv-editor-table />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-block-insert [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-image-upload />\n </mlv-toolbar>\n </div>\n <mlv-editor-toolbar-overflow />\n @for (definition of _toolbarEndDefs(); track definition) { @if\n (definition.templateRef; as endTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"endTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: _toolbarContext }\"\n />\n } }\n <ng-content select=\"[mlvEditorToolbarEnd]\" />\n }\n </div>\n\n <div class=\"mlv-editor__viewport\">\n <div #view class=\"mlv-editor__view\">\n <div #content class=\"mlv-editor__content\"></div>\n </div>\n </div>\n <mlv-editor-image-upload-status />\n </div>\n </ng-template>\n\n @if (message()) {\n <mlv-message [state]=\"resolvedState()\" [id]=\"id() + '-message'\">\n {{ message() }}\n </mlv-message>\n }\n</mlv-form-control-wrapper>\n\n<div\n class=\"mlv-editor__status\"\n [attr.aria-disabled]=\"computedDisabled() || null\"\n>\n <ng-content select=\"[mlvEditorStatus]\" />\n <mlv-spacer />\n <mlv-editor-status [characterLimit]=\"characterLimit()\" />\n</div>\n"]}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { findDuplicates, flattenExtensions, getExtensionField, } from '@tiptap/core';
|
|
2
|
-
import { Markdown } from '@tiptap/markdown';
|
|
3
|
-
/** @internal Resolves one public extension field without invoking it. */
|
|
4
|
-
function hasFunctionField(extension, field) {
|
|
5
|
-
return (typeof getExtensionField(extension, field, {
|
|
6
|
-
name: extension.name,
|
|
7
|
-
options: extension.options,
|
|
8
|
-
storage: extension.storage,
|
|
9
|
-
}) === 'function');
|
|
10
|
-
}
|
|
11
|
-
/** @internal Official hook names whose identities establish Markdown provenance. */
|
|
12
|
-
const OFFICIAL_MARKDOWN_HOOKS = [
|
|
13
|
-
'addCommands',
|
|
14
|
-
'addStorage',
|
|
15
|
-
'onBeforeCreate',
|
|
16
|
-
];
|
|
17
|
-
/** @internal Whether this extension or a public parent carries all official Markdown hooks. */
|
|
18
|
-
function hasOfficialMarkdownLineage(extension) {
|
|
19
|
-
let candidate = extension;
|
|
20
|
-
while (candidate) {
|
|
21
|
-
if (OFFICIAL_MARKDOWN_HOOKS.every((field) => candidate?.config[field] === Markdown.config[field])) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
candidate = candidate.parent;
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
/** @internal Checks that a same-name extension exposes the official Markdown integration. */
|
|
29
|
-
function supportsMarkdown(extension) {
|
|
30
|
-
return (extension.name === 'markdown' &&
|
|
31
|
-
hasOfficialMarkdownLineage(extension) &&
|
|
32
|
-
hasFunctionField(extension, 'addCommands') &&
|
|
33
|
-
hasFunctionField(extension, 'addStorage') &&
|
|
34
|
-
hasFunctionField(extension, 'onBeforeCreate'));
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @internal Flattens and validates the exact extension set before Tiptap can
|
|
38
|
-
* warn, create schema state, or publish an editor instance.
|
|
39
|
-
*
|
|
40
|
-
* Only Markdown imposes an extension requirement. HTML is served by Tiptap's
|
|
41
|
-
* own DOM serializer and JSON by the ProseMirror document, so both pass with
|
|
42
|
-
* any otherwise valid extension set.
|
|
43
|
-
*/
|
|
44
|
-
export function preflightMlvEditorExtensions(extensions, initialFormat) {
|
|
45
|
-
try {
|
|
46
|
-
const flattened = flattenExtensions(extensions);
|
|
47
|
-
const duplicates = findDuplicates(flattened.map((extension) => extension.name));
|
|
48
|
-
if (duplicates.length > 0) {
|
|
49
|
-
return {
|
|
50
|
-
ok: false,
|
|
51
|
-
error: {
|
|
52
|
-
code: 'configuration',
|
|
53
|
-
message: `Duplicate Tiptap extension names: ${duplicates.join(', ')}.`,
|
|
54
|
-
recoverable: false,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
if (initialFormat === 'markdown' &&
|
|
59
|
-
!flattened.some((extension) => supportsMarkdown(extension))) {
|
|
60
|
-
return {
|
|
61
|
-
ok: false,
|
|
62
|
-
error: {
|
|
63
|
-
code: 'configuration',
|
|
64
|
-
message: 'Initial Markdown content requires the official Tiptap Markdown extension.',
|
|
65
|
-
recoverable: false,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return { ok: true };
|
|
70
|
-
}
|
|
71
|
-
catch (cause) {
|
|
72
|
-
return {
|
|
73
|
-
ok: false,
|
|
74
|
-
error: {
|
|
75
|
-
code: 'configuration',
|
|
76
|
-
message: 'Unable to compose the configured Tiptap extensions.',
|
|
77
|
-
recoverable: false,
|
|
78
|
-
cause,
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=editor-extension-preflight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-extension-preflight.js","sourceRoot":"","sources":["../../../../../libs/editor/src/lib/editor-extension-preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAGlB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAmB5C,yEAAyE;AACzE,SAAS,gBAAgB,CACvB,SAAuB,EACvB,KAAsD;IAEtD,OAAO,CACL,OAAO,iBAAiB,CAAC,SAAS,EAAE,KAAK,EAAE;QACzC,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,OAAO,EAAE,SAAS,CAAC,OAAO;KAC3B,CAAC,KAAK,UAAU,CAClB,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,uBAAuB,GAAG;IAC9B,aAAa;IACb,YAAY;IACZ,gBAAgB;CACR,CAAC;AAEX,+FAA+F;AAC/F,SAAS,0BAA0B,CAAC,SAAuB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C,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAC3D,CAAC;YACD,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE;oBACL,IAAI,EAAE,eAAe;oBACrB,OAAO,EACL,2EAA2E;oBAC7E,WAAW,EAAE,KAAK;iBACnB;aACF,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,qDAAqD;gBAC9D,WAAW,EAAE,KAAK;gBAClB,KAAK;aACN;SACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import {\n findDuplicates,\n flattenExtensions,\n getExtensionField,\n type AnyExtension,\n type Extensions,\n} from '@tiptap/core';\nimport { Markdown } from '@tiptap/markdown';\nimport type { MlvEditorError, MlvEditorFormat } from './editor.types';\n\n/** @internal Successful validation of the exact extension array selected by the editor. */\ninterface MlvEditorExtensionPreflightSuccess {\n readonly ok: true;\n}\n\n/** @internal Deterministic configuration failure discovered before editor construction. */\ninterface MlvEditorExtensionPreflightFailure {\n readonly ok: false;\n readonly error: MlvEditorError;\n}\n\n/** @internal Result of validating a literal/default extension composition. */\ntype MlvEditorExtensionPreflightResult =\n | MlvEditorExtensionPreflightSuccess\n | MlvEditorExtensionPreflightFailure;\n\n/** @internal Resolves one public extension field without invoking it. */\nfunction hasFunctionField(\n extension: AnyExtension,\n field: 'addCommands' | 'addStorage' | 'onBeforeCreate',\n): boolean {\n return (\n typeof getExtensionField(extension, field, {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }) === 'function'\n );\n}\n\n/** @internal Official hook names whose identities establish Markdown provenance. */\nconst OFFICIAL_MARKDOWN_HOOKS = [\n 'addCommands',\n 'addStorage',\n 'onBeforeCreate',\n] as const;\n\n/** @internal Whether this extension or a public parent carries all official Markdown hooks. */\nfunction hasOfficialMarkdownLineage(extension: AnyExtension): boolean {\n let candidate: AnyExtension | null = extension;\n while (candidate) {\n if (\n OFFICIAL_MARKDOWN_HOOKS.every(\n (field) => candidate?.config[field] === Markdown.config[field],\n )\n ) {\n return true;\n }\n candidate = candidate.parent as AnyExtension | null;\n }\n return false;\n}\n\n/** @internal Checks that a same-name extension exposes the official Markdown integration. */\nfunction supportsMarkdown(extension: AnyExtension): boolean {\n return (\n extension.name === 'markdown' &&\n hasOfficialMarkdownLineage(extension) &&\n hasFunctionField(extension, 'addCommands') &&\n hasFunctionField(extension, 'addStorage') &&\n hasFunctionField(extension, 'onBeforeCreate')\n );\n}\n\n/**\n * @internal Flattens and validates the exact extension set before Tiptap can\n * warn, create schema state, or publish an editor instance.\n *\n * Only Markdown imposes an extension requirement. HTML is served by Tiptap's\n * own DOM serializer and JSON by the ProseMirror document, so both pass with\n * any otherwise valid extension set.\n */\nexport function preflightMlvEditorExtensions(\n extensions: Extensions,\n initialFormat: MlvEditorFormat,\n): MlvEditorExtensionPreflightResult {\n try {\n const flattened = flattenExtensions(extensions);\n const duplicates = findDuplicates(\n flattened.map((extension) => extension.name),\n );\n if (duplicates.length > 0) {\n return {\n ok: false,\n error: {\n code: 'configuration',\n message: `Duplicate Tiptap extension names: ${duplicates.join(', ')}.`,\n recoverable: false,\n },\n };\n }\n if (\n initialFormat === 'markdown' &&\n !flattened.some((extension) => supportsMarkdown(extension))\n ) {\n return {\n ok: false,\n error: {\n code: 'configuration',\n message:\n 'Initial Markdown content requires the official Tiptap Markdown extension.',\n recoverable: false,\n },\n };\n }\n return { ok: true };\n } catch (cause: unknown) {\n return {\n ok: false,\n error: {\n code: 'configuration',\n message: 'Unable to compose the configured Tiptap extensions.',\n recoverable: false,\n cause,\n },\n };\n }\n}\n"]}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts only null, empty, and whitespace-only external values to the
|
|
3
|
-
* library's nullable empty representation. Structural markup is deliberately
|
|
4
|
-
* preserved so Tiptap can determine semantic emptiness from its parsed schema.
|
|
5
|
-
*
|
|
6
|
-
* The rule is format-agnostic: an empty or whitespace-only JSON value is the
|
|
7
|
-
* same nullable empty document as an empty HTML or Markdown value, because no
|
|
8
|
-
* amount of surrounding whitespace describes a document.
|
|
9
|
-
*/
|
|
10
|
-
export function normalizeEditorValue(value) {
|
|
11
|
-
return value === null || value.trim().length === 0 ? null : value;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Validates an external JSON value as a document node for the active schema.
|
|
15
|
-
*
|
|
16
|
-
* Tiptap reads a string argument as HTML, so a JSON value must be parsed here
|
|
17
|
-
* before it can be applied. Malformed JSON, arrays, scalars, objects without a
|
|
18
|
-
* `type`, and nodes that are not the schema's top node are all rejected with
|
|
19
|
-
* the originating cause rather than mounted as a structurally invalid
|
|
20
|
-
* document. Node types absent from the active schema are rejected later by
|
|
21
|
-
* Tiptap itself, so a schema mismatch can never silently drop content.
|
|
22
|
-
*
|
|
23
|
-
* @param value External JSON string supplied by the host.
|
|
24
|
-
* @param topNodeName Name of the active schema's top node, usually `doc`.
|
|
25
|
-
* @returns The parsed document node, or the cause of its rejection.
|
|
26
|
-
*/
|
|
27
|
-
export function parseEditorJsonDocument(value, topNodeName) {
|
|
28
|
-
let parsed;
|
|
29
|
-
try {
|
|
30
|
-
parsed = JSON.parse(value);
|
|
31
|
-
}
|
|
32
|
-
catch (cause) {
|
|
33
|
-
return { ok: false, cause };
|
|
34
|
-
}
|
|
35
|
-
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
36
|
-
return {
|
|
37
|
-
ok: false,
|
|
38
|
-
cause: new TypeError('Editor JSON content must be a single ProseMirror document node.'),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const type = parsed.type;
|
|
42
|
-
if (type !== topNodeName) {
|
|
43
|
-
return {
|
|
44
|
-
ok: false,
|
|
45
|
-
cause: new TypeError(`Editor JSON content must be a "${topNodeName}" node, received ${typeof type === 'string' ? `"${type}"` : String(type)}.`),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return { ok: true, document: parsed };
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Whether two external values describe the same document in one format.
|
|
52
|
-
*
|
|
53
|
-
* HTML and Markdown keep exact string identity, where every textual difference
|
|
54
|
-
* is a real content difference. JSON is compared structurally instead:
|
|
55
|
-
* `JSON.stringify` preserves key insertion order, so a host-supplied document
|
|
56
|
-
* and its canonical re-serialization are frequently unequal as strings while
|
|
57
|
-
* describing the identical document. Treating that as a change would either
|
|
58
|
-
* re-mount the document on every change-detection pass or emit a value the
|
|
59
|
-
* user never typed.
|
|
60
|
-
*
|
|
61
|
-
* @param value External or serialized value being examined.
|
|
62
|
-
* @param tracked Value previously applied or emitted; `undefined` never matches.
|
|
63
|
-
* @param format Format both values were produced in.
|
|
64
|
-
*/
|
|
65
|
-
export function editorValuesAreEquivalent(value, tracked, format) {
|
|
66
|
-
if (value === tracked)
|
|
67
|
-
return true;
|
|
68
|
-
if (format !== 'json')
|
|
69
|
-
return false;
|
|
70
|
-
if (typeof value !== 'string' || typeof tracked !== 'string')
|
|
71
|
-
return false;
|
|
72
|
-
try {
|
|
73
|
-
return jsonValuesAreEqual(JSON.parse(value), JSON.parse(tracked));
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/** @internal Order-independent structural comparison of two parsed JSON values. */
|
|
80
|
-
function jsonValuesAreEqual(value, other) {
|
|
81
|
-
if (value === other)
|
|
82
|
-
return true;
|
|
83
|
-
if (Array.isArray(value) || Array.isArray(other)) {
|
|
84
|
-
return (Array.isArray(value) &&
|
|
85
|
-
Array.isArray(other) &&
|
|
86
|
-
value.length === other.length &&
|
|
87
|
-
value.every((item, index) => jsonValuesAreEqual(item, other[index])));
|
|
88
|
-
}
|
|
89
|
-
if (typeof value !== 'object' ||
|
|
90
|
-
typeof other !== 'object' ||
|
|
91
|
-
value === null ||
|
|
92
|
-
other === null) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
const record = value;
|
|
96
|
-
const otherRecord = other;
|
|
97
|
-
const keys = Object.keys(record);
|
|
98
|
-
return (keys.length === Object.keys(otherRecord).length &&
|
|
99
|
-
keys.every((key) => Object.prototype.hasOwnProperty.call(otherRecord, key) &&
|
|
100
|
-
jsonValuesAreEqual(record[key], otherRecord[key])));
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Serializes a Tiptap editor without leaking serialization exceptions to its
|
|
104
|
-
* Angular caller. A failed result carries no replacement value, allowing the
|
|
105
|
-
* caller to keep its last valid value.
|
|
106
|
-
*
|
|
107
|
-
* Semantic emptiness is determined by the parsed document rather than by
|
|
108
|
-
* serialized text, so every format returns the same nullable empty value for
|
|
109
|
-
* an empty document.
|
|
110
|
-
*/
|
|
111
|
-
export function serializeEditorValue(editor, format) {
|
|
112
|
-
try {
|
|
113
|
-
if (editor.isEmpty) {
|
|
114
|
-
return { ok: true, value: null };
|
|
115
|
-
}
|
|
116
|
-
const value = serializeDocument(editor, format);
|
|
117
|
-
if (value.trim().length === 0) {
|
|
118
|
-
return {
|
|
119
|
-
ok: false,
|
|
120
|
-
error: {
|
|
121
|
-
code: 'serialize',
|
|
122
|
-
message: 'Unable to serialize editor content.',
|
|
123
|
-
recoverable: true,
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
return { ok: true, value };
|
|
128
|
-
}
|
|
129
|
-
catch (cause) {
|
|
130
|
-
return {
|
|
131
|
-
ok: false,
|
|
132
|
-
error: {
|
|
133
|
-
code: 'serialize',
|
|
134
|
-
message: 'Unable to serialize editor content.',
|
|
135
|
-
recoverable: true,
|
|
136
|
-
cause,
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/** @internal Exhaustive per-format serializer for a nonempty document. */
|
|
142
|
-
function serializeDocument(editor, format) {
|
|
143
|
-
switch (format) {
|
|
144
|
-
case 'html':
|
|
145
|
-
return editor.getHTML();
|
|
146
|
-
case 'markdown':
|
|
147
|
-
return editor.getMarkdown();
|
|
148
|
-
case 'json':
|
|
149
|
-
return JSON.stringify(editor.getJSON());
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=editor-serialization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-serialization.js","sourceRoot":"","sources":["../../../../../libs/editor/src/lib/editor-serialization.ts"],"names":[],"mappings":"AA8BA;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAoB;IACvD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACpE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAa,EACb,WAAmB;IAEnB,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,IAAI,SAAS,CAClB,iEAAiE,CAClE;SACF,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAI,MAAsC,CAAC,IAAI,CAAC;IAC1D,IAAI,IAAI,KAAK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AE,IAAI;iBAClB;aACF,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,qCAAqC;gBAC9C,WAAW,EAAE,IAAI;gBACjB,KAAK;aACN;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,SAAS,iBAAiB,CACxB,MAA6B,EAC7B,MAAuB;IAEvB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC;QAC1B,KAAK,UAAU;YACb,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC;QAC9B,KAAK,MAAM;YACT,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC","sourcesContent":["import type { Editor, JSONContent } from '@tiptap/core';\nimport type {} from '@tiptap/markdown';\nimport type { MlvEditorError, MlvEditorFormat } from './editor.types';\n\ntype MlvEditorSerializable = Pick<\n Editor,\n 'getHTML' | 'getMarkdown' | 'getJSON' | 'isEmpty'\n>;\n\ntype MlvEditorSerializationResult =\n | { readonly ok: true; readonly value: string | null }\n | { readonly ok: false; readonly error: MlvEditorError };\n\n/** @internal An external JSON value accepted as a document node. */\ninterface MlvEditorJsonParseSuccess {\n readonly ok: true;\n readonly document: JSONContent;\n}\n\n/** @internal An external JSON value rejected before it can reach Tiptap. */\ninterface MlvEditorJsonParseFailure {\n readonly ok: false;\n readonly cause: unknown;\n}\n\n/** @internal Result of validating one external JSON value. */\ntype MlvEditorJsonParseResult =\n | MlvEditorJsonParseSuccess\n | MlvEditorJsonParseFailure;\n\n/**\n * Converts only null, empty, and whitespace-only external values to the\n * library's nullable empty representation. Structural markup is deliberately\n * preserved so Tiptap can determine semantic emptiness from its parsed schema.\n *\n * The rule is format-agnostic: an empty or whitespace-only JSON value is the\n * same nullable empty document as an empty HTML or Markdown value, because no\n * amount of surrounding whitespace describes a document.\n */\nexport function normalizeEditorValue(value: string | null): string | null {\n return value === null || value.trim().length === 0 ? null : value;\n}\n\n/**\n * Validates an external JSON value as a document node for the active schema.\n *\n * Tiptap reads a string argument as HTML, so a JSON value must be parsed here\n * before it can be applied. Malformed JSON, arrays, scalars, objects without a\n * `type`, and nodes that are not the schema's top node are all rejected with\n * the originating cause rather than mounted as a structurally invalid\n * document. Node types absent from the active schema are rejected later by\n * Tiptap itself, so a schema mismatch can never silently drop content.\n *\n * @param value External JSON string supplied by the host.\n * @param topNodeName Name of the active schema's top node, usually `doc`.\n * @returns The parsed document node, or the cause of its rejection.\n */\nexport function parseEditorJsonDocument(\n value: string,\n topNodeName: string,\n): MlvEditorJsonParseResult {\n let parsed: unknown;\n try {\n parsed = JSON.parse(value);\n } catch (cause: unknown) {\n return { ok: false, cause };\n }\n\n if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return {\n ok: false,\n cause: new TypeError(\n 'Editor JSON content must be a single ProseMirror document node.',\n ),\n };\n }\n\n const type = (parsed as { readonly type?: unknown }).type;\n if (type !== topNodeName) {\n return {\n ok: false,\n cause: new TypeError(\n `Editor JSON content must be a \"${topNodeName}\" node, received ${\n typeof type === 'string' ? `\"${type}\"` : String(type)\n }.`,\n ),\n };\n }\n\n return { ok: true, document: parsed as JSONContent };\n}\n\n/**\n * Whether two external values describe the same document in one format.\n *\n * HTML and Markdown keep exact string identity, where every textual difference\n * is a real content difference. JSON is compared structurally instead:\n * `JSON.stringify` preserves key insertion order, so a host-supplied document\n * and its canonical re-serialization are frequently unequal as strings while\n * describing the identical document. Treating that as a change would either\n * re-mount the document on every change-detection pass or emit a value the\n * user never typed.\n *\n * @param value External or serialized value being examined.\n * @param tracked Value previously applied or emitted; `undefined` never matches.\n * @param format Format both values were produced in.\n */\nexport function editorValuesAreEquivalent(\n value: string | null,\n tracked: string | null | undefined,\n format: MlvEditorFormat,\n): boolean {\n if (value === tracked) return true;\n if (format !== 'json') return false;\n if (typeof value !== 'string' || typeof tracked !== 'string') return false;\n\n try {\n return jsonValuesAreEqual(JSON.parse(value), JSON.parse(tracked));\n } catch {\n return false;\n }\n}\n\n/** @internal Order-independent structural comparison of two parsed JSON values. */\nfunction jsonValuesAreEqual(value: unknown, other: unknown): boolean {\n if (value === other) return true;\n if (Array.isArray(value) || Array.isArray(other)) {\n return (\n Array.isArray(value) &&\n Array.isArray(other) &&\n value.length === other.length &&\n value.every((item, index) => jsonValuesAreEqual(item, other[index]))\n );\n }\n if (\n typeof value !== 'object' ||\n typeof other !== 'object' ||\n value === null ||\n other === null\n ) {\n return false;\n }\n\n const record = value as Record<string, unknown>;\n const otherRecord = other as Record<string, unknown>;\n const keys = Object.keys(record);\n return (\n keys.length === Object.keys(otherRecord).length &&\n keys.every(\n (key) =>\n Object.prototype.hasOwnProperty.call(otherRecord, key) &&\n jsonValuesAreEqual(record[key], otherRecord[key]),\n )\n );\n}\n\n/**\n * Serializes a Tiptap editor without leaking serialization exceptions to its\n * Angular caller. A failed result carries no replacement value, allowing the\n * caller to keep its last valid value.\n *\n * Semantic emptiness is determined by the parsed document rather than by\n * serialized text, so every format returns the same nullable empty value for\n * an empty document.\n */\nexport function serializeEditorValue(\n editor: MlvEditorSerializable,\n format: MlvEditorFormat,\n): MlvEditorSerializationResult {\n try {\n if (editor.isEmpty) {\n return { ok: true, value: null };\n }\n\n const value = serializeDocument(editor, format);\n\n if (value.trim().length === 0) {\n return {\n ok: false,\n error: {\n code: 'serialize',\n message: 'Unable to serialize editor content.',\n recoverable: true,\n },\n };\n }\n\n return { ok: true, value };\n } catch (cause: unknown) {\n return {\n ok: false,\n error: {\n code: 'serialize',\n message: 'Unable to serialize editor content.',\n recoverable: true,\n cause,\n },\n };\n }\n}\n\n/** @internal Exhaustive per-format serializer for a nonempty document. */\nfunction serializeDocument(\n editor: MlvEditorSerializable,\n format: MlvEditorFormat,\n): string {\n switch (format) {\n case 'html':\n return editor.getHTML();\n case 'markdown':\n return editor.getMarkdown();\n case 'json':\n return JSON.stringify(editor.getJSON());\n }\n}\n"]}
|