Page 1 of 1

read-only attributes

Posted: Fri Oct 14, 2016 12:02 pm
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

Re: read-only attributes

Posted: Fri Oct 14, 2016 2:17 pm
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

Re: read-only attributes

Posted: Wed Nov 09, 2016 3:30 am
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

Re: read-only attributes

Posted: Wed Nov 09, 2016 11:37 am
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

Re: read-only attributes

Posted: Thu Mar 10, 2022 6:11 pm
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

Re: read-only attributes

Posted: Fri Mar 11, 2022 7:55 am
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