diff --git a/assets/js/src/form_editor/blocks/custom_html/edit.jsx b/assets/js/src/form_editor/blocks/custom_html/edit.jsx
index 980d3e56cf..a2dd6c03de 100644
--- a/assets/js/src/form_editor/blocks/custom_html/edit.jsx
+++ b/assets/js/src/form_editor/blocks/custom_html/edit.jsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useState, useCallback } from 'react';
import {
Panel,
PanelBody,
@@ -9,8 +9,19 @@ import {
import { InspectorControls } from '@wordpress/block-editor';
import PropTypes from 'prop-types';
import MailPoet from 'mailpoet';
+import { debounce } from 'lodash';
const CustomHtmlEdit = ({ attributes, setAttributes }) => {
+ const [renderedContent, setRenderedContent] = useState(attributes.content);
+ const setRenderedContentDebounced = useCallback(debounce((content) => {
+ setRenderedContent(content);
+ }, 300), []);
+
+ const handleContentChange = (content) => {
+ setAttributes({ content });
+ setRenderedContentDebounced(content);
+ };
+
const inspectorControls = (