Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Jan 22, 2025
1 parent 9d58295 commit 43f68a8
Show file tree
Hide file tree
Showing 24 changed files with 929 additions and 823 deletions.
123 changes: 57 additions & 66 deletions apps/www/content/docs/en/ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ Enables chat operations and streaming text generation in the editor.

### `api.aiChat.accept`

Accepts the current AI suggestion.

Accepts the current AI suggestion:
- Removes AI marks from the content
- Hides the AI chat interface
- Focuses the editor
Expand All @@ -302,61 +301,68 @@ Accepts the current AI suggestion.
Inserts AI content below the current block.

Handles both block selection and normal selection modes:
- In block selection: Inserts after the last selected block
- In normal selection: Inserts after the current block
- In block selection: Inserts after the last selected block, applying formatting from the last block
- In normal selection: Inserts after the current block, applying formatting from the current block

<API name="insertBelow">
<APIParameters>
<APIItem name="sourceEditor" type="PlateEditor">
Editor containing the content to insert.
</APIItem>
<APIItem name="options" type="object" optional>
Options for insertion.
</APIItem>
</APIParameters>

<APIOptions type="object">
<APIItem name="format" type="'all' | 'none' | 'single'" optional>
Format to apply:
- `'all'`: Apply formatting to all blocks
- `'none'`: Insert without formatting
- `'single'`: Apply formatting only to first block
- **Default:** `'single'`
</APIItem>
</APIOptions>
</API>

### `api.aiChat.replaceSelection`

Replaces the current selection with AI content.

Handles different selection modes:
- Single block selection: Replaces the selected block, applying its formatting to inserted content based on format option
- Multiple block selection: Replaces all selected blocks
- With `format: 'none'` or `'single'`: Preserves original formatting
- With `format: 'all'`: Applies first block's formatting to all content
- Normal selection: Replaces the current selection while maintaining surrounding context

<API name="replaceSelection">
<APIParameters>
<APIItem name="sourceEditor" type="PlateEditor">
Editor containing the content to replace with.
</APIItem>
<APIItem name="options" type="ReplaceSelectionOptions" optional>
Options for the replacement.
<APIItem name="options" type="object" optional>
Options for replacement.
</APIItem>
</APIParameters>

<APIOptions type="ReplaceSelectionOptions">
<APIItem name="forceUniformFormatting" type="boolean" optional>
When true, applies the first block's formatting to all inserted blocks.
- **Default:** `false`
<APIOptions type="object">
<APIItem name="format" type="'all' | 'none' | 'single'" optional>
Format to apply:
- `'all'`: Apply formatting to all blocks
- `'none'`: Insert without formatting
- `'single'`: Apply formatting only to first block
- **Default:** `'single'`
</APIItem>
</APIOptions>

<APIReturns type="void">
<APIItem name="behavior" type="string">
Handles different selection modes:
- Single block selection: Replaces the selected block, applying its formatting to all inserted content
- Multiple block selection: Replaces all selected blocks, preserving the original formatting unless `forceUniformFormatting` is enabled
- Normal selection: Replaces the current selection while maintaining surrounding context
</APIItem>
</APIReturns>
</API>

### `api.aiChat.reset`

Resets the chat state.

<API name="reset">
<APIReturns type="void">
<APIItem name="behavior" type="string">
- Stops any ongoing generation
- Clears chat messages
- Removes all AI nodes from the editor
</APIItem>
</APIReturns>
</API>
Resets the chat state:
- Stops any ongoing generation
- Clears chat messages
- Removes all AI nodes from the editor

### `api.aiChat.submit`

Expand All @@ -365,7 +371,7 @@ Submits a prompt to generate AI content.
<API name="submit">
<APIOptions type="SubmitOptions">
<APIItem name="mode" type="'chat' | 'insert'" optional>
Mode to use.
Mode to use. In insert mode, undoes previous AI changes before submitting.
- **Default:** `'chat'` for selection, `'insert'` otherwise
</APIItem>
<APIItem name="prompt" type="string" optional>
Expand All @@ -376,12 +382,6 @@ Submits a prompt to generate AI content.
Custom system message.
</APIItem>
</APIOptions>

<APIReturns type="void">
<APIItem name="behavior" type="string">
In insert mode, undoes previous AI changes before submitting.
</APIItem>
</APIReturns>
</API>

## Transforms
Expand Down Expand Up @@ -436,42 +436,33 @@ Removes nodes that have the AI mark.

### `tf.ai.undo`

Special undo operation for AI changes.

<API name="tf.ai.undo">
<APIReturns type="void">
<APIItem name="behavior" type="string">
- Undoes the last operation if it was AI-generated
- Removes the redo stack entry to prevent redoing AI operations
</APIItem>
</APIReturns>
</API>
Special undo operation for AI changes:
- Undoes the last operation if it was AI-generated
- Removes the redo stack entry to prevent redoing AI operations

### `useAIChatEditor`

A hook that registers an editor in the AI chat plugin, and deserializes markdown content with block-level memoization.

<API name="useAIChatEditor">
<APIParameters>
<APIItem name="editor" type="PlateEditor">
The editor to register in the AI chat plugin.
</APIItem>
<APIItem name="content" type="string">
The markdown content to deserialize into the editor.
</APIItem>
<APIItem name="options" type="object" optional>
<APISubList>
<APISubListItem parent="options" name="memoize" type="boolean" optional>
Enable block-level memoization with `_memo` property. Defaults to true.
</APISubListItem>
<APISubListItem parent="options" name="parser" type="ParseMarkdownBlocksOptions" optional>
Options for the markdown token parser. Can filter out specific token types.
</APISubListItem>
<APISubListItem parent="options" name="processor" type="(processor: Processor) => Processor" optional>
Function to customize the markdown processor.
</APISubListItem>
</APISubList>
</APIItem>
<APIItem name="content" type="string">
The markdown content to deserialize into the editor.
</APIItem>
<APIItem name="options" type="object" optional>
<APISubList>
<APISubListItem parent="options" name="memoize" type="boolean" optional>
Enable block-level memoization with `_memo` property.
- **Default:** `true`
</APISubListItem>
<APISubListItem parent="options" name="parser" type="ParseMarkdownBlocksOptions" optional>
Options for the markdown token parser. Can filter out specific token types.
</APISubListItem>
<APISubListItem parent="options" name="processor" type="(processor: Processor) => Processor" optional>
Function to customize the markdown processor.
</APISubListItem>
</APISubList>
</APIItem>
</APIParameters>

```tsx
Expand Down
3 changes: 0 additions & 3 deletions apps/www/content/docs/en/caption.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ Extends `TElement`.

<API name="TCaptionElement">
<APIAttributes>
<APIItem name="extends" type="TElement">
Base element type.
</APIItem>
<APIItem name="caption" type="Descendant[]" optional>
Caption value.
</APIItem>
Expand Down
36 changes: 20 additions & 16 deletions apps/www/content/docs/en/collaboration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Follow the backend instructions in [Hocuspocus docs](https://tiptap.dev/hocuspoc
<API name="YjsPlugin">
<APIOptions>
<APIItem name="cursorOptions" type="WithCursorsOptions<TCursorData>" optional>
Configuration for handling cursors in the editor.
Configuration for handling cursors in the editor. These options are passed to the withCursors function.

See [WithCursorsOptions API](https://docs.slate-yjs.dev/api/slate-yjs-core/cursor-plugin#withcursors).
</APIItem>
Expand All @@ -93,12 +93,12 @@ Follow the backend instructions in [Hocuspocus docs](https://tiptap.dev/hocuspoc
See [HocuspocusProviderConfiguration API](https://tiptap.dev/hocuspocus/provider/configuration).
</APIItem>
<APIItem name="yjsOptions" type="WithYjsOptions" optional>
Optional configuration for the Yjs integration.
Optional configuration for the Yjs integration. These options are passed to the withYjs function.

See [WithYjsOptions API](https://docs.slate-yjs.dev/api/slate-yjs-core/yjs-plugin#withyjs).
</APIItem>
<APIItem name="disableCursors" type="boolean" optional>
Whether to disable the cursor feature in the editor.
A flag indicating whether to disable the cursor feature in the editor.
</APIItem>
</APIOptions>
</API>
Expand Down Expand Up @@ -126,26 +126,30 @@ Higher-order function that wraps a Plate editor with Yjs support, allowing for r

### `PlateYjsEditorProps`

Extends `YjsEditorProps` and [CursorEditor](https://docs.slate-yjs.dev/api/slate-yjs-core/cursor-plugin#cursoreditor).

<API name="PlateYjsEditorProps">
<APIAttributes>
<APIItem name="extends" type="YjsEditorProps & CursorEditor">
Base editor props types.
</APIItem>
<APIItem name="yjs" type="object">
Yjs-specific properties.
</APIItem>
</APIAttributes>

<APIOptions type="object">
<APIItem name="provider" type="HocuspocusProvider">
The Hocuspocus provider instance.
</APIItem>
</APIOptions>
<APIItem name="yjs" type="object">

<APISubList>

<APISubListItem parent="yjs" name="provider" type="HocuspocusProvider">

The Hocuspocus provider instance.

</APISubListItem>

</APISubList>

</APIItem>
</APIAttributes>
</API>

### `YHistoryEditorProps`

See [YHistoryEditor API](https://docs.slate-yjs.dev/api/slate-yjs-core/history-plugin#yhistoryeditor).
Extends `YjsEditorProps`, [YHistoryEditor](https://docs.slate-yjs.dev/api/slate-yjs-core/history-plugin#yhistoryeditor).

### `YjsEditorProps`

Expand Down
30 changes: 13 additions & 17 deletions apps/www/content/docs/en/column.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Insert a columnGroup with two empty columns.

### `insertColumn`

Insert an empty column. You can set the width by options.width default is "33%"
Insert an empty column.

<API name="insertColumn">
<APIOptions type="InsertNodesOptions & { width?: string }">
Expand Down Expand Up @@ -122,6 +122,10 @@ Move the middle column to the left or right.
Convert a block into a column group layout or update an existing column group's layout.

<API name="toggleColumnGroup">
- If the target block is not a column group, wraps it in a new column group with the specified number of columns
- If the target block is already a column group, updates its column layout using `setColumns`
- The original content becomes the content of the first column
- Additional columns are created with empty paragraphs
<APIOptions type="object">
<APIItem name="at" type="Location" optional>
The location to toggle the column group at.
Expand All @@ -135,17 +139,19 @@ Convert a block into a column group layout or update an existing column group's
</APIOptions>
</API>

Behavior:
- If the target block is not a column group, wraps it in a new column group with the specified number of columns
- If the target block is already a column group, updates its column layout using `setColumns`
- The original content becomes the content of the first column
- Additional columns are created with empty paragraphs

### `setColumns`

Update the column layout of an existing column group.

<API name="setColumns">
- When increasing columns:
- Keeps existing column content
- Adds new empty columns with specified widths
- When decreasing columns:
- Merges content from removed columns into the last remaining column
- Updates widths of remaining columns
- When keeping same number of columns:
- Only updates column widths
<APIOptions type="object">
<APIItem name="at" type="Path">
The path to the column group element.
Expand All @@ -159,16 +165,6 @@ Update the column layout of an existing column group.
</APIOptions>
</API>

Behavior:
- When increasing columns:
- Keeps existing column content
- Adds new empty columns with specified widths
- When decreasing columns:
- Merges content from removed columns into the last remaining column
- Updates widths of remaining columns
- When keeping same number of columns:
- Only updates column widths


## Hooks

Expand Down
Loading

0 comments on commit 43f68a8

Please sign in to comment.