-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathresizableMediaMenuUtil.ts
64 lines (61 loc) · 1.62 KB
/
resizableMediaMenuUtil.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* @unocss-include */
import { IconAlignCenter, IconAlignLeft, IconAlignRight, IconFloatLeft, IconFloatRight, IconDelete } from '../../assets'
interface ResizableMediaAction {
tooltip: string,
icon: string
action?: (updateAttributes: (o: Record<string, any>) => any) => void
isActive?: (attrs: Record<string, any>) => boolean
delete?: (d: () => void) => void
}
export const resizableMediaActions: ResizableMediaAction[] = [
{
tooltip: 'Align left',
action: (updateAttributes) => updateAttributes({
dataAlign: 'left',
dataFloat: null,
}),
icon: IconAlignLeft,
isActive: (attrs) => attrs.dataAlign === 'left'
},
{
tooltip: 'Align center',
action: (updateAttributes) => updateAttributes({
dataAlign: 'center',
dataFloat: null,
}),
icon: IconAlignCenter,
isActive: (attrs) => attrs.dataAlign === 'center'
},
{
tooltip: 'Align right',
action: (updateAttributes) => updateAttributes({
dataAlign: 'right',
dataFloat: null,
}),
icon: IconAlignRight,
isActive: (attrs) => attrs.dataAlign === 'right'
},
{
tooltip: 'Float left',
action: (updateAttributes) => updateAttributes({
dataAlign: null,
dataFloat: 'left',
}),
icon: IconFloatLeft,
isActive: (attrs) => attrs.dataFloat === 'left'
},
{
tooltip: 'Float right',
action: (updateAttributes) => updateAttributes({
dataAlign: null,
dataFloat: 'right',
}),
icon: IconFloatRight,
isActive: (attrs) => attrs.dataFloat === 'right'
},
{
tooltip: 'Delete',
icon: IconDelete,
delete: (deleteNode) => deleteNode()
}
]