import { __ } from "@wordpress/i18n";
import { useBlockProps } from "@wordpress/block-editor";
import { useEffect } from "@wordpress/element";
import Inspector from "./inspector";
import Style from "./style";
const Edit = (props) => {
const { attributes, setAttributes, clientId } = props;
const {
blockId,
customTitle,
showTitle,
iconSize,
} = attributes;
// Set unique block ID
useEffect(() => {
if (!blockId) {
setAttributes({ blockId: `betterdocs-article-summary-${clientId}` });
}
}, [clientId, blockId, setAttributes]);
const blockProps = useBlockProps({
className: `betterdocs-article-summary ${blockId || ''}`,
});
// Determine title text
const titleText = customTitle || __("Doc Summary", "betterdocs");
return (
<>
{__( "This is a preview of the Doc Summarizer block. The actual AI-generated summary will appear here when viewed on the frontend.", "betterdocs" )}
{__( "The summary will be automatically generated based on the article content using OpenAI technology.", "betterdocs" )}