editor

Docs › Saving and output

Preview and print

Preview at phone, tablet and desktop width; print just the post.

The preview button shows the saved HTML the way readers will see it, at phone, tablet or desktop width, so you can check how images and tables fit. The print button prints just the post, without the toolbar.

Try it

Code for this demo

createEditor('#editor', {
  toolbar: 'heading | bold | image table | preview print',
  height: 300,
});

Preview

  • Pick Phone (360px), Tablet (768px) or Desktop (full width). It opens at Desktop.
  • It shows the getHTML() output, with the saved HTML extras such as fitted images and sideways-scrolling tables.
  • The toolbar item is preview, in the ⋯ menu of the board (default) and full presets.

Print

  • The getHTML() output goes into a hidden frame with a small print stylesheet, and the browser print dialog opens. No toolbar or editor border is printed.
  • A page break (pageBreak) starts a new sheet.
  • Checklists print as ☐ / ☑.
  • The toolbar item is print; only the full preset has it (in the ⋯ menu). Add it to toolbar yourself elsewhere.

Both work in read-only mode and while the source view is open. From code, call editor.exec('preview') or editor.exec('print').

Options

NameTypeDefaultDescription
previewtoolbar item-Preview dialog at phone, tablet or desktop width
printtoolbar item-Print the post only
exec('preview')method-Open the preview from code
exec('print')method-Open the print dialog from code