Closed proArtex closed 4 years ago
I was looking for how to prevent users from using some of the heading levels too.
Sorry, my bad
ugly but works:
.cdx-settings-button[data-level='1'],
.cdx-settings-button[data-level='4'],
.cdx-settings-button[data-level='5'],
.cdx-settings-button[data-level='6'] {
display: none;
}
I used the same method for hiding image options but it had an explicity classname so using the above method with -settings- might break other plugin options that has levels
.image-tool__tune {
display: none;
}
Or extend Header class
class MyHeader extends Header {
get levels() {
return super.levels.filter((l: any) => [2, 3, 4].includes(l.number));
}
get defaultLevel() {
/**
* Use H2 as default header
*/
return this.levels[0];
}
}
Even though it is possible to extend, it would be nice to see this built in as an option.
I agree, it would be nice!
@igorivaniuk Extending like you did doesn't work for me:
Type 'typeof CustomHeading' is not assignable to type 'BaseToolConstructable'. Property 'render' is missing in type 'CustomHeading' but required in type 'BaseTool'.
If I use heading: CustomHeading as BaseToolConstructable,
it will build (and work..) but still throw an error in the terminal.
It can be done by adding a corresponding config option. You are welcome to implement this feature and send a PR.
Extending doesn't work for me
SyntaxError: Unexpected token ':'. Expected ')' to end a compound expression.
It seems like levels are hardcoded and cannot be set. What if I want to put H1 only?