Page 1 of 1
Disable opening of conrefs when page is not editable
Posted: Wed Aug 12, 2015 7:11 pm
by dvezina
Hello,
I have a page that is not editable.
authorPage.setEditable(false);
If the DITA document contains conrefs, the user is able to open them. I want to disable the link - preferably without changing the style sheet and preferably through the plugin (not ExtensionBundle).
Ideas?
Thanks,
D
Oxygen 17.0
Plugin
Re: Disable opening of conrefs when page is not editable
Posted: Thu Aug 13, 2015 4:15 pm
by Radu
Hi Deanna,
There is also a contextual menu action for editing the referenced content which you can remove by setting a popup menu customizer
Code: Select all
WSAuthorEditorPageBase.addPopUpMenuCustomizer(AuthorPopupMenuCustomizer)
.
Going back to your problem, after you load the XML and call
authorPage.setEditable(false); you could also set a pseudo class on the root element like:
Code: Select all
authorPage.getDocumentController().setPseudoClass("read-only", authorPage.getDocumentController().getAuthorDocumentNode().getRootElement());
Then we need to somehow change the rendering of the reference based on this pseudo style.
You would need a custom CSS content like:
Code: Select all
@namespace oxy "http://www.oxygenxml.com/extensions/author";
:root:read-only oxy|reference:before {
content: "" !important;
}
If you want to provide it via a plugin you could add a custom URI resolver:
Code: Select all
ro.sync.exml.workspace.api.util.XMLUtilAccess.addPriorityURIResolver(URIResolver)
and when you receive a callback for an input source which has the URI "
http://www.oxygenxml.com/extensions/aut ... Custom.css"
try to resolve it to a source which has an URL pointing to a CSS resource with the content I suggested above from the plugin folder.
In Oxygen 17.1 you will be able to contribute directly a custom CSS via a special plugin extension type.
Regards,
Radu
Re: Disable opening of conrefs when page is not editable
Posted: Sat Aug 15, 2015 11:15 pm
by dvezina
THANKS!