Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added settings controlpanel with custom css field #68

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pnicolli
Copy link
Collaborator

The frontend had a custom-css handler when we submitted the code, that is now creating errors in the browser because the corresponding backend service is missing. This PR solves the issue by adding the needed controlpanel and service, which I believe can be beneficial in the future.

The idea is to add a Plone.org Settings controlpanel, that has a Custom CSS field, used to add custom css to the site whenever needed in order to possibly make it faster to have custom styles or fixes.
Let me know if you like the idea, if anything is missing/wrong in the implementation (my backend-fu is not so good) and if you like the idea I will also produce an upgrade step for this.

@fredvd
Copy link
Member

fredvd commented Dec 10, 2022

So this works almost identical to the Custom Styles / Custom CSS option we have in the Plone 6 ClassicUI theme settings? Cool!

Could go straight into plone.volto as well IMHO :-)

custom-css-classicui

@pnicolli
Copy link
Collaborator Author

Yes, it works exactly the same. It would probably actually be better to expose the custom css in the theming controlpanel, instead of having a new field, but I don't know how to get that data. Probably the Theming controlpanel should be made available in volto with just the custom css field, but again I don't know how :D
...this PR is mainly a copy-paste of other code I had available :P

@sneridagh
Copy link
Member

@pnicolli Correct me if I'm wrong, but the action should be added as a content extender, then be extracted from there. Otherwise, in SSR the CSS won't be there, then a FUOC would happen. I know, because we've been experimenting with this as well. In fact, not with full arbitrary CSS, but with specific properties (eg. colors, fonts, etc), that we injected as CSS properties in the body itself as an inline style.

For the arbitrary CSS use case I'd also have a code editor (the one in HTML block would be great), and a formatter in the control panel widget.

@rioksane
Copy link
Collaborator

@pnicolli I love the idea! Cannot comment on how to best pull it off but that feature would bring even more power to TTW editors like me. A killer feature, for sure 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants