Skip to content

Commit 2e418a5

Browse files
kacperzolkiewskihejsztynx
authored andcommitted
fix: update docs
1 parent 1c97f4b commit 2e418a5

1 file changed

Lines changed: 35 additions & 5 deletions

File tree

docs/docs/api-reference/enriched-text-input.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ a visible effect; unsupported values are silently ignored and fall back to
575575
### `sanitizationConfig` {#sanitizationconfig}
576576

577577
Web-only configuration for the HTML sanitization step, which runs on every HTML
578-
entry and exit point — `defaultValue`, `.setValue()`, pasted HTML, `.getHTML()`,
579-
and [`onChangeHtml`](#onchangehtml).
578+
entry and exit point — `defaultValue`, `.setValue()`, `.insertValue()`, pasted
579+
HTML, `.getHTML()`, and [`onChangeHtml`](#onchangehtml).
580580

581581
```ts
582582
interface SanitizationConfig {
@@ -743,9 +743,9 @@ Pass an empty array to disable all shortcuts.
743743
### `useHtmlNormalizer` {#usehtmlnormalizer}
744744

745745
If `true`, external HTML pasted or inserted into the input (for example from
746-
Google Docs, Word, or web pages) is normalized into the canonical tag subset
747-
that the enriched parser understands. See
748-
[Normalization](/fundamentals/core-concepts#normalization).
746+
Google Docs, Word, or web pages, or via [`.insertValue()`](#insertvalue)) is
747+
normalized into the canonical tag subset that the enriched parser understands.
748+
See [Normalization](/fundamentals/core-concepts#normalization).
749749

750750
| Type | Default | Platforms |
751751
| --------- | ------- | ----------------- |
@@ -807,6 +807,36 @@ Returns a Promise that resolves with the current HTML content of the input.
807807
Useful when you need the HTML on demand (for example when saving) without the
808808
performance overhead of continuous parsing via `onChangeHtml`.
809809

810+
### `.insertValue()`
811+
812+
```ts
813+
insertValue: (value: string, start: number, end: number) => void;
814+
```
815+
816+
Inserts (or replaces) content at the visible character range `[start, end)`.
817+
818+
- `value: string` - the content to insert. Can be a plain text string or an HTML
819+
string (for example `<html><h2>Hello</h2></html>`).
820+
- `start: number` - starting index of the range to replace (inclusive). If
821+
`start` equals `end`, the content is inserted at that position without
822+
replacing anything.
823+
- `end: number` - ending index of the range to replace (exclusive).
824+
825+
Plain text inherits active inline styles at the insertion point (the same
826+
styles that would apply if the user typed there). When the editor is empty,
827+
`insertValue` behaves like [`setValue`](#setvalue).
828+
829+
:::note
830+
831+
Style rules apply to inserted content: if the target style is **blocked** by
832+
another currently active style (for example bold inside a code block), the
833+
incoming style is stripped. If the incoming content brings a style that
834+
**conflicts** with an existing one, the existing conflicting style is removed.
835+
See [Supported tags](/fundamentals/html-format-and-supported-tags) for the full
836+
conflict and blocking rules.
837+
838+
:::
839+
810840
### `.setImage()`
811841

812842
```ts

0 commit comments

Comments
 (0)