redactor icon indicating copy to clipboard operation
redactor copied to clipboard

HTML button for non-admin users

Open fvwanja opened this issue 2 years ago • 1 comments

Description

Since https://github.com/craftcms/redactor/issues/129 we have a checkbox in each Redactor field, that let's us choose, whether the "HTML" button should be visible for non-admin users or not (see screenshot). 👍

Screenshot 2024-01-04 at 14 16 49

I just made a website for a client and have now received a request that another user group should also have access to the "HTML" button function. Now I have to go through all 57 Redactor fields manually to make that change. I also don't have the possibility of setting the authorisation for one or more user groups. It is only possible to select administrators or non-administrators. 😥

@andris-sevcenko stated in https://github.com/craftcms/redactor/issues/129#issuecomment-477912799, that the user could then just edit the HTML via the inspector. Yeah well. We can hack ourselves if we wanted to but I don't see that as an argument that should count since Redactor eating whatever HTML we feed it, is a matter of validation: I even declare which arguments, styles and elements I want to keep in my Redactor configuration file (config/redactor/foo.json). Shouldn't that prevent any manual manipulation that does not follow the rules? 🙈

How about a command for the command line, something like:

./craft  redactor/allow-html-for-admin-users-only
./craft  redactor/allow-html-for-non-admin-users

that could switch all 57 redactor fields at once!? It would really make things so much easier 🙏

🙂 Merci 👍

Steps to reproduce

  1. Create a redactor field
  2. Ticket the Checkbox Show the “HTML” button for non-admin users

Additional info

  • Craft version: 4.5.14
  • PHP version: 8.2.0
  • Database driver & version: MySQL 5.7.39
  • Plugins & versions: Redactor 3.0.4

fvwanja avatar Jan 04 '24 14:01 fvwanja

Provided the project uses .yaml files, another solution could be to search for showHtmlButtonForNonAdmins: false in all .yaml files and replace it with showHtmlButtonForNonAdmins: true and then running

./craft project-config/apply

🫠

fvwanja avatar Jan 04 '24 14:01 fvwanja