@ryhrm-gz/xincodo-lib
Version:
Utilities for working with Xincodo body documents.
57 lines (39 loc) • 1.01 kB
Markdown
# Rich Text Field Paths
`updateRichTextAtPath(body, path, updater)` expects a path that ends at one of
these fields:
- `richText`
- `caption`
- `title`
The easiest safe source is `walkBody`'s `richText` visitor context.
## Paragraph or Heading Rich Text
```ts
[{ key: "content", index: 0 }, { key: "richText" }];
```
## List Item Rich Text
```ts
[{ key: "content", index: 0 }, { key: "items", index: 0 }, { key: "richText" }];
```
## Table Cell Rich Text
```ts
[
{ key: "content", index: 0 },
{ key: "rows", index: 0 },
{ key: "cells", index: 0 },
{ key: "richText" },
];
```
## Page Link Title
```ts
[{ key: "content", index: 0 }, { key: "title" }];
```
## Image or Gallery Caption
Image caption:
```ts
[{ key: "content", index: 0 }, { key: "caption" }];
```
Gallery image caption:
```ts
[{ key: "content", index: 0 }, { key: "images", index: 0 }, { key: "caption" }];
```
Passing a block path such as `[{ key: "content", index: 0 }]` to
`updateRichTextAtPath` throws `BodyEditError`.