craftcms / redactor

Edit rich text content in Craft CMS using Redactor by Imperavi.
https://plugins.craftcms.com/redactor
MIT License
100 stars 48 forks source link

HTML button for non-admin users #483

Closed fvwanja closed 2 months ago

fvwanja commented 10 months ago

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

fvwanja commented 10 months ago

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 commented 2 months ago

β€žDieses Plug-in wird nicht mehr weiterentwickelt. Der Entwickler empfiehlt, stattdessen CKEditor zu verwenden.”