-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsidebar.js
93 lines (90 loc) · 2.82 KB
/
sidebar.js
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
((plugins, editPost, element, components) => {
const el = element.createElement;
const { __ } = wp.i18n;
const { Fragment } = element;
const { registerPlugin } = plugins;
const { PluginSidebar, PluginSidebarMoreMenuItem } = editPost;
const { PanelBody } = components;
const outlineShow = new Controls(outlineShowOptions, { outlineShowState: '' });
const outlineBlockNameShow = new Controls(outlineBlockNameOption, { outlineNameState: '' });
const blockClassNameShow = new Controls(outlineBlockClassOption, { classNameState: '' });
const lockBlockOutline = new Controls(lockBlockOutlineOption, { outlineLockState: '' });
const dataPosition = new Controls(blockDataPositionOption, { dataPositionState: '' });
const outlineStyle = new Controls(outlineStyleOption, { outlineStyleState: '' });
const linesColorOption = new Controls(outlineColorOption, { outlineColorState: '' });
const linesOpacityOption = new Controls(outlineOpacityOption, { outlineOpacityState: '' });
const outlinePadding = new Controls(outlinePaddingOption, { outlinePaddingState: '' });
const enableOutlinePadding = new Controls(enableOutlinePaddingOption, { outlinePaddingEnableState: '' });
registerPlugin('editor-block-outline', {
render() {
return el(
Fragment,
{},
el(
PluginSidebarMoreMenuItem,
{
target: 'editor-outline',
icon: sidebarIcon,
},
'Editor Block Outline'
),
el(
PluginSidebar,
{
name: 'editor-outline',
icon: sidebarIcon,
title: 'Editor block outline',
},
el(
PanelBody,
{
className: 'editor-block-outline-sidebar',
},
el('h2', {}, 'When to show block outline?'),
el(outlineShow, {
metaKey: '_enable_block_outline',
}),
el('h4', {}, ''),
el(outlineBlockNameShow, {
metaKey: '_show_block_name',
}),
el(blockClassNameShow, {
metaKey: '_show_class_name',
}),
el(lockBlockOutline, {
metaKey: '_lock_block_outline',
}),
el('hr', {}),
el('h2', {}, 'Data Position'),
el(dataPosition, {
metaKey: '_block_data_position',
}),
el('hr', {}),
el('h2', {}, 'Outline color'),
el(linesColorOption, {
metaKey: '_block_outline_color',
}),
el('hr', {}),
el('h2', {}, 'Outline style'),
el(outlineStyle, {
metaKey: '_block_outline_style',
}),
el('hr', {}),
el('h2', {}, 'Outline opacity'),
el(linesOpacityOption, {
metaKey: '_block_outline_opacity',
}),
el('hr', {}),
el('h2', {}, 'Outline padding'),
el(enableOutlinePadding, {
metaKey: '_enable_block_outline_padding',
}),
el(outlinePadding, {
metaKey: '_block_outline_padding',
})
)
)
);
},
});
})(wp.plugins, wp.editPost, wp.element, wp.components);