Where to find CSS classes in rich text editor?
Go to rich text editor field of your template and make sure the source property of it is set to either Rich Text Full or Rich Text Medium It’s done. Check your item’s rich text editor field and you can see the list of css classes in the dropdown. If the classes are not there, clear your Sitecore Cache (/sitecore/admin/cache.aspx) and browser cache.
How to populate Trix editor with stored content?
To populate a with stored content, include that content in the associated input element’s value attribute. Always use an associated input element to safely populate an editor. Trix won’t load any HTML content inside a … tag.
How to insert HTML as an attachment in Trix?
To insert HTML as an attachment, create a Trix.Attachment with a content attribute and call the editor.insertAttachment method. The HTML inside a content attachment is not subject to Trix’s document conversion rules and will be rendered as-is.
How to insert and replace text in Trix?
To insert or replace text, begin by setting the selected range, then call one of the insertion methods below. Trix will first remove any selected text, then insert the new text at the start position of the selected range. To insert unformatted text into the document, call the editor.insertString method.
How to add custom CSS to custom RTE file?
One approach is to add a CSS class to the custom RTE CSS file and apply your style properties to it. This will expose the class in the dropdown and when an editor uses it, it will actually apply the styles:
How to create custom classes in Sitecore stack?
Remember to clear (browser) caches when you make changes to it (the css file gets cached). A method I much prefer for user-friendliness is to create a new paragraph type in the RTE Profile: This way you can choose the type of DOM element you want and can specify multiple classes.