From 94541dec256a8e1b65d1a7f8eb3dbad00e760afb Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 18 Apr 2024 06:13:52 +0000 Subject: [PATCH] When the textarea contains raw text / HTML and not blocks, attempt to parse it to blocks. --- src/editor/index.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/editor/index.tsx b/src/editor/index.tsx index 8eeb9d9..81f6182 100644 --- a/src/editor/index.tsx +++ b/src/editor/index.tsx @@ -60,6 +60,24 @@ function RemoveBlockTypes() { return null; } +/** + * Initial content loader. Determine if the textarea contains blocks or raw HTML + * + * @param {string} content Text area content + * @param {*} parser Gutenberg `parse` function + * @param {*} rawHandler Gutenberg `rawHandler` function + */ +function onLoad( content, parser, rawHandler ) { + // Does the content contain blocks? + if ( content.indexOf( '