-
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 #145 from mostafaznv/dev
feat: alert before unsaved changes #144
- Loading branch information
Showing
7 changed files
with
121 additions
and
21 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
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/alert-before-unsaved-changes.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: alertBeforeUnsavedChanges | ||
--- | ||
|
||
# Alert Before Unsaved Changes | ||
|
||
<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> | ||
|
||
This feature is enabled by default and triggers an alert if a user attempts to navigate away or refresh the page without saving CKEditor content, just like other form fields in Nova. | ||
|
||
|
||
|
||
|
||
|
||
```php | ||
use Mostafaznv\NovaCkEditor\CkEditor; | ||
|
||
class Article extends Resource | ||
{ | ||
public function fields(Request $request): array | ||
{ | ||
return [ | ||
CkEditor::make(trans('Content'), 'content') | ||
->alertBeforeUnsavedChanges() | ||
]; | ||
} | ||
} | ||
``` | ||
|
||
{% hint style="info" %} | ||
This feature has been available since <mark style="color:red;">v7.6.0</mark> | ||
{% endhint %} | ||
|
||
|
||
|
20 changes: 20 additions & 0 deletions
20
...advanced-usage/configuration/toolbars/toolbar-1/alert-before-unsaved-changes.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.alert-before-unsaved-changes | ||
--- | ||
|
||
# Alert Before Unsaved Changes | ||
|
||
<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.alert-before-unsaved-changes</td><td>bool</td><td>true</td></tr></tbody></table> | ||
|
||
This feature is enabled by default and triggers an alert if a user attempts to navigate away or refresh the page without saving CKEditor content, just like other form fields in Nova. | ||
|
||
if you’d rather disable this behavior, simply set <mark style="color:red;">`toolbars.toolbar-1.alert-before-unsaved-changes`</mark> to <mark style="color:red;">`false`</mark> in the configuration. | ||
|
||
|
||
|
||
{% hint style="info" %} | ||
This feature has been available since <mark style="color:red;">v7.6.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