Skip to content

Commit d1feece

Browse files
Apply suggestions from code review
Co-authored-by: Kacper Żółkiewski <74975508+kacperzolkiewski@users.noreply.github.com>
1 parent 44ee9fe commit d1feece

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

docs/docs/fundamentals/core-concepts.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ Keeping it native makes the editor fast and stable.
2121

2222
In practice this means:
2323

24-
- To **change** content or styling, call a method: `ref.current?.toggleBold()`,
25-
`ref.current?.setValue(html)`, `ref.current?.setLink(...)`.
26-
- To **observe** content or styling, listen to an event: `onChangeState`,
27-
`onChangeHtml`, `onChangeSelection`.
24+
- To **change** the content or formatting, call a method on the ref, e.g. `ref.current?.toggleBold()`, `ref.current?.setValue(html)`, or `ref.current?.setLink(...)`.
25+
- To **observe** changes to the content or formatting, listen to events such as `onChangeState`, `onChangeHtml`, or `onChangeSelection`.
2826

2927
You never set a `value` prop and re-render to make an edit happen.
3028

@@ -35,22 +33,22 @@ The editor's content is HTML. `setValue` and `defaultValue` seeds it with an HTM
3533
changes. What you store and what you render is a string of HTML.
3634

3735
The library uses a fixed set of standard and custom tags, so the output is
38-
predictable and portable. [Supported HTML tags](/fundamentals/html-format-and-supported-tags)
36+
predictable and portable. [Supported tags](/fundamentals/html-format-and-supported-tags)
3937
lists exactly what it produces and accepts.
4038

4139
:::caution
4240

43-
You own sanitization. The library doesn't guarantee safe or clean HTML, so
41+
Sanitizing HTML is your responsibility. The library doesn't guarantee safe or clean HTML, so
4442
sanitize anything you persist, render elsewhere, or accept from untrusted
4543
sources.
4644

4745
:::
4846

4947
## Normalization
50-
HTML can be messy. If a user pastes text from Google Docs or MS Word, it can arrive packed with wrapper tags, inline styles, and structural quirks that don't match the format we expect.
48+
HTML can be messy. When users paste rich text from applications like Google Docs or Microsoft Word, the HTML often contains additional wrapper elements, inline styles, and structural quirks that may not match the HTML structure expected by the library.
5149

5250
To handle this, both components provide a `useHtmlNormalizer` prop that normalizes incoming HTML. The normalizer cleans and restructures the input into the predictable format the library expects (e.g. it maps `<strong>` to `<b>`, unwraps `<div>` containers into `<p>` tags, and strips unsupported tags). The `useHtmlNormalizer` prop defaults to `true`.
53-
All supported and canonical tags are listed in [Supported HTML tags](/fundamentals/html-format-and-supported-tags).
51+
All supported and canonical tags are listed in [Supported tags](/fundamentals/html-format-and-supported-tags).
5452

5553
## Two components, one styling API
5654

@@ -68,9 +66,7 @@ drift between the two. A common setup edits in `EnrichedTextInput`, stores the
6866

6967
## The style state model
7068

71-
Not every style can combine with every other. A heading isn't a list; bold
72-
inside a code block doesn't make sense. The editor tracks this and reports it
73-
through `onChangeState`, which gives each style three booleans:
69+
Not every style can be combined with every other. For example, a paragraph can't be both a heading and a list item, code blocks don't support inline formatting such as bold or italic. The editor tracks this and reports it through `onChangeState`, which gives each style three booleans:
7470

7571
- **`isActive`** — the style is applied at the current selection. Use it to
7672
highlight a toolbar button.
@@ -85,4 +81,4 @@ Driving your toolbar from these three flags keeps the UI honest: buttons light
8581
up and grey out according to the editor's state.
8682

8783
For the comprehensive list of which styles block or conflict with each other, see
88-
[Supported HTML tags](/fundamentals/html-format-and-supported-tags).
84+
[Supported tags](/fundamentals/html-format-and-supported-tags).

docs/docs/fundamentals/html-format-and-supported-tags.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ freely, and there are two kinds of restriction:
1919
style is active. `<b>` is blocked inside `<codeblock>`, so bold can't be
2020
applied there.
2121

22-
Both show up in the [`onChangeState`](/fundamentals/core-concepts) payload as
22+
Both show up in the [`onChangeState`](/fundamentals/core-concepts#the-style-state-model) payload as
2323
`isConflicting` and `isBlocking`.
2424

2525
## Inline tags
@@ -74,6 +74,6 @@ paragraph comes out like this:
7474

7575
```html
7676
<h1>Title</h1>
77-
<br />
77+
<br>
7878
<p>Some body text.</p>
7979
```

0 commit comments

Comments
 (0)