Skip to content

Commit f728f6a

Browse files
committed
docs: more docs fixes
1 parent d6d6a60 commit f728f6a

9 files changed

Lines changed: 25 additions & 16 deletions

File tree

docs/content/docs/features/blocks/tables.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ type TableBlock = {
5151

5252
type TableContent = {
5353
type: "tableContent";
54-
columnWidths: number[];
55-
headerRows: number;
54+
columnWidths: (number | undefined)[];
55+
headerRows?: number;
56+
headerCols?: number;
5657
rows: {
5758
cells: TableCell[];
5859
}[];
@@ -61,6 +62,9 @@ type TableContent = {
6162
type TableCell = {
6263
type: "tableCell";
6364
props: {
65+
backgroundColor: string;
66+
textColor: string;
67+
textAlignment: "left" | "center" | "right" | "justify";
6468
colspan?: number;
6569
rowspan?: number;
6670
};

docs/content/docs/features/export/html.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ For example, you an use this for static rendering documents that have been creat
2626
</Callout>
2727

2828
```typescript
29-
async blocksToFullHTML(blocks?: Block[]): Promise<string>;
29+
blocksToFullHTML(blocks?: Block[]): string;
3030

3131
// Usage
32-
const HTMLFromBlocks = await editor.blocksToFullHTML(blocks);
32+
const HTMLFromBlocks = editor.blocksToFullHTML(blocks);
3333
```
3434

3535
`blocks:` The blocks to convert. If not provided, the entire document (all top-level blocks) is used.
@@ -45,10 +45,10 @@ Converting Blocks to HTML this way will lose some information such as the nestin
4545
Use `blocksToHTMLLossy` to export `Block` objects to an HTML string:
4646

4747
```typescript
48-
async blocksToHTMLLossy(blocks?: Block[]): Promise<string>;
48+
blocksToHTMLLossy(blocks?: Block[]): string;
4949

5050
// Usage
51-
const HTMLFromBlocks = await editor.blocksToHTMLLossy(blocks);
51+
const HTMLFromBlocks = editor.blocksToHTMLLossy(blocks);
5252
```
5353

5454
`blocks:` The blocks to convert. If not provided, the entire document (all top-level blocks) is used.

docs/content/docs/features/export/markdown.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ BlockNote can export Blocks to Markdown. Note that this is also considered "loss
2121
`blocksToMarkdownLossy` converts `Block` objects to a Markdown string:
2222

2323
```typescript
24-
async blocksToMarkdownLossy(blocks?: Block[]): Promise<string>;
24+
blocksToMarkdownLossy(blocks?: Block[]): string;
2525

2626
// Usage
27-
const markdownFromBlocks = await editor.blocksToMarkdownLossy(blocks);
27+
const markdownFromBlocks = editor.blocksToMarkdownLossy(blocks);
2828
```
2929

3030
`blocks:` The blocks to convert. If not provided, the entire document (all top-level blocks) is used.

docs/content/docs/features/import/html.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ It's possible to import HTML content into BlockNote blocks, completely client-si
2020
Use `tryParseHTMLToBlocks` to parse an HTML string to `Block` objects:
2121

2222
```typescript
23-
async tryParseHTMLToBlocks(html: string): Promise<Blocks[]>;
23+
tryParseHTMLToBlocks(html: string): Block[];
2424

2525
// Usage
26-
const blocksFromHTML = await editor.tryParseHTMLToBlocks(html);
26+
const blocksFromHTML = editor.tryParseHTMLToBlocks(html);
2727
```
2828

2929
`returns:` The blocks parsed from the HTML string.

docs/content/docs/features/import/markdown.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ BlockNote can import Markdown content into Block objects. Note that this is cons
2020
Use `tryParseMarkdownToBlocks` to try parsing a Markdown string into `Block` objects:
2121

2222
```typescript
23-
async tryParseMarkdownToBlocks(markdown: string): Promise<Blocks[]>;
23+
tryParseMarkdownToBlocks(markdown: string): Block[];
2424

2525
// Usage
26-
const blocksFromMarkdown = await editor.tryParseMarkdownToBlocks(markdown);
26+
const blocksFromMarkdown = editor.tryParseMarkdownToBlocks(markdown);
2727
```
2828

2929
`returns:` The blocks parsed from the Markdown string.

docs/content/docs/foundations/document-structure.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ While both of these act as regular blocks, there are a few additional restrictio
128128
```typescript
129129
type TableContent = {
130130
type: "tableContent";
131+
columnWidths: (number | undefined)[];
132+
headerRows?: number;
133+
headerCols?: number;
131134
rows: {
132135
cells: InlineContent[][];
133136
}[];

docs/content/docs/reference/editor/cursor-selections.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ type TextCursorPosition = {
1818
block: Block;
1919
prevBlock: Block | undefined;
2020
nextBlock: Block | undefined;
21+
parentBlock: Block | undefined;
2122
};
2223
```
2324

2425
- `block`: The block currently containing the text cursor
2526
- `prevBlock`: The previous block at the same nesting level (undefined if first)
2627
- `nextBlock`: The next block at the same nesting level (undefined if last)
28+
- `parentBlock`: The parent block if the cursor is in a nested block (undefined if at the top level)
2729

2830
### Getting Cursor Position
2931

docs/content/docs/reference/editor/events.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ See [Understanding Changes](#understanding-changes) for more information about t
7575
The `onBeforeChange` callback is called before any change is applied to the editor, allowing you to cancel the change.
7676

7777
```typescript
78-
editor.onBeforeChange((editor, { getChanges, tr }) => {
78+
editor.onBeforeChange(({ getChanges, tr }) => {
7979
if (
8080
// Cancel inserting new blocks
8181
getChanges().some((change) => change.type === "insert")

docs/content/docs/reference/editor/manipulating-content.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ The content manipulation APIs fall into two main categories:
3535
Most block methods require a `BlockIdentifier` to reference existing blocks:
3636

3737
```typescript
38-
type BlockIdentifier = string | Block;
38+
type BlockIdentifier = string | { id: string };
3939
```
4040

4141
You can pass either:
4242

4343
- A `string` representing the block ID
44-
- A `Block` object (the ID will be extracted automatically)
44+
- Any object with an `id: string` property, such as a `Block`
4545

4646
### Partial Blocks
4747

@@ -119,7 +119,7 @@ const parentBlock = editor.getParentBlock("nested-block-123");
119119

120120
```typescript
121121
forEachBlock(
122-
callback: (block: Block) => boolean | undefined,
122+
callback: (block: Block) => boolean,
123123
reverse: boolean = false
124124
): void
125125
```

0 commit comments

Comments
 (0)