PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / gutenberg / blocks / betterdocs-print / src / inspector.js

inspector.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/gutenberg/blocks/betterdocs-print/src/inspector.js

157 lines 8.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from "@wordpress/i18n";
2 import { InspectorControls } from "@wordpress/block-editor";
3 import {
4 PanelBody,
5 TabPanel,
6 BaseControl,
7 ButtonGroup,
8 Button,
9 SelectControl,
10 } from "@wordpress/components";
11
12 import { PRINT_ICON_MARGIN, PRINT_ICON_PADDING, PRINT_ICON_ALIGNMENT, LAYOUT, PRINT_ICON_PADDING_LAYOUT_2, PRINT_ICON_MARGIN_LAYOUT_2, PRINT_ICON_ALIGNMENT_LAYOUT_2_VALUES, BACKGROUND_LAYOUT_2 } from "./constants";
13
14 import objAttributes from "./attributes";
15 import ResponsiveDimensionsControl from "../../../util/dimensions-control-v2";
16 import BackgroundControl from "../../../util/background-control";
17
18 const Inspector = ({ attributes, setAttributes }) => {
19 const { resOption, print_icon_alignment, print_icon_alignment_layout_2, layout } = attributes;
20
21 const resRequiredProps = {
22 setAttributes,
23 resOption,
24 attributes,
25 objAttributes,
26 };
27
28 return (
29 <InspectorControls key="controls">
30 <div className="eb-panel-control">
31 <TabPanel
32 className="eb-parent-tab-panel"
33 activeClass="active-tab"
34 tabs={[
35 {
36 name: "general",
37 title: __("General", "betterdocs"),
38 className: "eb-tab general",
39 },
40 {
41 name: "style",
42 title: __("Style", "betterdocs"),
43 className: "eb-tab styles",
44 }
45 ]}
46 >
47 {(tab) => {
48 return (
49 <div className={"eb-tab-controls " + tab.name}>
50 {tab.name === "general" && (
51 <PanelBody
52 title={__("General", "betterdocs")}
53 initialOpen={true}
54 >
55 <SelectControl
56 label={__("Select layout", "betterdocs")}
57 value={layout}
58 options={LAYOUT}
59 onChange={(newLayout) =>
60 setAttributes({
61 layout: newLayout,
62 })
63 }
64 />
65 </PanelBody>
66 )}
67 {tab.name === "style" && (
68 <PanelBody
69 title={__("Print", "betterdocs")}
70 initialOpen={true}
71 >
72 <BaseControl
73 label={__(
74 "Alignment",
75 "betterdocs"
76 )}
77 id="eb-advance-heading-alignment"
78 >
79 {layout == 'layout-1' && <ButtonGroup id="eb-advance-heading-alignment">
80 {PRINT_ICON_ALIGNMENT.map(
81 (item, key) => (
82 <Button
83 key={key}
84 // isLarge
85 isPrimary={
86 print_icon_alignment ===
87 item.value
88 }
89 isSecondary={
90 print_icon_alignment !==
91 item.value
92 }
93 onClick={() =>
94 setAttributes({
95 print_icon_alignment: item.value,
96 })
97 }
98 >
99 {item.label}
100 </Button>
101 )
102 )}
103 </ButtonGroup>}
104 {layout == 'layout-2' && <ButtonGroup id="eb-advance-heading-alignment">
105 {PRINT_ICON_ALIGNMENT_LAYOUT_2_VALUES.map(
106 (item, key) => (
107 <Button
108 key={key}
109 // isLarge
110 isPrimary={print_icon_alignment_layout_2 === item.value}
111 isSecondary={print_icon_alignment_layout_2 !== item.value}
112 onClick={() => {
113 setAttributes({
114 print_icon_alignment_layout_2: item.value,
115 });
116 }}
117 >
118 {item.label}
119 </Button>
120 )
121 )}
122 </ButtonGroup>}
123 </BaseControl>
124 {layout == 'layout-2' && <BackgroundControl
125 controlName={BACKGROUND_LAYOUT_2}
126 resRequiredProps={resRequiredProps}
127 noOverlay={true}
128 />}
129 <ResponsiveDimensionsControl
130 baseLabel={__(
131 "Padding",
132 "betterdocs"
133 )}
134 resRequiredProps={resRequiredProps}
135 controlName={layout == 'layout-1' ? PRINT_ICON_PADDING : PRINT_ICON_PADDING_LAYOUT_2}
136 />
137 <ResponsiveDimensionsControl
138 baseLabel={__(
139 "Margin",
140 "betterdocs"
141 )}
142 resRequiredProps={resRequiredProps}
143 controlName={layout == 'layout-1' ? PRINT_ICON_MARGIN : PRINT_ICON_MARGIN_LAYOUT_2}
144 />
145 </PanelBody>
146 )}
147 </div>
148 );
149 }}
150 </TabPanel>
151 </div>
152 </InspectorControls>
153 );
154 };
155
156 export default Inspector;
157