From 9c2de0ee5c6a2ae3c1461e59d38dd7a54839b817 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Mon, 3 Mar 2025 09:10:44 +0100 Subject: [PATCH] - added clean btn for editor and added autoformatter module; --- .../FormField/components/Wysiwyg/index.js | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/components/FormField/components/Wysiwyg/index.js b/src/components/FormField/components/Wysiwyg/index.js index dcb793e..8c33a69 100644 --- a/src/components/FormField/components/Wysiwyg/index.js +++ b/src/components/FormField/components/Wysiwyg/index.js @@ -1,11 +1,19 @@ -import React from 'react'; +import React, { useRef } from 'react'; import { classNames } from 'primereact/utils'; import { Controller } from 'react-hook-form'; +import Quill from 'quill'; +import { __ } from '@wordpress/i18n'; + +// components import { Editor } from 'primereact/editor'; import BlockingOverlay from '../../../BlockingOverlay'; +import { Button } from 'primereact/button'; + +const Delta = Quill.import('delta'); const Wysiwyg = ({ fieldName, + setDataFn, label, control, rows = 3, @@ -16,6 +24,11 @@ const Wysiwyg = ({ placeholder = '', disabled = false }) => { + const editorRef = useRef(null); + + const handleCleanValue = () => { + setDataFn(fieldName, '', { shouldValidate: true }); + }; const renderHeader = () => { return ( @@ -42,6 +55,13 @@ const Wysiwyg = ({ +