File tree Expand file tree Collapse file tree 8 files changed +65
-9
lines changed Expand file tree Collapse file tree 8 files changed +65
-9
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export const MenuDropdown = forwardRef<
40
40
41
41
return (
42
42
< Ariakit . Menu
43
+ unmountOnHide = { true }
43
44
className = { mergeCSSClasses ( "bn-ak-menu" , className || "" ) }
44
45
ref = { ref } >
45
46
{ children }
Original file line number Diff line number Diff line change @@ -10,10 +10,10 @@ export const SideMenu = forwardRef<
10
10
> ( ( props , ref ) => {
11
11
const { className, children, ...rest } = props ;
12
12
13
- assertEmpty ( rest ) ;
13
+ assertEmpty ( rest , false ) ;
14
14
15
15
return (
16
- < Ariakit . Group className = { className } ref = { ref } >
16
+ < Ariakit . Group className = { className } ref = { ref } { ... rest } >
17
17
{ children }
18
18
</ Ariakit . Group >
19
19
) ;
Original file line number Diff line number Diff line change @@ -10,10 +10,15 @@ export const SideMenu = forwardRef<
10
10
> ( ( props , ref ) => {
11
11
const { className, children, ...rest } = props ;
12
12
13
- assertEmpty ( rest ) ;
13
+ assertEmpty ( rest , false ) ;
14
14
15
15
return (
16
- < Mantine . Group align = { "center" } gap = { 0 } className = { className } ref = { ref } >
16
+ < Mantine . Group
17
+ align = { "center" }
18
+ gap = { 0 }
19
+ className = { className }
20
+ ref = { ref }
21
+ { ...rest } >
17
22
{ children }
18
23
</ Mantine . Group >
19
24
) ;
Original file line number Diff line number Diff line change 6
6
InlineContentSchema ,
7
7
StyleSchema ,
8
8
} from "@blocknote/core" ;
9
- import { ReactNode } from "react" ;
9
+ import { ReactNode , useMemo } from "react" ;
10
10
11
11
import { AddBlockButton } from "./DefaultButtons/AddBlockButton" ;
12
12
import { DragHandleButton } from "./DefaultButtons/DragHandleButton" ;
@@ -33,8 +33,28 @@ export const SideMenu = <
33
33
34
34
const { addBlock, ...rest } = props ;
35
35
36
+ const dataAttributes = useMemo ( ( ) => {
37
+ const attrs : Record < string , string > = {
38
+ "data-block-type" : props . block . type ,
39
+ } ;
40
+
41
+ if ( props . block . type === "heading" ) {
42
+ attrs [ "data-level" ] = props . block . props . level . toString ( ) ;
43
+ }
44
+
45
+ if ( props . editor . schema . blockSchema [ props . block . type ] . isFileBlock ) {
46
+ if ( props . block . props . url ) {
47
+ attrs [ "data-url" ] = "true" ;
48
+ } else {
49
+ attrs [ "data-url" ] = "false" ;
50
+ }
51
+ }
52
+
53
+ return attrs ;
54
+ } , [ props . block , props . editor . schema . blockSchema ] ) ;
55
+
36
56
return (
37
- < Components . SideMenu . Root className = { "bn-side-menu" } >
57
+ < Components . SideMenu . Root className = { "bn-side-menu" } { ... dataAttributes } >
38
58
{ props . children || (
39
59
< >
40
60
< AddBlockButton addBlock = { addBlock } />
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export const SideMenuController = <
39
39
state ?. referencePos || null ,
40
40
1000 ,
41
41
{
42
- placement : "left" ,
42
+ placement : "left-start " ,
43
43
}
44
44
) ;
45
45
Original file line number Diff line number Diff line change 210
210
[data-background-color = "pink" ] {
211
211
background-color : var (--bn-colors-highlights-pink-background );
212
212
}
213
+
214
+ /* Matching Side Menu height to block line height */
215
+ .bn-side-menu {
216
+ height : 30px ;
217
+ }
218
+
219
+ .bn-side-menu [data-block-type = "heading" ][data-level = "1" ] {
220
+ height : 78px ;
221
+ }
222
+
223
+ .bn-side-menu [data-block-type = "heading" ][data-level = "2" ] {
224
+ height : 54px ;
225
+ }
226
+
227
+ .bn-side-menu [data-block-type = "heading" ][data-level = "3" ] {
228
+ height : 37px ;
229
+ }
230
+
231
+ .bn-side-menu [data-block-type = "file" ] {
232
+ height : 38px ;
233
+ }
234
+
235
+ .bn-side-menu [data-block-type = "audio" ] {
236
+ height : 60px ;
237
+ }
238
+
239
+ .bn-side-menu [data-url = "false" ] {
240
+ height : 54px ;
241
+ }
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ export const SideMenu = forwardRef<
8
8
> ( ( props , ref ) => {
9
9
const { className, children, ...rest } = props ;
10
10
11
- assertEmpty ( rest ) ;
11
+ assertEmpty ( rest , false ) ;
12
12
13
13
return (
14
- < div className = { className } ref = { ref } >
14
+ < div className = { className } ref = { ref } { ... rest } >
15
15
{ children }
16
16
</ div >
17
17
) ;
Original file line number Diff line number Diff line change 82
82
}
83
83
84
84
.bn-side-menu {
85
+ align-items : center;
85
86
display : flex;
86
87
justify-content : center;
87
88
}
You can’t perform that action at this time.
0 commit comments