-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Tinymce customization #1807
Tinymce customization #1807
Conversation
Direct link to preview https://plone6--1807.org.readthedocs.build/classic-ui/tinymce-customization.html |
Co-authored-by: Peter Mathis <[email protected]>
@stevepiercy I've changed the order of information and enhanced it:
|
Restructure the .css file option to be more how-to guide-ish
@petschki I made a few more revisions to better explain why someone should choose one option over another, and turned the .css file option into more of a how-to-guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
Please note following the instructions of Edit the Formats option in the TinyMCE control panel will not add the new item to the "Format" menu. Editing the "Formats" JSON will only add the format to the configurations, but it will be still invisible in the TinyMCE's menu. E.g. "discreet" for classic demo portal is registered as one of the "Formats" in the JSON, but it is nowhere to be found in the TinyMCE menu. As a last step "Formats" must be registered under one of styles (in the case of "myformat", under "Block styles" of the controlpanel), only then will it pop up in the TinyMCE's menu. |
|
||
You can add a GenericSetup configuration file to your add-on, such as {file}`profiles/default/registry/tinymce.xml`, with the following content. | ||
|
||
```xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about
<records interface="Products.CMFPlone.interfaces.ITinyMCESchema" prefix="plone">
<value key="other_settings">
{
"extended_valid_elements":"i[class],script[type|src]",
"style_formats": [
{
"title": "Highlight",
"block": "p",
"attributes": {
"class": "featured"
}
},
{
"title": "Alert",
"block": "p",
"attributes": {
"class": "redalert"
}
}
],
"style_formats_merge": true
}
</value>
</records>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware: other_settings
will override all previously made settings. This is meant to inject settings which are not populated in other config fields.
And the style_formats_merge
options provides the default "tinymce styles" but that's not exactly the same as the plone default tinymce styles ...
@szakitibi yes you're right. forgot about that. But depending on the format you can also add it to the "Inline formats" |
Exactly. That is why I used "under one of the styles". The official documentation should be clear about this part, that the registered "formats" can be registered under different styles, and that will determine their position in the TinyMCE menu. |
Last but not least there should be a warning, that the provided genericsetup xml will kill the default formats. If those should be preserved, you need to copy them over to your |
Also another comment regarding the use of "formats" JSON. I think it is not possible to add top level items (like the |
I would be happy to accept a pull request with revisions to this document. These comments are great, but they won't get into the documentation unless someone who has the technical knowledge writes them up in PR. I do not have this technical knowledge. I am only a technical writer who translates Plone-ish to English and sprinkles some MyST syntax on top to make it pretty. Thanks for your collaboration. |
Closes #1806.
📚 Documentation preview 📚: https://plone6--1807.org.readthedocs.build/