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
https://filamentphp.com/docs/2.x/forms/fields#markdown-editor if you use this then there's
preview
toolbarButtonThanks for your reply! The toolbar is already set, but I'm looking to automatically switch to preview from by back-end code.
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.