Skip to content

Commit f2591b1

Browse files
authored
Merge pull request #3744 from udecode/feat/scroll-id
Cursor Overlay plugin
2 parents 0d54c83 + 7cf8b9f commit f2591b1

File tree

408 files changed

+3535
-2065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+3535
-2065
lines changed

.changeset/ai.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@udecode/plate-ai': patch
3+
---
4+
5+
- `CopilotPlugin`: reset on mouse down
6+
- `CopilotPlugin`: auto trigger only on selection change

.changeset/column.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@udecode/plate-layout': minor
3+
---
4+
5+
- `ColumnPlugin`:
6+
- unwrap columns when there is only one column
7+
- remove column group when it has no column children
8+
- remove column when it has no children
9+
- Add `insertColumnGroup`
10+
- Add `toggleColumnGroup`

.changeset/core-major.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@udecode/plate-slate-react': major
3+
---
4+
5+
- Add `slate-dom` as a peer dependency
6+
- Update `slate-react` peer dependency to `>=0.111.0`

.changeset/core.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@udecode/plate-core': patch
3+
---
4+
5+
- `Plate` store: add `containerRef`. This is used by some plugins like `CursorOverlay`.
6+
- Add `useEditorContainerRef` selector hook. You can pass the returned ref to your editor scroll container.
7+
- `usePlateEditor` options: `value` can now be a callback function to get the value from the editor
8+
- `editor.key` is now using `nanoid()`
9+
- `editor.uid`: new property added by `Plate` to uniquely identify the editor. The difference with `editor.key` is that `uid` supports SSR hydration. This can be passed to the editor container as `id` prop.
10+
- `Plate` now warns if multiple instances of `@udecode/plate-core` are detected. Use `suppressInstanceWarning` to suppress the warning.
11+
- `render.aboveNodes` and `render.belowNodes` now support `useElement`
12+
- `PlatePlugin.inject` new properties:
13+
- `excludePlugins?: string[]`
14+
- `excludeBelowPlugins?: string[]`
15+
- `maxLevel?: number`
16+
- `isLeaf?: boolean`
17+
- `isBlock?: boolean`
18+
- `isElement?: boolean`
19+
- Add `getInjectMatch(editor, plugin)` to get a plugin inject match function.

.changeset/cursor copy.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@udecode/plate-cursor': patch
3+
---
4+
5+
Deprecated, use `@udecode/plate-selection` instead.

.changeset/cursor.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@udecode/plate-selection': minor
3+
---
4+
5+
- New plugin `CursorOverlayPlugin`
6+
- `useCursorOverlay` now supports collapsed selection using `minSelectionWidth = 1`
7+
- selectable depends now on `data-block-id` instead of `data-key`
8+
- Fix a bug when deleting selected blocks without id
9+
- Fix `useBlockSelected`: use `id` parameter if defined

.changeset/dnd.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@udecode/plate-dnd': minor
3+
---
4+
5+
- Dragging `dropEffect` is now `move` instead of `copy`
6+
- Fix drag bug when dragging an element without id

.changeset/heading.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@udecode/plate-heading': major
3+
'@udecode/plate-ai': major
4+
---
5+
6+
- Remove `scrollContainerSelector` option in favor of `useEditorContainerRef`

.changeset/html.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@udecode/plate-html': patch
3+
---
4+
5+
Sync with `@udecode/plate-core`

.changeset/hyper.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@udecode/plate-test-utils': patch
3+
---
4+
5+
- Strip (potentially injected by the compiler) attributes starting with `__`.
6+
- Remove internal functions from exports.

.changeset/id.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@udecode/plate-node-id': minor
3+
---
4+
5+
- `idCreator` default is now `nanoid(10)`
6+
- New option `filterInline` to filter inline elements. Default is `true`.
7+
- `NodeIdPlugin`:
8+
- add `normalizeInitialValue` that set node ids when missing, called before mount
9+
- default behavior will normalize only the first and last node if missing id to avoid traversing the entire document
10+
- you can disable it with `NodeIdPlugin.configure({ normalizeInitialValue: null })`
11+
- you can force check all nodes with `NodeIdPlugin.configure({ options: { normalizeInitialValue: true } })`

.changeset/layout-major.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@udecode/plate-layout': major
3+
---
4+
5+
- Remove `toggleColumns` in favor of `toggleColumnGroup`
6+
- Remove `insertEmptyColumn` in favor of `insertColumn`

.changeset/md.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@udecode/plate-markdown': minor
3+
---
4+
5+
- `api.markdown.deserialize`: add second argument option: `processor?: (processor: Processor) => Processor`. You could use this to add other remark plugins like `remark-gfm`.
6+
- Add `delete` text rule. This does not add support for strikethrough yet.

.changeset/misc.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@udecode/plate-line-height': patch
3+
'@udecode/plate-alignment': patch
4+
'@udecode/plate-indent': patch
5+
---
6+
7+
Use `getInjectMatch(editor, plugin)`

.changeset/table.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@udecode/plate-table': patch
3+
---
4+
5+
Fix: remove tables without any rows

.changeset/utils.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@udecode/plate-utils': patch
3+
---
4+
5+
- `PlateElement` add `data-block-id` if `element.id` is defined, after editor mount to support SSR hydration.

apps/www/content/docs/ai.mdx

-16
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ const plugins = [
172172
? PROMPT_TEMPLATES.userSelecting
173173
: PROMPT_TEMPLATES.userDefault;
174174
},
175-
scrollContainerSelector: '#scroll_container',
176175
systemTemplate: ({ isBlockSelecting, isSelecting }) => {
177176
return isBlockSelecting
178177
? PROMPT_TEMPLATES.systemBlockSelecting
@@ -183,18 +182,11 @@ const plugins = [
183182
},
184183
render: { afterEditable: () => <AIMenu /> },
185184
}),
186-
SelectionOverlayPlugin,
187185
];
188186
```
189187

190188
- [AIMenu](/docs/components/ai-menu)
191189

192-
The [SelectionOverlayPlugin](https://pro.platejs.org/docs/components/cursor-overlay):
193-
194-
- Maintains selection highlight when editor loses focus
195-
- Essential for AI menu and other external input interactions
196-
- Prevents double selection with `data-plate-prevent-overlay` attribute
197-
198190
### AI SDK
199191

200192
This plugin is depending on the [ai](https://npmjs.com/package/ai) package:
@@ -278,14 +270,6 @@ Template for generating prompts. Supports placeholders:
278270

279271
</APIItem>
280272

281-
<APIItem name="scrollContainerSelector" type="string" optional>
282-
283-
CSS selector for scrollable container.
284-
285-
- **Default:** `'#scroll_container'`
286-
287-
</APIItem>
288-
289273
<APIItem name="systemTemplate" type="(props: EditorPromptParams) => string | void" optional>
290274

291275
Template for system messages. Supports same placeholders as `promptTemplate`.

apps/www/content/docs/api/core/plate-plugin.mdx

+22
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,28 @@ Defines how the plugin injects functionality into other plugins or the editor.
6363
<APISubListItem parent="inject" name="nodeProps" type="InjectNodeProps<WithAnyKey<C>>" optional>
6464
Properties used by Plate to inject props into any node component.
6565
</APISubListItem>
66+
67+
68+
<APISubListItem parent="inject" name="excludePlugins" type="string[]" optional>
69+
An array of plugin keys to exclude from node prop injection.
70+
</APISubListItem>
71+
72+
<APISubListItem parent="inject" name="excludeBelowPlugins" type="string[]" optional>
73+
An array of plugin keys. Node prop injection will be excluded for any nodes that are descendants of elements with these plugin types.
74+
</APISubListItem>
75+
<APISubListItem parent="inject" name="isBlock" type="boolean" optional>
76+
If true, only matches block elements. Used to restrict prop injection to block-level nodes.
77+
</APISubListItem>
78+
79+
<APISubListItem parent="inject" name="isElement" type="boolean" optional>
80+
If true, only matches element nodes. Used to restrict prop injection to element nodes.
81+
</APISubListItem>
82+
<APISubListItem parent="inject" name="isLeaf" type="boolean" optional>
83+
If true, only matches leaf nodes. Used to restrict prop injection to leaf nodes.
84+
</APISubListItem>
85+
<APISubListItem parent="inject" name="maxLevel" type="number" optional>
86+
Maximum nesting level for node prop injection. Nodes deeper than this level will not receive injected props.
87+
</APISubListItem>
6688
<APISubListItem parent="inject" name="plugins" type="Record<string, Partial<EditorPlatePlugin<AnyPluginConfig>>>" optional>
6789
Property that can be used by a plugin to allow other plugins to inject code.
6890
</APISubListItem>

apps/www/content/docs/api/core/store.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ A unique ID used as a provider scope. Use it if you have multiple `Plate` in the
2929
- **Default:** random id
3030
</APIItem>
3131

32+
<APIItem name="containerRef" type="React.RefObject<HTMLDivElement>">
33+
A reference to the editor container element.
34+
</APIItem>
35+
3236
<APIItem name="decorate" type="function" optional>
3337
Function used to decorate ranges in the editor.
3438

apps/www/content/docs/block-menu.mdx

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ docs:
1313

1414
---
1515

16-
<ComponentPreview name="playground-demo" id="blockmenu" />
16+
<ComponentPreview name="playground-demo" id="block-menu" />
1717

1818
<PackageInfo>
1919

@@ -52,10 +52,6 @@ const plugins = [
5252
},
5353
startThreshold: 10,
5454
},
55-
boundaries: '#scroll_container',
56-
container: '#scroll_container',
57-
selectables: '#scroll_container .slate-selectable',
58-
selectionAreaClass: 'slate-selection-area',
5955
},
6056
enableContextMenu: true,
6157
},

0 commit comments

Comments
 (0)