Content of Editor not loading after hydration in Safari
I'm having problem in Safari with pasting 'content' field value into RichEditor field. I save some data (name, content), then immidiately open that data on modal as a form, my editor gets initialized but content doesn't get pasted into.
This works out of the box on firefox/brave, but on Safari 'content' field doesn't load, while the 'name' field does load. Furthermore, this only happens on first try of this flow, if I repeat this flow then it's loaded correctly (I'm assuming editor is by now loaded correctly and then content gets pasted correctly).
I tried to fix it by adding ->afterStateHydrated and it only works, when I'm dumping something, which is weird? if I remove the dump, it again doesn't work. Same thing happens if I turn on aand off the xdebugger? I'm really not sure anymore what to do here to load editor first and then when I can make sure it's loaded and ready to paste the content in?
RichEditor::make('content')
->required()
->maxLength(65535)
->afterStateHydrated(function (?string $state, $set, $get) {
// dump('works if I uncomment this');
// $set($get('content'), $state ?? ''); i get the correct value here and everything, it just doesn't paste it in
})
->disableToolbarButtons([
'attachFiles',
'blockquote',
'codeBlock',
'h2',
'h3'
])
->columnSpanFull()
->live(debounce: 2500)

1 Reply
Last bump, if anyone has an idea