This add-on provides the operation open-publication-preview. When invoked, this operation opens a modal containing an iframe that displays a CMS-generated preview of your document.
When it's not desired to open the preview in a modal the open-publication-preview-in-new-tab operation can be used, opening the preview in a new browser tab/window.
Additionally a download-publication-preview operation is provided, which downloads the requested preview. This operation should be used for file types that can't be displayed by the browser or when it's desired for the user to get the requested file on their filesystem.
All of the operations described above require the CMS to implement the document/preview endpoint and use it to serve a preview of the requested document in the desired format.
How to integrate this add-on
After integrating the add-on as usual, add a button to your toolbar to invoke the open-publication-preview operation.
By default, the operation opens a preview for the currently focused document. It can be passed a documentId to control the document being previewed. This allows it to be integrated in other operations. Additionally, the title and icon of the modal may be customized.