From b6ad824dd1f15eb2a8240067fcb8288d5e8b4254 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Sun, 6 Oct 2024 19:08:32 +0300 Subject: [PATCH] fix render content --- src/Editors/MarkdownEditor.php | 6 +++++- src/Editors/RichEditor.php | 4 +++- src/Editors/TinyEditor.php | 3 ++- src/Editors/TipTapEditor.php | 6 +++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Editors/MarkdownEditor.php b/src/Editors/MarkdownEditor.php index b8889dd..9d1d1c0 100644 --- a/src/Editors/MarkdownEditor.php +++ b/src/Editors/MarkdownEditor.php @@ -22,7 +22,11 @@ public static function component(): Component public static function render(string $content): string { if (class_exists(MarkdownEditorAlias::class)) { - return str($content)->markdown(); + return (new \Illuminate\Support\HtmlString( + str(strip_tags($content)) + ->replace(['prompt(','eval(','<script','markdown() + ))->toHtml(); } return $content; diff --git a/src/Editors/RichEditor.php b/src/Editors/RichEditor.php index 2a38d75..4c3dd47 100644 --- a/src/Editors/RichEditor.php +++ b/src/Editors/RichEditor.php @@ -21,6 +21,8 @@ public static function component(): Component public static function render(string $content): string { - return html_entity_decode($content); + return + str(html_entity_decode($content)) + ->replace(['prompt(','eval(','<script','replace(['prompt(','eval(','<script','asHTML($content); + return tiptap_converter() + ->asHTML( + str(html_entity_decode($content)) + ->replace(['prompt(','eval(','<script','