Skip to content

Commit 90f34bf

Browse files
committed
wip
1 parent b5109e1 commit 90f34bf

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

fields.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,40 @@ $field->max(now()->addDays(7));
229229

230230
### Editor
231231

232+
The `Editor` field is typically a handler for `text` model attributes (HTML). The `Editor` field is a [Tiptap](https://tiptap.dev/product/editor) editor combined with [alpine](https://alpinejs.dev/):
233+
234+
```php
235+
$field = Editor::make(__('Content'), 'content');
236+
```
237+
238+
The `root.php` config file contains the default configuration for each editor instance. You may edit the config file or you can also customize the configuration per instance:
239+
240+
```php
241+
$field->withConfig(static function (array $config): array {
242+
return array_merge($config, ['autofocus' => true]);
243+
});
244+
```
245+
246+
It is also possible using the [Media Library](#media) with the `Editor` field to insert existing media files or upload new ones:
247+
248+
```php
249+
$field->withMedia();
250+
251+
// or you may customize the media field
252+
$field->withMedia(static function (Media $media): void {
253+
$media->withRelatableQuery(static function (Request $request, Builder $query): Builder {
254+
return $query->where('user_id', $request->user()->getKey());
255+
});
256+
});
257+
```
258+
259+
You can also apply modifiers on a `Editor` field:
260+
261+
```php
262+
// Sets the editor height
263+
$field->height('300px');
264+
```
265+
232266
### File
233267

234268
### ID

0 commit comments

Comments
 (0)