Forum
Additions to text area field type.
I'm aware that there is a 'imageclasses' attribute for text area, but I propose that you expand this support to encompass all kinds of html elements.
Thus, there would be one 'classes' attribute.
It would work as follows:
<perch:content id="body" type="textarea" label="Body" classes="img | my-image-class, p | my-paragraf-class, ul | my-list-class" />
etc.
It would also be awesome if there was a way for the user to create separate chunks of content in a text area. For instance, they could separate content by the: "[" and "]" tags. Then the developer could style this content with a custom class as needed.
One example is that of a grid. By allowing the user to add sections to the text area body, the developer could make sure that those sections were arranged in a grid once output to html.
So for the Perch text area field type, you could add support for a grid like so:
<perch:content id="body" type="textarea" allowsections="true" sectionsdivider="[ | ]" sectionclass="my-column-class" markdown="true" />
This would be an easy way to give the user a little more flexibility.
What would happen to these classes?
Whatever the author wanted:-) The uses are the same as for the 'imageclasses' attribute. It just gives the author a little extra flexibility.
It could be useful in order to differentiate html inserted by the user, and html that is already on the page, for instance.
I'm actually running into this already in my project. In an introduction region on the first page, I would like the paragraph to have the class "hero-paragraph". In this class, there are various media queries associated with 'hero-paragraph', and the responsive layout won't work without this class. Of course I could target this paragraph in my css file, but what if I add more paragraphs which shouldn't get this behavior? You can see how this can get messy.
As it stands now, I will have to wrap an extra span element around the paragraph created by 'textarea', and rename my class 'hero-paragraph-container'...
It sounds like you're after an addition to one of the editors. Which editor are you using?
Yes. I'm using the 'Markitup' editor.
I don't think Markitup offers the functionality you're looking for.
Ah, is it the markitup editor that offers the image class attribute?
No, that's a custom plugin we've developed for the editor to handle image uploads.