read-only attributes

Post here questions and problems related to oXygen frameworks/document types.
odovao
Posts: 12
Joined: Tue Oct 04, 2016 12:18 pm

read-only attributes

Post by odovao »

Hi

Is is possible to mark a element's attributes read-only in CSS, but still be able to modify the element itself?

Version: Web author 18.0.0

Thanks
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: read-only attributes

Post by cristi_talau »

Hello,

In Web Author an attribute can be edited either inline using a form-control or by using the "Attributes" side-view.

If you want an attribute to be read-only, you can remove from CSS any form-control that edits that attribute. Regarding the "Attributes" view, we have Java API [1] that allows one to completely hide the attribute from the UI. To use this Java API, you should create a plugin [2].

Best,
Cristian

[1] https://www.oxygenxml.com/InstData/Edit ... playFilter
[2] https://www.oxygenxml.com/doc/versions/ ... ugins.html
odovao
Posts: 12
Joined: Tue Oct 04, 2016 12:18 pm

Re: read-only attributes

Post by odovao »

Hi,

I have implemented a CustomProtocolPlugin (this is working fine) and also an AuthorAttributesDisplayFilter, however how do I activate the filter?

Looking at other threads in the forum, it seems that I need to do this via WSAuthorEditorPageBase. Where/how do I get an instance of WSAuthorEditorPageBase so that I can add the filter to it?

Thanks,
Oscar
Gabriel Titerlea
Site Admin
Posts: 95
Joined: Thu Jun 09, 2016 2:01 pm

Re: read-only attributes

Post by Gabriel Titerlea »

Hello,

To add your filter you can implement a ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension and override the applicationStarted method:

Code: Select all

  @Override
public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
WebappPluginWorkspace workspaceAccess = (WebappPluginWorkspace) pluginWorkspaceAccess;

workspaceAccess.addEditingSessionLifecycleListener(new WebappEditingSessionLifecycleListener() {
@Override
public void editingSessionStarted(String sessionId, AuthorDocumentModel documentModel) {
documentModel.getAuthorAccess().getEditorAccess().addAuthorAttributesDisplayFilter(YOUR_FILTER_HERE);
}
});
}
To register the WorkspaceAccessPluginExtension you need to add it in the plugin.xml file of your plugin as follows:

Code: Select all

<extension type="WorkspaceAccess" class="com.example.YourWorkspaceAccessPluginExtension"/>
Best,
Gabriel
Stevee
Posts: 16
Joined: Wed Jan 12, 2022 6:17 pm

Re: read-only attributes

Post by Stevee »

Hi :)

I seem to have the same/ similar Use-Case.

I want to make some Attributes of XML-Tags to be not editable via the Attributes-Side View and the In-place Attributes Editor in Author Mode.

Instead of Web Author, i am using OxygenXMLAuthor Eclipse Plugin v24.0

Greetings,
Steffen
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: read-only attributes

Post by Radu »

Hi Steffen,
Here are some possibilities:

1) Remove the attribute completely from being displayed in the Attributes view, using the API Gabriel mentioned above which works also in the Eclipse plugin:
https://www.oxygenxml.com/InstData/Edit ... layFilter-
2) Use the API to set a document filter:
ro.sync.ecss.extensions.api.AuthorDocumentController.setDocumentFilter(AuthorDocumentFilter)
and avoid changing the value for that specific attribute, but the end user might still get confused as the value will remain editable in the Attributes view but when it gets committed it will not be inserted in the document.
3) If you edit your DITA framework customization in the Oxygen Preferences->"Document Type Associations" page, in the "Extensions" tab there is an extension named "Author Custom Attribute Value Editor" which can be set by you to your own Java class:
https://www.oxygenxml.com/doc/versions/ ... ditor.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply