How can I set default text in a RichEditor?

I want the content to display some custom text instead just being blank. Things like textInputs support ->default() but that doesn't seem to work for RichEditors. RichEditor::make('summary') ->default('my default text')
Solution:
Think I've found a workaround: `->formatStateUsing(function ($state) { if ($state) { return $state;...
Jump to solution
7 Replies
LeandroFerreira
LeandroFerreira3mo ago
It supports. Any console errors?
urbycoz
urbycozOP3mo ago
No, none
Solution
urbycoz
urbycoz3mo ago
Think I've found a workaround: ->formatStateUsing(function ($state) { if ($state) { return $state; } else { return 'my default text'; } }) Not sure if there's a better way though.
LeandroFerreira
LeandroFerreira3mo ago
default() only works in the create page if you are using the panel builder
urbycoz
urbycozOP3mo ago
Ah ok. So is my approach the only way?
LeandroFerreira
LeandroFerreira3mo ago
yes, you can use formatStateUsing
urbycoz
urbycozOP3mo ago
Cool thanks
Want results from more Discord servers?
Add your server