Skip to content

Commit 3f241fe

Browse files
committed
Merge branch 'main' into html2canvas
2 parents b59897f + f8d65c4 commit 3f241fe

File tree

381 files changed

+11256
-5486
lines changed

Some content is hidden

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

381 files changed

+11256
-5486
lines changed

.changeset/witty-eels-agree.md

-5
This file was deleted.

.eslintrc.cjs

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ module.exports = {
3636
'**/scripts/*.mts',
3737
],
3838
overrides: [
39+
{
40+
files: ['**/registry/default/**/*'],
41+
rules: {
42+
'jsx-a11y/iframe-has-title': 'off',
43+
'jsx-a11y/media-has-caption': 'off',
44+
'react/jsx-no-comment-textnodes': 'off',
45+
},
46+
},
3947
{
4048
files: ['*.ts', '*.tsx', '*.mts'],
4149
parserOptions: {

apps/www/content/docs/alignment.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ The editor instance.
6565
The alignment value.
6666
</APISubListItem>
6767
<APISubListItem parent="options" name="setNodesOptions" type="SetNodesOptions" optional>
68+
Options for the `setNodes` function.
6869
</APISubListItem>
6970

7071
</APISubList>
+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
---
2+
title: Floating
3+
description: API reference for floating UI components and hooks.
4+
---
5+
6+
<PackageInfo>
7+
8+
## Features
9+
10+
- Virtual floating elements that follow cursor position
11+
- Floating toolbar that appears on text selection
12+
- Built on top of Floating UI
13+
- Customizable positioning and behavior
14+
- Automatic updates on scroll and resize
15+
16+
</PackageInfo>
17+
18+
## Installation
19+
20+
```bash
21+
npm install @udecode/plate-floating
22+
```
23+
24+
## API Hooks
25+
26+
### useVirtualFloating
27+
28+
Creates a floating element with a controlled virtual element, typically used to follow cursor position.
29+
30+
<APIParameters>
31+
<APIItem name="options" type="UseVirtualFloatingOptions">
32+
Options for the virtual floating element.
33+
<APISubList>
34+
<APISubListItem parent="options" name="getBoundingClientRect" type="() => ClientRectObject" optional>
35+
Function to get the bounding client rect.
36+
- **Default:** Returns a zero-sized rect at (0,0)
37+
</APISubListItem>
38+
<APISubListItem parent="options" name="open" type="boolean" optional>
39+
Controls visibility of the floating element.
40+
</APISubListItem>
41+
<APISubListItem parent="options" name="whileElementsMounted" type="function" optional>
42+
Callback when elements are mounted.
43+
- **Default:** `autoUpdate` (updates on scroll and resize)
44+
</APISubListItem>
45+
</APISubList>
46+
</APIItem>
47+
</APIParameters>
48+
49+
<APIReturns>
50+
<APIItem name="style" type="React.CSSProperties">
51+
Style object to apply to the floating element.
52+
</APIItem>
53+
<APIItem name="virtualElementRef" type="React.MutableRefObject">
54+
Reference to the virtual element.
55+
</APIItem>
56+
<APIItem name="refs" type="object">
57+
References for floating UI positioning.
58+
</APIItem>
59+
<APIItem name="update" type="() => void">
60+
Function to manually update positioning.
61+
</APIItem>
62+
</APIReturns>
63+
64+
### useFloatingToolbar
65+
66+
Creates a floating toolbar that appears when text is selected in the editor.
67+
68+
<APIParameters>
69+
<APIItem name="state" type="FloatingToolbarState">
70+
State options for the floating toolbar.
71+
<APISubList>
72+
<APISubListItem parent="state" name="floatingOptions" type="UseVirtualFloatingOptions" optional>
73+
Options passed to useVirtualFloating.
74+
</APISubListItem>
75+
<APISubListItem parent="state" name="hideToolbar" type="boolean" optional>
76+
Force hide the toolbar.
77+
</APISubListItem>
78+
<APISubListItem parent="state" name="showWhenReadOnly" type="boolean" optional>
79+
Show toolbar in read-only mode.
80+
</APISubListItem>
81+
</APISubList>
82+
</APIItem>
83+
</APIParameters>
84+
85+
<APIReturns>
86+
<APIItem name="clickOutsideRef" type="React.RefObject">
87+
Ref to detect clicks outside the toolbar.
88+
</APIItem>
89+
<APIItem name="hidden" type="boolean">
90+
Whether the toolbar should be hidden.
91+
</APIItem>
92+
<APIItem name="props" type="object">
93+
Props to spread on the toolbar element.
94+
</APIItem>
95+
<APIItem name="ref" type="React.RefObject">
96+
Ref to attach to the toolbar element.
97+
</APIItem>
98+
</APIReturns>
99+
100+
## API
101+
102+
### getBoundingClientRect
103+
104+
Gets the bounding client rectangle for a location or array of locations in the editor.
105+
106+
<APIParameters>
107+
<APIItem name="editor" type="TEditor">
108+
The editor instance.
109+
</APIItem>
110+
<APIItem name="at" type="Location | Location[]" optional>
111+
The location(s) to get the bounding rectangle for. If not provided, uses the current editor selection.
112+
</APIItem>
113+
</APIParameters>
114+
115+
<APIReturns>
116+
<APIItem type="DOMRect | undefined">
117+
The merged bounding client rectangle of all specified locations, or undefined if no valid rectangles found.
118+
</APIItem>
119+
</APIReturns>
120+
121+
### getDOMSelectionBoundingClientRect
122+
123+
Gets the bounding client rectangle of the current DOM selection.
124+
125+
<APIReturns>
126+
<APIItem type="ClientRectObject">
127+
The bounding client rectangle of the DOM selection. Returns a zero-sized rect at (0,0) if no selection exists.
128+
</APIItem>
129+
</APIReturns>
130+
131+
### getRangeBoundingClientRect
132+
133+
Gets the bounding client rectangle for a specific Slate range.
134+
135+
<APIParameters>
136+
<APIItem name="editor" type="TEditor">
137+
The editor instance.
138+
</APIItem>
139+
<APIItem name="at" type="Range | null">
140+
The Slate range to get the bounding rectangle for.
141+
</APIItem>
142+
</APIParameters>
143+
144+
<APIReturns>
145+
<APIItem type="ClientRectObject">
146+
The bounding client rectangle of the range. Returns a zero-sized rect at (0,0) if the range is null or invalid.
147+
</APIItem>
148+
</APIReturns>
149+
150+
### getSelectionBoundingClientRect
151+
152+
Gets the bounding client rectangle of the current editor selection.
153+
154+
<APIParameters>
155+
<APIItem name="editor" type="PlateEditor">
156+
The editor instance.
157+
</APIItem>
158+
</APIParameters>
159+
160+
<APIReturns>
161+
<APIItem type="ClientRectObject">
162+
The bounding client rectangle of the selection. Returns a zero-sized rect at (0,0) if the selection is not expanded.
163+
</APIItem>
164+
</APIReturns>

0 commit comments

Comments
 (0)