TwisterMc / pdfjs-viewer-shortcode

A Wordpress plugin for embedding PDFs using Mozilla's Excellent PDF.js
https://wordpress.org/plugins/pdfjs-viewer-shortcode/
Apache License 2.0
7 stars 5 forks source link

Add setting to disable editing buttons #34

Open ct-martin opened 4 days ago

ct-martin commented 4 days ago

Re: my post on the support forum, https://wordpress.org/support/topic/request-add-additional-toggles/

This is mostly a copy-paste of the code for the other buttons (the search button for the settings, and download/print buttons for the viewer).

I figured that for most sites this toggle should be global; I can't think of many reasons why someone would want to toggle at a block level but I can think of a lot of reasons why someone would want to turn this off for all files (and it was easier to implement). The default is to show the buttons to match the current default.

A small extra is that is removes the separator bars (the |) if the relevant section isn't used.

Tested with both the Gutenberg Block & the shortcode. Here's a screenshot with the editing buttons off but the save & print buttons on:

image

I haven't done PHP in quite a few years; this is fairly simple but please feel free to leave any comments.