Edit source code in text content

How can I edit source code in the html-area inserted directly in Enonic using the built-in text content? The html-area used in content types has a button for editing source code, but I can’t find this button in the text content toolbar.

At the moment it is not possible I guess, we have not exposed that “button” in the inline editor.

On the project I work on, our client would like to be able to set certain css classes on text content in admin. Since the “source code” functionality is exposed in a content’s HtmlArea we are able to use this to set css classes. It would be very helpful to us if we could have this same functionality in the inline editor as well.

To take it a step further, I really miss the opportunity to define a set of css classes that can be selected in the HtmlArea, like you have in Enonic 4.7.

Would it be possible for you to create an Editor Macro that adds the proper classes in the content?
The first input field in the macro could be a Tag input where the users could input the class names. Then the second input field could be the actual text or markup.

Unfortunately for the second input field, you can’t have an HtmlArea input type in an Editor Macro, so you can’t use that to create “snippets of an HtmlArea”, but you can use either a TextLine for inline text or a TextArea if you want users to be able to write HTML markup that you then unescape and convert to raw HTML source code.

We are aware of the css styling feature, consider it added to the backlog :slight_smile:

1 Like

The source button for text components is available from version 6.8.

We’re looking into supporting styles in the editor.