-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from mostafaznv/dev
feat: force paste as plain text #139
- Loading branch information
Showing
8 changed files
with
130 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,8 @@ | |
|
||
'content-lang' => 'en', | ||
|
||
'force-paste-as-plain-text' => false, | ||
|
||
'ui-language' => [ | ||
'name' => 'en', | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
docs/advanced-usage/ckeditor-field-options/force-page-as-plain-text.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
description: forcePasteAsPlainText | ||
--- | ||
|
||
# Force Paste as Plain Text | ||
|
||
<table><thead><tr><th>Argument</th><th width="141">Type</th><th width="149" data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>status</td><td>bool</td><td>false</td><td>true</td></tr></tbody></table> | ||
|
||
In some cases, you might want to paste content from your clipboard as plain text, removing any HTML tags. | ||
|
||
By default, CKEditor preserves the structure of the original content and ensures HTML is safely maintained. However, if you’d prefer to paste content without any formatting, as plain text, you can use the `forcePasteAsPlainText` function. | ||
|
||
|
||
|
||
```php | ||
use Mostafaznv\NovaCkEditor\CkEditor; | ||
|
||
class Article extends Resource | ||
{ | ||
public function fields(Request $request): array | ||
{ | ||
return [ | ||
CkEditor::make(trans('Content'), 'content') | ||
->forcePasteAsPlainText() | ||
]; | ||
} | ||
} | ||
``` | ||
|
||
{% hint style="info" %} | ||
This feature has been available since <mark style="color:red;">v7.5.0</mark> | ||
{% endhint %} | ||
|
||
|
||
|
20 changes: 20 additions & 0 deletions
20
docs/advanced-usage/configuration/toolbars/toolbar-1/force-page-as-plain-text.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
description: toolbars.toolbar-1.force-paste-as-plain-text | ||
--- | ||
|
||
# Force Past as Plain Text | ||
|
||
<table><thead><tr><th width="390">Property Name</th><th width="152.33333333333331">Type</th><th>Default</th></tr></thead><tbody><tr><td>toolbars.toolbar-1.force-paste-as-plain-text</td><td>bool</td><td>false</td></tr></tbody></table> | ||
|
||
For certain cases, you may want to paste content from your clipboard as plain text, stripping away any HTML tags. | ||
|
||
By default, when pasting content into the editor, CKEditor will try to maintain the original content’s structure and keep the HTML in a safe way. However, if you’d prefer to paste content without any formatting and only as plain text, you can set <mark style="color:red;">`toolbars.toolbar-1.force-paste-as-plain-text`</mark> to <mark style="color:red;">`true`</mark> in the configuration. | ||
|
||
|
||
|
||
{% hint style="info" %} | ||
This feature has been available since <mark style="color:red;">v7.5.0</mark> | ||
{% endhint %} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters