Closed (fixed)
Project:
Gutenberg
Version:
8.x-1.9
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Oct 2019 at 14:28 UTC
Updated:
24 Apr 2020 at 00:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
aaronpinero commentedI would like to second this request. This is a must have for any site where website governance and enforced style standards are important . I cannot use this module on a production site without these sorts of controls. Ideally, they could be connected to Drupal permissions, but it would also be great if text sizing and color options could just be switched off.
Comment #3
james hawthorn-byng commentedI would also love to see this. The above comments are right, you can't really use this is a customers production site without being able to customise these options.
As it is already available in the WordPress version, I would be surprised if its not already in the stable release somehow but just not documented.
If this is the case, some extra documentation on https://www.drupal.org/docs/8/modules/gutenberg/create-a-custom-palette-in-a-theme would be great.
Comment #4
james hawthorn-byng commentedI am adding a patch to allow for the gutenberg.yml file to be able to override some more of the editor options, specifically:
You and then override these settings in your themes gutenberg.yml file (mytheme.gutenberg.yml) under `theme-support`.
E.G.
The only thing I cant workout is when you enable disableCustomFontSizes, it removed the text field to input the custom size, but doesn't remove custom from the select list. If any one else can would that bit out, it would be greatly appreciated.
The patch applies to the current dev version.
Comment #5
james hawthorn-byng commentedThis patch is for the current 8.x-1.10 release if anyone wanted to try it in a development environment.
Comment #6
james hawthorn-byng commentedComment #7
codebymikey commentedI appreciate the implementation.
But I think the patch needs to be applied to the gutenberg.es6.js file instead, then built by running
npm build.Comment #8
james hawthorn-byng commentedThanks codebymikey!
It took ages to get npm run build to work correctly as it wouldn't install from the package.json correctly fyi.
Attaching the patch to the es6 file.
Comment #9
codebymikey commentedHi @James Byng,
I meant that the patch would need to include both
gutenberg.es6.jsandgutenberg.js.Your main code changes would be to
gutenberg.es6.js, then the npm command should generate the relevantgutenberg.jsfile (which is what is used by Drupal).I like the addition of the
themeSupportvariable. It makes the code much cleaner, it can be used on the following block code as well.I personally feel the ideal solution would be to merge
drupalSettings.gutenberg['theme-support']into the originaleditorSettingsvariable. This way it's future-proof against any new theme APIs the Gutenberg editor supports, and it's up to the theme developer to specify that they want support for it.Comment #10
james hawthorn-byng commentedAh damn, sorry. I wasn't sure how the code was being built when packaged up to drupal.org. I assumed it might build it.
Ok, here is another patch for the es6 file and includes the generated gutenberg.js file.
I have also included the changes to the colors and the fontSizes constants to use the theme support variable.
I'm not really sure what you mean by that last bit as I'm a php dev really and not exactly the best at JS. I more figured this bit our by accident. I might leave that part up to someone else.
Comment #11
codebymikey commentedMerges the current theme's
theme-supportvalues into the editor settings. This future-proofs the module against future theme supports changes. The crucial editor settings won't be overridden.Also fixed an optimization issue where
_gutenberg_get_default_theme_settingsrepeats thefile_existschecks unnecessarily whentheme.gutenberg.ymldoesn't exist.Comment #13
marcofernandes commented