From c36a6d73badde74711b3f8bab07d85ff68bce02d Mon Sep 17 00:00:00 2001 From: EL OUFIR Hatim Date: Wed, 11 May 2022 22:30:03 +0100 Subject: [PATCH 1/2] TinyMCE URL modifiers relative_urls, remove_script_host and convert_urls accessors --- src/Components/TinyEditor.php | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/Components/TinyEditor.php b/src/Components/TinyEditor.php index b78df32..bd561ea 100644 --- a/src/Components/TinyEditor.php +++ b/src/Components/TinyEditor.php @@ -24,6 +24,15 @@ class TinyEditor extends Field implements Contracts\HasFileAttachments protected string $language; + // TinyMCE var: relative_urls + protected bool $relativeUrls = true; + + // TinyMCE var: remove_script_host + protected bool $removeScriptHost = true; + + // TinyMCE var: convert_urls + protected bool $convertUrls = true; + protected string $view = 'filament-forms-tinyeditor::tiny-editor'; public function getHeight(): int @@ -106,4 +115,40 @@ public function simple(bool | callable $condition = true): static return $this; } + + public function getRelativeUrls(): bool + { + return $this->relativeUrls; + } + + public function setRelativeUrls(bool $relativeUrls): static + { + $this->relativeUrls = $relativeUrls; + + return $this; + } + + public function getRemoveScriptHost(): bool + { + return $this->removeScriptHost; + } + + public function setRemoveScriptHost(bool $removeScriptHost): static + { + $this->removeScriptHost = $removeScriptHost; + + return $this; + } + + public function getConvertUrls(): bool + { + return $this->convertUrls; + } + + public function setConvertUrls(bool $convertUrls): static + { + $this->convertUrls = $convertUrls; + + return $this; + } } From 778eaef7ea49be35b89854a7195b037dfd600314 Mon Sep 17 00:00:00 2001 From: EL OUFIR Hatim Date: Wed, 11 May 2022 22:30:56 +0100 Subject: [PATCH 2/2] Update view with TinyMCE URL modifiers --- resources/views/tiny-editor.blade.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/views/tiny-editor.blade.php b/resources/views/tiny-editor.blade.php index 47986e4..6bed6eb 100644 --- a/resources/views/tiny-editor.blade.php +++ b/resources/views/tiny-editor.blade.php @@ -24,6 +24,9 @@ plugins: ['{{ $getPlugins() }}'], toolbar: '{{ $getToolbar() }}', toolbar_mode: 'sliding', + relative_urls : {{ $getRelativeUrls() ? 'true' : 'false' }}, + remove_script_host : {{ $getRemoveScriptHost() ? 'true' : 'false' }}, + convert_urls : {{ $getConvertUrls() ? 'true' : 'false' }}, branding: false, images_upload_handler: (blobInfo, success, failure, progress) => { if (!blobInfo.blob()) return