Skip to content

Commit 5d68455

Browse files
authored
Merge pull request #216 from lara-zeus/fix-content
Fix content
2 parents 0babf4d + 113f59e commit 5d68455

File tree

5 files changed

+58
-47
lines changed

5 files changed

+58
-47
lines changed

composer.lock

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Editors/MarkdownEditor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public static function component(): Component
2222
public static function render(string $content): string
2323
{
2424
if (class_exists(MarkdownEditorAlias::class)) {
25-
return str($content)->markdown();
25+
return (new \Illuminate\Support\HtmlString(
26+
str(strip_tags($content))
27+
->replace(['prompt(', 'eval(', '&lt;script', '<script'], '')
28+
->markdown()
29+
))->toHtml();
2630
}
2731

2832
return $content;

src/Editors/RichEditor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public static function component(): Component
2121

2222
public static function render(string $content): string
2323
{
24-
return html_entity_decode($content);
24+
return
25+
str(html_entity_decode($content))
26+
->replace(['prompt(', 'eval(', '&lt;script', '<script'], '');
2527
}
2628
}

src/Editors/TinyEditor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public static function component(): Component
2424
public static function render(string $content): string
2525
{
2626
if (class_exists(TinyEditorAlias::class)) {
27-
return html_entity_decode($content);
27+
return str(html_entity_decode($content))
28+
->replace(['prompt(', 'eval(', '&lt;script', '<script'], '');
2829
}
2930

3031
return $content;

src/Editors/TipTapEditor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ public static function render(string $content): string
2626
{
2727
if (class_exists(\FilamentTiptapEditor\TiptapEditor::class)) {
2828
// @phpstan-ignore-next-line
29-
return tiptap_converter()->asHTML($content);
29+
return tiptap_converter()
30+
->asHTML(
31+
str(html_entity_decode($content))
32+
->replace(['prompt(', 'eval(', '&lt;script', '<script'], '')
33+
);
3034
}
3135

3236
return $content;

0 commit comments

Comments
 (0)