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:
Not sure if there's a better way though.
->formatStateUsing(function ($state) {
if ($state) {
return $state;
}
else {
return 'my default text';
}
})Not sure if there's a better way though.