generated from filamentphp/plugin-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
66 additions
and
4 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
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
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,38 @@ | ||
# JavaScript Hooks | ||
|
||
JavaScript hooks allow you to run custom code at specific points in the preview modal lifecycle: | ||
|
||
| Event | Description | | ||
|---|---| | ||
| `peek:initializing` | Runs once, before the plugin is initialized. | | ||
| `peek:initialized` | Runs once, after the plugin is initialized. | | ||
| `peek:modal-initializing` | Runs once, before the Alpine component is initialized. | | ||
| `peek:modal-initialized` | Runs once, after the Alpine component is initialized. | | ||
| `peek:modal-opening` | Runs every time, before the preview modal opens. | | ||
| `peek:modal-opened` | Runs every time, after the preview modal opens. | | ||
| `peek:modal-closing` | Runs every time, before the preview modal closes. | | ||
| `peek:modal-closed` | Runs every time, after the preview modal closes. | | ||
|
||
Example: | ||
|
||
```js | ||
document.addEventListener('peek:modal-closing', (e) => { | ||
console.log('The modal is closing...'); | ||
|
||
// You can access the full modal instance in `e.detail.modal` | ||
if (e.detail.modal.withEditor) { | ||
console.log('I hope you enjoyed using the new Builder Preview!'); | ||
} | ||
}); | ||
``` | ||
|
||
Have a look at the [Including Frontend Assets](https://filamentphp.com/docs/2.x/admin/appearance#including-frontend-assets) section of the Filament documentation to learn how to load custom JavaScript files into your admin pages. | ||
|
||
--- | ||
|
||
**Documentation** | ||
|
||
- [Configuration](./configuration.md) | ||
- [Page Previews](./page-previews.md) | ||
- [Builder Previews](./builder-previews.md) | ||
- [JavaScript Hooks](./javascript-hooks.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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.