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 / feedback-form / src / edit.js

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

85 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useState, useEffect } from "@wordpress/element";
2 import { useBlockProps } from "@wordpress/block-editor";
3 import Inspector from "./inspector";
4 import { MessageIcon } from "./icons";
5 import FeedbackModalForm from "./modal";
6 import { safeHTML } from '@wordpress/dom';
7 import {
8 usePreviewDeviceType,
9 useStyleSheets,
10 useDuplicateBlockIdFix,
11 } from "../../../hooks";
12 import cssProperties from "./cssProperties";
13
14 const BLOCK_PREFIX = "betterdocs-feedback-form";
15 const edit = ({ isSelected, clientId, attributes, setAttributes }) => {
16 const {
17 resOption,
18 blockId,
19 blockMeta,
20 formContent,
21 formTitle,
22 buttonText,
23 formContentColor,
24 feedbackFormHeadingColor,
25 feedbackFormNameLabelText,
26 feedbackFormEmailLabelText,
27 feedbackFormMessageLabelText
28 } = attributes;
29
30 const [display, setDisplay] = useState("none");
31
32 usePreviewDeviceType(setAttributes);
33 useDuplicateBlockIdFix(BLOCK_PREFIX, blockId, clientId, setAttributes);
34 const { properties, htmlAttributes, styleTag } = useStyleSheets({
35 properties: cssProperties({ blockId }),
36 setAttributes,
37 attributes,
38 });
39
40 const blockProps = useBlockProps({
41 className: `eb-guten-block-main-parent-wrapper`,
42 });
43
44 return (
45 <>
46 {isSelected && (
47 <Inspector
48 attributes={attributes}
49 setAttributes={setAttributes}
50 />
51 )}
52 <div {...blockProps}>
53 {styleTag()}
54 <div className={`${safeHTML(blockId)} feedback-form`}>
55 <a
56 className="feedback-form-link"
57 href="#betterdocs-form-modal"
58 name="betterdocs-form-modal"
59 onClick={() => {
60 setDisplay("block");
61 }}
62 >
63 <span className="feedback-form-icon">
64 <MessageIcon />
65 </span>
66 {formContent}
67 </a>
68 </div>
69 <FeedbackModalForm
70 display={display}
71 setDisplay={setDisplay}
72 blockId={blockId}
73 formTitle={formTitle}
74 buttonText={buttonText}
75 labelNameText={feedbackFormNameLabelText}
76 labelEmailText={feedbackFormEmailLabelText}
77 labelMessageText={feedbackFormMessageLabelText}
78 />
79 </div>
80 </>
81 );
82 };
83
84 export default edit;
85