Dynamically switch MarkdownEditor to preview mode?

Hi! I'm currently working on a custom page were the users can paste some data (for example for excel), which we validate and parse directly with the wire:paste action. Afterwards I would like to dynamically change the mode for the editor from Edit to Preview. Is this possible? Thanks in advance!
3 Replies
Vp
Vp2y ago
https://filamentphp.com/docs/2.x/forms/fields#markdown-editor if you use this then there's preview toolbarButton
TiBiBa
TiBiBaOP2y ago
Thanks for your reply! The toolbar is already set, but I'm looking to automatically switch to preview from by back-end code.
Patrick Boivin
I don't think there's simple way to do it from the back-end. The preview/edit tabs are handled in Alpine.js. You could use ->dispatchBrowserEvent() and have a bit of custom JS to trigger a click on the desired tab.
Want results from more Discord servers?
Add your server