When embedding media like a PDF document in Drupal 8’s WYSIWYG, the default option is to link the label to the media entity. So the user would first click on that link and then click again on the file URL in order to see the PDF. In most cases, we want the user to go directly to the file. Here is one way of doing that:

  • create embed button and add it to the editor
  • Change File field label to “hidden” and Format to “Generic file” at /admin/structure/media/manage/file/display
  • When embedding the document, select “Display as: Full content”:

media embed dialog

Resources