Oxygen 15.2 just got released with lots of useful improvements:What's new in 15.2
And it also comes with many CSS improvements for customizing the Author Visual Editing Mode. I will go through the most interesting ones and give small examples where these new improvements may be handy in a real-world scenario.
CSS Level 3 structural pseudo-classes
All the CSS Level 3 structural pseudo-classes are now supported: :root, :last-child, :first-child, :nth-child,:nth-of-type, :not(), :empty, etc..
- You can use the nth-of-type selector to set certain background colors on odd
table lines and certain colors on even table lines like
this:
row:nth-of-type(odd){ background-color:yellow; } row:nth-of-type(even){ background-color:blue; } - Use the empty selector to instruct the user to insert some text in an empty
element like
this:
title:empty:before{ content:"Insert title content here:"; } - Use the last-child and first-child selectors to properly mark a sequence
of items using static content
like:
item:first-child:before{ content:"["; } item:after{ content:","; } item:last-child:after{ content:"]"; } - Use the not selector to match certain nodes which are not
empty:
title:not(:empty):before{ content:"["; } title:not(:empty):after{ content:"]"; }
CSS Subject Selector
p! indexterm {
content: oxy_label(text, "*", color, red);
}
CSS Hover and Focus pseudo-classes.
You can style your XML documents depending on the mouse and caret position over the document by using the :hover and :focus CSS pseudo-classes. This means you can implement progressive disclosure to show form control buttons on a certain element only when the mouse hovers over it.
Examples:
p:focus:after {
content: oxy_button(actionID, "paragraph");
}
table:hover:after{
content: oxy_button(actionID, "insert.table.row.below");
}
Gradually append or prepend static content using CSS selectors
The content used for the :before and :after pseudo-elements can be created incrementally from the content specified by the new properties. New Oxygen-specific CSS content properties: -oxy-append-content and -oxy-prepend-content can be used for this.
Localize Static Content in CSS
section:before{
content:"${i18n(section.name)}:";
font-size:large;
}
The key is then mapped using the translation file corresponding to the framework.
Contribute custom CSS selectors to the default CSS files used to render the document
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="http://www.oxygenxml.com/extensions/author/css/userCustom.css"
uri="custom.css"/>
</catalog>
and
add it to the list of XML catalogs in the Preferences->XML / XML
Catalog preferences page. indexterm{
border:1px solid black;
}