Skip to content

Commit 83569c0

Browse files
authored
fix type annotations on some of the docs (#539)
1 parent 6dba56f commit 83569c0

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

packages/website/docs/docs/cursor-selections.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type TextCursorPosition = {
2525
block: Block;
2626
prevBlock: Block | undefined;
2727
nextBlock: Block | undefined;
28-
}
28+
};
2929
```
3030

3131
`block:` The block currently containing the text cursor. If the cursor is in a nested block, this is the block at the deepest possible nesting level.
@@ -61,7 +61,7 @@ You can set the text cursor position to the start or end of an existing block us
6161
class BlockNoteEditor {
6262
...
6363
public setTextCursorPosition(
64-
targetBlock: BlockIdentifier,
64+
targetBlock: BlockIdentifier,
6565
placement: "start" | "end" = "start"
6666
): void;
6767
...
@@ -94,15 +94,15 @@ export default function App() {
9494
// Listens for when the text cursor position changes.
9595
onTextCursorPositionChange: (editor) => {
9696
// Gets the block currently hovered by the text cursor.
97-
const hoveredBlock: Block = editor.getTextCursorPosition().block;
97+
const hoveredBlock = editor.getTextCursorPosition().block;
9898

9999
// Traverses all blocks.
100100
editor.forEachBlock((block) => {
101101
if (
102102
block.id === hoveredBlock.id &&
103103
block.props.backgroundColor !== "blue"
104104
) {
105-
// If the block is currently hovered by the text cursor, makes its
105+
// If the block is currently hovered by the text cursor, makes its
106106
// background blue if it isn't already.
107107
editor.updateBlock(block, {
108108
props: {backgroundColor: "blue"},
@@ -111,18 +111,18 @@ export default function App() {
111111
block.id !== hoveredBlock.id &&
112112
block.props.backgroundColor === "blue"
113113
) {
114-
// If the block is not currently hovered by the text cursor, resets
114+
// If the block is not currently hovered by the text cursor, resets
115115
// its background if it's blue.
116116
editor.updateBlock(block, {
117117
props: {backgroundColor: "default"},
118118
});
119119
}
120-
120+
121121
return true;
122122
});
123123
}
124124
})
125-
125+
126126
// Renders the editor instance.
127127
return <BlockNoteView editor={editor} theme={ "{{ getTheme(isDark) }}"} />;
128128
}
@@ -141,7 +141,7 @@ When you highlight content using the mouse or keyboard, this is called a selecti
141141
```typescript
142142
type Selection = {
143143
blocks: Block[];
144-
}
144+
};
145145
```
146146

147147
`blocks:` The blocks currently spanned by the selection, including nested blocks.
@@ -232,4 +232,4 @@ export default function App() {
232232
{{ getStyles(isDark) }}
233233
```
234234

235-
:::
235+
:::

packages/website/docs/docs/slash-menu.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ import { HiOutlineGlobeAlt } from "react-icons/hi";
4040
// Command to insert "Hello World" in bold in a new block below.
4141
const insertHelloWorld = (editor: BlockNoteEditor) => {
4242
// Block that the text cursor is currently in.
43-
const currentBlock: Block = editor.getTextCursorPosition().block;
43+
const currentBlock = editor.getTextCursorPosition().block;
4444

4545
// New block we want to insert.
46-
const helloWorldBlock: PartialBlock = {
47-
type: "paragraph",
46+
const helloWorldBlock = {
47+
type: "paragraph" as const,
4848
content: [{ type: "text", text: "Hello World", styles: { bold: true } }],
49-
};
49+
} as const;
5050

5151
// Inserting the new block after the current one.
5252
editor.insertBlocks([helloWorldBlock], currentBlock, "after");
@@ -105,7 +105,7 @@ import {
105105
import "@blocknote/react/style.css";
106106

107107
function App() {
108-
const newSlashMenuItems: ReactSlashMenuItem[] =
108+
const newSlashMenuItems: ReactSlashMenuItem[] =
109109
getDefaultReactSlashMenuItems();
110110

111111
// Edit newSlashMenuItems

0 commit comments

Comments
 (0)