calling focusView with Web Author

Post here questions and problems related to oXygen frameworks/document types.
ojanen
Posts: 2
Joined: Fri Oct 26, 2018 10:53 am

calling focusView with Web Author

Post by ojanen » Fri Oct 26, 2018 11:14 am

Hello

I am trying to automagically expand the Validation side view after opening Web Author.
I am calling workspace.getViewManager().focusView('validation-panel-table') in my plugin.js but I get error
"workspace-22991562a3.js:3699 Uncaught TypeError: Cannot read property 'focus' of undefined
at sync.view.WorkspaceViewManager.focusView"

After the Editor is loaded I can call workspace.getViewManager().focusView('validation-panel-table') in browser console the Validation side view is expanded.

What is the proper place to call focusView? Is there another way to expand Validation side view?

Thanks,
Manu

Gabriel Titerlea
Posts: 40
Joined: Thu Jun 09, 2016 2:01 pm

Re: calling focusView with Web Author

Post by Gabriel Titerlea » Fri Oct 26, 2018 2:58 pm

Hello,

To expand the validation side-view after opening a document you can use the EDITOR_LOADED event [1].

Code: Select all

goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
// You will have to use setTimeout because the side-views are shown immediately after the EDITOR_LOADED event.
setTimeout(function () {
workspace.getViewManager().focusView('validation-panel-table')
});
});
Best,
Gabriel

[1] https://www.oxygenxml.com/maven/com/oxy ... Event.html

ojanen
Posts: 2
Joined: Fri Oct 26, 2018 10:53 am

Re: calling focusView with Web Author

Post by ojanen » Fri Oct 26, 2018 3:23 pm

Hello

I was missing the setTimeout-function.
Thanks!

Post Reply