Skip to content

Commit

Permalink
Merge pull request #20 from heloufir/main
Browse files Browse the repository at this point in the history
Add TinyMCE URL modifiers
  • Loading branch information
mohamedsabil83 authored May 11, 2022
2 parents 9d7483e + 778eaef commit 680ea5a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/views/tiny-editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions src/Components/TinyEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 680ea5a

Please sign in to comment.