Hide side view and main toolbar in WebApp

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
vitorhugovm
Posts: 31
Joined: Fri Jan 26, 2024 3:31 pm

Hide side view and main toolbar in WebApp

Post by vitorhugovm »

Hello!

I have a side view that utilizes some Oxygen original views, as Find/Replace, Review, Validation... and also some custom views. I want this side view to be hidden when the document is opened.
I looked for it on sync.view.ViewManager, but I didn't find any function that does this. It can only be set when the view is being installed by sending initiallyClosed: true in the options, but this is just for the custom views, since there is no function that returns the Oxygen original view so I can reinstall with other options.

I also wanted to be able to hide the main toolbar. The function hideAppBar() hides the header toolbar. What I want is to hide as well the other toolbar in which the content from the header is migrated.

I also tried using the Java API as I saw in another post in the forum, but it threw an error saying that the function is not available in WebApp and that I should use ViewManager in JavaScript.
How could I solve this issues?

Thanks!
Vitor
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: Hide side view and main toolbar in WebApp

Post by Bogdan Dumitru »

Hello,

There is no public API to close all the side-views. However there is a method but it uses non-API and might break in future releases:

Code: Select all

workspace.layoutManager.closeWestPane();
workspace.layoutManager.closeEastPane();
Regarding toolbars, to remove a toolbar you have to use the sync.api.Editor.EventTypes.ACTIONS_LOADED event that gives you access to the toolbars descriptor: "e.actionsConfiguration.toolbars". This is a list with all the toolbars containing for each toolbar the list of object. You can try removing the toolbar from the list or make it empty. You can see here a tutorial that adds an action to a toolbar that uses the ACTIONS_LOADED event.
Bogdan Dumitru
http://www.oxygenxml.com
cristi_talau
Posts: 513
Joined: Thu Sep 04, 2014 4:22 pm

Re: Hide side view and main toolbar in WebApp

Post by cristi_talau »

Hello,

We want to implement an API that will work for you also in future versions. To implement this API and to make sure it solves your problem, we want to make sure we understand your use-case, so it would be great give use more details about your final goal and answer these questions:
  • Do you want to remove the toolbar, or to hide it such that an user can reveal it when needed?
  • Side-view state in Web Author have memory. Once you close them, they will remain closed also when you open other documents. Please give us more details on how the fact that the views are initially open affects your users.
Best,
Cristian
vitorhugovm
Posts: 31
Joined: Fri Jan 26, 2024 3:31 pm

Re: Hide side view and main toolbar in WebApp

Post by vitorhugovm »

Hello Bogdan and Cristian!

Bogdan's response worked for both cases! Thanks!

Regarding my goals that lead me to these issues, my initial goal was to create an iframe with another Oxygen editor opened inside, this editor is used only for selection, so it always have readOnly status set to true and sends some info to the parent Oxygen frame.
I retrieve the needed info in the parent frame by getting the global workspace variable from the child frame, then listening to it's EDITOR_LOADED and calling some operation through ActionsManager.
The frame is located inside a dialog, so the view becomes a bit small. Because of it, I wanted to always hide the side-view when the frame is opened and remove the toolbar so the editor height gets bigger, letting the user have a better visualization.

I never realized that the open state of the side view is persistent through different docs until now. Knowing this, I understand that can be complicated to hide the view directly using some function that can be called at anytime, but I think it would be a good addition to the ViewManager API.
To be honest, when I was trying to solve this I found kind of awkward not having this option of hiding the side view through ViewManager. For me, really looks like it should be there in some way.
I don't think I will keep using the function that Bogdan shared, since he said that it might break in future, so if you release this possible new function, I will definitely use it to enhance the frame behavior.

For this case in specific, just removing the toolbar works perfectly as it has few or none usages, but in all cases I find it really interesting giving the user the possibility of manually toggling it with a button.

Thanks for the attention and quick response!
Vitor
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: Hide side view and main toolbar in WebApp

Post by Bogdan Dumitru »

Hi,

So you have an iframe with Web Author inside a dialog. Well, if you want to render an editor inside an dialog without iframes, especially an read-only editor you should use the sync.api.Editor.loadPreview API. This API allows to render an editor in an element, without an iframe.
Bogdan Dumitru
http://www.oxygenxml.com
vitorhugovm
Posts: 31
Joined: Fri Jan 26, 2024 3:31 pm

Re: Hide side view and main toolbar in WebApp

Post by vitorhugovm »

Hello!

I tried the loadPreview function, it works well, but with it I can't access the side view.
In this use case the Search and other views are still useful to find the selection.
Is there a way to show the side view on this mode?

Thanks!
Vitor
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: Hide side view and main toolbar in WebApp

Post by Bogdan Dumitru »

Hi,

It's not possible to show side-views while using sync.api.Editor.loadPreview function. But we might be able to give you a better solution if you could elaborate a little more your use-case. We have a few questions like why is the selection important, what is the purpose of the dialog, why do you use the search side-view, what other side-views are important for you?

If you don't feel comfortable elaborating your use-case on this public channel, we can continue the discussion via email on support@oxygenxml.com.
Bogdan Dumitru
http://www.oxygenxml.com
vitorhugovm
Posts: 31
Joined: Fri Jan 26, 2024 3:31 pm

Re: Hide side view and main toolbar in WebApp

Post by vitorhugovm »

Hello!

Apologies for the delay to respond. The purpose of the dialog is to select an element from another document by it's XPath.
There are two different XMLs that are connected. In one of them exists elements that have the attribute "path", in which it's value must be referencing a node from the other paired document through the XPath value.
When the user wants to edit the "path" attribute, a button is pressed, opening the dialog with the iframe.
The selection is made with the caret move. I built a Java operation that returns the needed information and connected it with a Caret listener.
As the user can select any element that has ID and the document could be extensive, the side-view becomes really useful, as the user can use it to easily locate what he needs.
The only default Oxygen view that is not that useful in this case is the Review panel. Even Validation panel could help.

Thanks!
Vitor
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: Hide side view and main toolbar in WebApp

Post by Bogdan Dumitru »

Hi Vitor,

Not sure that I've understood your user-case.
So you reference a location from another document via a "path" attribute that's actually an XPath. Do you try to implement some kind of content referencing like the "x:include" or "conref" attribute from DITA or some kind of XLink?

If you want to allow just selecting elements with ID maybe you can implement a filter or a dropdown or radio buttons to select the desired element by id and put this above the editor. And when selecting an ID you can also change the selection in editor.
Bogdan Dumitru
http://www.oxygenxml.com
vitorhugovm
Posts: 31
Joined: Fri Jan 26, 2024 3:31 pm

Re: Hide side view and main toolbar in WebApp

Post by vitorhugovm »

Hello!

I'm currently satisfied with the results using iframe and hiding the main toolbar.
Just to be sure, could there be any problem caused by using iframe?

Thanks!
Vitor
Bogdan Dumitru
Site Admin
Posts: 163
Joined: Tue Mar 20, 2018 5:28 pm

Re: Hide side view and main toolbar in WebApp

Post by Bogdan Dumitru »

Hi,

There is no problem with the iframe approach apart from the inherent complexity, more precisely the communication between the two frames.
Bogdan Dumitru
http://www.oxygenxml.com
Post Reply