Page 1 of 1

Activation Xpath for a custom javascript framework action

Posted: Thu Nov 30, 2023 12:11 pm
by NicoAMP
Hello,
When I create a custom framework action via the UI, I can setup an "activation Xpath" that permit to control when my action is available.
When I create a custom framework action with javascript I can use following function :

Code: Select all

MyAction.prototype.isEnabled = function () {
   return !this.editor.getReadOnlyState().readOnly;
};
But it seems that it's not possible to use an "activation Xpath" here.
So the question is : is it possible to setup an "activation Xpath" for a custom javascript framework action?

Thanks.
Regards,
Nicolas

Re: Activation Xpath for a custom javascript framework action

Posted: Thu Nov 30, 2023 1:36 pm
by mihaela
Hello,

You can read more details about the actions "activation XPath" in the Migrating a Framework from Oxygen XML Editor/Author to Web Author topic from our Oxygen XML Web Author Customization Guide.

If the configured activation XPath evaluates to false at the current cursor position, it does not disable the actions on the Web Author toolbar, but when the user tries to invoke an action, the operation will not be executed (if the XPath evaluates to false) and the user will be notified that the action is not available at that location.



Best Regards,
Mihaela

Re: Activation Xpath for a custom javascript framework action

Posted: Fri Dec 01, 2023 11:59 am
by NicoAMP
Hello Mihaela,

Thanks for this information.
But my question was more : how can I define an activation xpath with javascript code ?

Thanks.
Regards,
Nicolas

Re: Activation Xpath for a custom javascript framework action

Posted: Fri Dec 01, 2023 4:06 pm
by mihaela
Hello,

Sorry for not answering to your question exactly. You cannot define an activation XPath with javascript code. Some details about your use case can help us identify if there is another way to use the javascript API to accomplish what you need.

Best Regards,
Mihaela