J'ai eu un problème pour un moment où le bouton d'éditeur visuel wordpress a cessé de fonctionner. L'éditeur de code était bien, et le bouton de l'éditeur visuel est présent mais en cliquant dessus n'a pas d'effet. Après beaucoup de bidouiller j'ai finalement découvert qu'il était rompu par mon contenu politique de sécurité!
One reason this was so difficult to diagnose is because I haven’t seen anyone else suggest CSP as the source of the problem, especially since I am using the “classic editor” plugin which most people seem to blame. The plugin, or wordpress itself, may be partly to blame as my CSP isn’t unreasonable, but clearly I needed to permit something else.
When I finally started digging through the console I found the following error (in Firefox): The page’s settings observed the loading of a resource at eval (“script-src”)
The Chrome console was much more helpful: “Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive”
So to get this working I will have to enable “unsafe-eval” which is annoying because this makes a content security policy largely pointless.
As more and more people implement CSP this will become more of an issue for the wordpress and plugin devs to resolve to hopefully in the longer term solutions will become available. Until then I will see if there is a workaround by removing inline and eval code.
The best information and guide I have found so far is at Color Blind Programming
Pense que nous avons manqué quelque chose? Faites-nous savoir en commentant ci-dessous. Si vous souhaitez vous abonner s'il vous plaît utiliser le lien d'abonnement dans le menu en haut à droite. Vous pouvez également partager avec vos amis en utilisant les liens sociaux ci-dessous. À votre santé.
Laisser un commentaire