From 77d910b3b686867ce77df8becbb6e4231ad8b987 Mon Sep 17 00:00:00 2001 From: Markus Hofmann Date: Fri, 11 Jul 2025 11:56:37 +0200 Subject: [PATCH 1/2] [TASK] Remove console.log from plugin While debugging, a `console.log` was forgotten to remove. As this could lead to issues in some browsers, remove the code. --- Resources/Public/JavaScript/Ckeditor/deeplwrite-plugin.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Resources/Public/JavaScript/Ckeditor/deeplwrite-plugin.js b/Resources/Public/JavaScript/Ckeditor/deeplwrite-plugin.js index 34d7502..18bc99b 100644 --- a/Resources/Public/JavaScript/Ckeditor/deeplwrite-plugin.js +++ b/Resources/Public/JavaScript/Ckeditor/deeplwrite-plugin.js @@ -43,7 +43,6 @@ export class Deeplwrite extends Plugin { const format = content.querySelector('input[name="format"]:checked'); let style = ''; let tone = ''; - console.log(format); if (format !== null) { if (format.classList.contains('style')) { style = format.value; From c3ade1036e7177f474d480a143b412ba3ce5cc1f Mon Sep 17 00:00:00 2001 From: Markus Hofmann Date: Fri, 11 Jul 2025 12:02:50 +0200 Subject: [PATCH 2/2] [BUGFIX] Adjust HTML parser The `HtmlParser` used the DOM Document methods saving the html for the return to the system. THis is fine, but with `DOMDocument::saveHTML()` all possible characters were converted to their respective html entities. While working inside TYPO3, the main character encoding is `UTF-8` in most cases and the result should return the content `as-is` and not with entities encoded. With switching the parser to return the rendered XML, this issue doesn't appear, as `DOMDocument::saveXML()` doesn't convert to HTML entities. --- Classes/Service/HtmlParser.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Classes/Service/HtmlParser.php b/Classes/Service/HtmlParser.php index 861dba5..bd1b260 100644 --- a/Classes/Service/HtmlParser.php +++ b/Classes/Service/HtmlParser.php @@ -50,7 +50,14 @@ public function buildHtml(array $processedValue): string $domResult = new DOMDocument('1.0', 'UTF-8'); $this->addToDomRecursive($domResult, $result); - $generatedHtml = $domResult->saveHTML(); + /** + * Get the Template tag from the DOMDocument + * This helps to return only this content without the XML annotation on the top + * of the document. + * @see https://www.php.net/manual/en/domdocument.savexml.php section node parameter + */ + $template = $domResult->firstChild; + $generatedHtml = $domResult->saveXML($template); return str_replace([''], '', $generatedHtml); }