@eigenpal/docx-editor-react 1.1.0 → 1.2.1

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/dist/index.d.mts CHANGED
@@ -26,9 +26,9 @@ import { R as ReactSidebarItem } from './types-D35gNE-_.mjs';
26
26
  import { Comment } from '@eigenpal/docx-editor-core/types/content';
27
27
  import { Translations, TFunction } from '@eigenpal/docx-editor-i18n';
28
28
  import { P as PrintOptions } from './PrintPreview-DEhwRBC_.mjs';
29
- import { DocumentAgent } from '@eigenpal/docx-editor-core/agent';
29
+ import { DocumentAgent, ContentControlFilter, ContentControlValue } from '@eigenpal/docx-editor-core/agent';
30
30
  import { DocxInput, FontDefinition } from '@eigenpal/docx-editor-core/utils';
31
- import { SelectionState } from '@eigenpal/docx-editor-core/prosemirror';
31
+ import { SelectionState, PMContentControl } from '@eigenpal/docx-editor-core/prosemirror';
32
32
  import { Layout } from '@eigenpal/docx-editor-core/layout-engine';
33
33
  import { RenderedDomContext } from '@eigenpal/docx-editor-core/plugin-api';
34
34
  import { EditorHandle } from '@eigenpal/docx-editor-core';
@@ -462,6 +462,41 @@ interface DocxEditorRef {
462
462
  } | null;
463
463
  /** Get all comments. */
464
464
  getComments: () => Comment[];
465
+ /**
466
+ * List block-level content controls (SDTs) in the live document, optionally
467
+ * filtered by `tag`/`alias`/`id`/`type`. Each result includes the control's
468
+ * text and PM position. Anchors for templates and document automation.
469
+ */
470
+ getContentControls: (filter?: ContentControlFilter) => PMContentControl[];
471
+ /** Scroll the first content control matching `filter` into view. Returns false if none. */
472
+ scrollToContentControl: (filter: ContentControlFilter) => boolean;
473
+ /**
474
+ * Replace the content of the first control matching `filter` with `text`
475
+ * (newlines become paragraphs). Returns false if no match. Throws if the
476
+ * control is content-locked unless `{ force: true }`.
477
+ */
478
+ setContentControlContent: (filter: ContentControlFilter, text: string, options?: {
479
+ force?: boolean;
480
+ }) => boolean;
481
+ /**
482
+ * Remove the first control matching `filter`. With `{ keepContent: true }`
483
+ * the inner blocks are unwrapped in place. Returns false if no match. Throws
484
+ * if the control is deletion-locked unless `{ force: true }`.
485
+ */
486
+ removeContentControl: (filter: ContentControlFilter, options?: {
487
+ force?: boolean;
488
+ keepContent?: boolean;
489
+ }) => boolean;
490
+ /**
491
+ * Set a typed value on the first control matching `filter`: a dropdown
492
+ * selection (`{ kind: 'dropdown', value }`), checkbox (`{ kind: 'checkbox',
493
+ * checked }`), or date (`{ kind: 'date', date }`). Updates the visible
494
+ * content and structured state. Returns false if no match; throws if
495
+ * content-locked (unless `force`) or the value doesn't fit the control type.
496
+ */
497
+ setContentControlValue: (filter: ContentControlFilter, value: ContentControlValue, options?: {
498
+ force?: boolean;
499
+ }) => boolean;
465
500
  /** Subscribe to document changes. Fires after every committed edit. Returns unsubscribe. */
466
501
  onContentChange: (listener: (document: Document) => void) => () => void;
467
502
  /** Subscribe to selection changes (cursor moves / selection changes). Returns unsubscribe. */
package/dist/index.d.ts CHANGED
@@ -26,9 +26,9 @@ import { R as ReactSidebarItem } from './types-D35gNE-_.js';
26
26
  import { Comment } from '@eigenpal/docx-editor-core/types/content';
27
27
  import { Translations, TFunction } from '@eigenpal/docx-editor-i18n';
28
28
  import { P as PrintOptions } from './PrintPreview-DEhwRBC_.js';
29
- import { DocumentAgent } from '@eigenpal/docx-editor-core/agent';
29
+ import { DocumentAgent, ContentControlFilter, ContentControlValue } from '@eigenpal/docx-editor-core/agent';
30
30
  import { DocxInput, FontDefinition } from '@eigenpal/docx-editor-core/utils';
31
- import { SelectionState } from '@eigenpal/docx-editor-core/prosemirror';
31
+ import { SelectionState, PMContentControl } from '@eigenpal/docx-editor-core/prosemirror';
32
32
  import { Layout } from '@eigenpal/docx-editor-core/layout-engine';
33
33
  import { RenderedDomContext } from '@eigenpal/docx-editor-core/plugin-api';
34
34
  import { EditorHandle } from '@eigenpal/docx-editor-core';
@@ -462,6 +462,41 @@ interface DocxEditorRef {
462
462
  } | null;
463
463
  /** Get all comments. */
464
464
  getComments: () => Comment[];
465
+ /**
466
+ * List block-level content controls (SDTs) in the live document, optionally
467
+ * filtered by `tag`/`alias`/`id`/`type`. Each result includes the control's
468
+ * text and PM position. Anchors for templates and document automation.
469
+ */
470
+ getContentControls: (filter?: ContentControlFilter) => PMContentControl[];
471
+ /** Scroll the first content control matching `filter` into view. Returns false if none. */
472
+ scrollToContentControl: (filter: ContentControlFilter) => boolean;
473
+ /**
474
+ * Replace the content of the first control matching `filter` with `text`
475
+ * (newlines become paragraphs). Returns false if no match. Throws if the
476
+ * control is content-locked unless `{ force: true }`.
477
+ */
478
+ setContentControlContent: (filter: ContentControlFilter, text: string, options?: {
479
+ force?: boolean;
480
+ }) => boolean;
481
+ /**
482
+ * Remove the first control matching `filter`. With `{ keepContent: true }`
483
+ * the inner blocks are unwrapped in place. Returns false if no match. Throws
484
+ * if the control is deletion-locked unless `{ force: true }`.
485
+ */
486
+ removeContentControl: (filter: ContentControlFilter, options?: {
487
+ force?: boolean;
488
+ keepContent?: boolean;
489
+ }) => boolean;
490
+ /**
491
+ * Set a typed value on the first control matching `filter`: a dropdown
492
+ * selection (`{ kind: 'dropdown', value }`), checkbox (`{ kind: 'checkbox',
493
+ * checked }`), or date (`{ kind: 'date', date }`). Updates the visible
494
+ * content and structured state. Returns false if no match; throws if
495
+ * content-locked (unless `force`) or the value doesn't fit the control type.
496
+ */
497
+ setContentControlValue: (filter: ContentControlFilter, value: ContentControlValue, options?: {
498
+ force?: boolean;
499
+ }) => boolean;
465
500
  /** Subscribe to document changes. Fires after every committed edit. Returns unsubscribe. */
466
501
  onContentChange: (listener: (document: Document) => void) => () => void;
467
502
  /** Subscribe to selection changes (cursor moves / selection changes). Returns unsubscribe. */