Selecting among CSS alternatives by hotkey
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 17
- Joined: Fri Dec 12, 2014 5:59 pm
Selecting among CSS alternatives by hotkey
Post by PaulHayslett »
My apologies if this has been covered before...
My client wants a hotkey which will toggle between 2 CSS stylesheets in Author mode. The stylesheets are set up in our custom framework -- the users can switch back and forth using the "Author CSS Alternatives" toolbar dropdown. The client just wants to be able to do this without needing to use the mouse.
Is there a way to attach a hotkey to the items in that toolbar dropdown? Failing that, is there an easy way to set up an action which selects the stylesheet? Failing that, can someone point me to the API class which controls the current stylesheet? (Sorry, I can never seem to find anything in javadocs.)
Thanks in advance.
My client wants a hotkey which will toggle between 2 CSS stylesheets in Author mode. The stylesheets are set up in our custom framework -- the users can switch back and forth using the "Author CSS Alternatives" toolbar dropdown. The client just wants to be able to do this without needing to use the mouse.
Is there a way to attach a hotkey to the items in that toolbar dropdown? Failing that, is there an easy way to set up an action which selects the stylesheet? Failing that, can someone point me to the API class which controls the current stylesheet? (Sorry, I can never seem to find anything in javadocs.)
Thanks in advance.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Selecting among CSS alternatives by hotkey
Hi Paul,
Unfortunately we do not yet have a feature for this. We'll consider adding this in a future Oxygen version.
An alternative if the alternate CSSs are not that different would be not to use alternate CSSs at all but to have a single CSS with custom pseudo classes set on certain selectors.
For example you can use a non standard (custom) pseudo class to impose a style change on a specific element. For instance you can have CSS styles matching a custom pseudo-class, like the one below:
By default a section will be a block element. But by setting the pseudo class "simplified" on the root element, all sections will be hidden.
To change the pseudo class on a certain element you can create a custom Author Action (and add it to the toolbar for example). The action can use a particular available operation called ro.sync.ecss.extensions.commons.operations.TogglePseudoClassOperation to set or reset a pseudo class value on a certain element. And used-defined Author extension actions can be assigned keyboard shortcuts.
Regards,
Radu
Unfortunately we do not yet have a feature for this. We'll consider adding this in a future Oxygen version.
An alternative if the alternate CSSs are not that different would be not to use alternate CSSs at all but to have a single CSS with custom pseudo classes set on certain selectors.
For example you can use a non standard (custom) pseudo class to impose a style change on a specific element. For instance you can have CSS styles matching a custom pseudo-class, like the one below:
Code: Select all
:root:simplified section {
display:none;
}
.....
section {
display:block;
}
To change the pseudo class on a certain element you can create a custom Author Action (and add it to the toolbar for example). The action can use a particular available operation called ro.sync.ecss.extensions.commons.operations.TogglePseudoClassOperation to set or reset a pseudo class value on a certain element. And used-defined Author extension actions can be assigned keyboard shortcuts.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 17
- Joined: Fri Dec 12, 2014 5:59 pm
Re: Selecting among CSS alternatives by hotkey
Post by PaulHayslett »
Thank you for the reply.
I think the pseudo class suggestion will work. As it happens, the two CSSs currently differ only in that one element is hidden in one of them, just as in your example. (In fact, that one is implemented by @import-ing the other CSS and overriding that one element's style.) So your example is a perfect fit.
Thanks again.
I think the pseudo class suggestion will work. As it happens, the two CSSs currently differ only in that one element is hidden in one of them, just as in your example. (In fact, that one is implemented by @import-ing the other CSS and overriding that one element's style.) So your example is a perfect fit.
Thanks again.
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service