make action disable in read only mode

Are you missing a feature? Request its implementation here.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

make action disable in read only mode

Post by shikhar_472 »

Hi Team,

I want to disable the action button in read only mode and enable the actions when read only mode is false in web author.
i have tried passing isenabled(){return false} which is making the button disable now i want to enable this without reloading the web author.

Could you please help me with that.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: make action disable in read only mode

Post by shikhar_472 »

Hi Team,

I have one more query on undo operation phesudo classes are not getting back is there any way to resolve this.
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: make action disable in read only mode

Post by Bogdan Dumitru »

Hello,

To make a Web Author action (sync.api.AbstractAction) disabled or enabled depending on the read-only state of the editor (or of the document) you have to implement the isEnabled() method and return true and false depending on the read-only state. Somewhat like this:
"return this.editor_.getReadOnlyState().readOnly".

See also this forum post and the sync.api.ActionsManager.html#refreshActionsStatus API.
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: make action disable in read only mode

Post by Bogdan Dumitru »

Regarding "one more query", please provide more information. What are you trying to solve exactly?

By the way, I think it would be great to post on a dedicated thread on the Oxygen Forum because that way you have higher chances to be helped by other people too, not just from the people interested in "make action disable in read only mode" thread.
Bogdan Dumitru
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: make action disable in read only mode

Post by shikhar_472 »

Hi Thanks for the reply,

Now user's want's some of actions should not be visible itself in read only mode they want icons to be non visible and when read only mode false that time icons should be visible as they want to use use only few operations in read only mode so they dont want to see others in disable mode they want them to be hidden.
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: make action disable in read only mode

Post by Bogdan Dumitru »

Hi,

Does the How to Remove a Toolbar Button topic from the Oxygen XML Web Author JavaScript API manual helps?
Bogdan Dumitru
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: make action disable in read only mode

Post by shikhar_472 »

yes but the moment read only mode is false i want all the buttons to be enable without loading the editor.
Using unregister action we can remove the button but the moment readonlymode set to false i want them back without loading the editor
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: make action disable in read only mode

Post by shikhar_472 »

Hi Team,

Is there any update?
Thanks
mihaela
Posts: 504
Joined: Wed May 20, 2009 2:40 pm

Re: make action disable in read only mode

Post by mihaela »

Hello,

There is no API available to add or remove buttons in the toolbar without reloading the editor.
It is possible only to update the enabled status of the action, as you already found.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: make action disable in read only mode

Post by shikhar_472 »

Hi,

I wanted to enable and disable the icon same way in right pane, the way i am doing in toolbar using isEnabled method but in right pane i am using view rendror is that possible to enable disable according to readonly mode in right pane
mihaela
Posts: 504
Joined: Wed May 20, 2009 2:40 pm

Re: make action disable in read only mode

Post by mihaela »

Hello,
Please answer the following questions to help us better understand your use case and provide a solution:
- Do you want to enable/disable the view icon or the icons of the actions included in the view?
- The read-only state of the editor changes dynamically, during the editing? Who changes this state? Do you use a customization for this, or a built-in plugin?

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply