File tree 5 files changed +24
-4
lines changed
5 files changed +24
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @craftjs/utils ' : patch
3
+ ' @craftjs/core ' : patch
4
+ ---
5
+
6
+ Allow customising dnd indicator style/classname
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export const RenderEditorIndicator = () => {
35
35
}
36
36
37
37
return React . createElement ( RenderIndicator , {
38
+ className : indicatorOptions . className ,
38
39
style : {
39
40
...movePlaceholder (
40
41
indicator . placement ,
@@ -47,6 +48,7 @@ export const RenderEditorIndicator = () => {
47
48
? indicatorOptions . error
48
49
: indicatorOptions . success ,
49
50
transition : indicatorOptions . transition || '0.2s ease-in' ,
51
+ ...( indicatorOptions . style ?? { } ) ,
50
52
} ,
51
53
parentDom : indicator . placement . parent . dom ,
52
54
} ) ;
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ export type Options = {
23
23
error : string ;
24
24
transition : string ;
25
25
thickness : number ;
26
+ className : string ;
27
+ style : React . CSSProperties ;
26
28
} > ;
27
29
handlers : ( store : EditorStore ) => CoreEventHandlers ;
28
30
normalizeNodes : (
Original file line number Diff line number Diff line change @@ -3,12 +3,18 @@ import ReactDOM from 'react-dom';
3
3
4
4
type RenderIndicatorProps = {
5
5
style : React . CSSProperties ;
6
+ className ?: string ;
6
7
parentDom ?: HTMLElement ;
7
8
} ;
8
9
9
- export const RenderIndicator = ( { style, parentDom } : RenderIndicatorProps ) => {
10
+ export const RenderIndicator = ( {
11
+ style,
12
+ className,
13
+ parentDom,
14
+ } : RenderIndicatorProps ) => {
10
15
const indicator = (
11
16
< div
17
+ className = { className }
12
18
style = { {
13
19
position : 'fixed' ,
14
20
display : 'block' ,
Original file line number Diff line number Diff line change @@ -53,9 +53,9 @@ const App = () => {
53
53
```
54
54
In the above example, every user element will now be wrapped in a black ` div ` .
55
55
56
- ### Specifying the Drop Indicator colour
56
+ ### Customising the drag-and-drop indicator
57
57
58
- You could change the colours of the drag and drop indicators like so:
58
+ You could also change the colours/style of the drag- and- drop indicator like so:
59
59
60
60
``` jsx {6-9}
61
61
import {Editor } from " @craftjs/core" ;
@@ -65,7 +65,11 @@ const App = () => {
65
65
< Editor
66
66
indicator= {{
67
67
' success' : ' #2d9d78' , // green
68
- ' error' : ' #e34850' // red
68
+ ' error' : ' #e34850' , // red
69
+ ' style' : { // custom CSS properties
70
+ boxShadow: ' ...
71
+ },
72
+ ' className' : ' your- css- class ' // custom CSS class
69
73
}}
70
74
>
71
75
<Frame resolver={{Hero}}>
You can’t perform that action at this time.
0 commit comments