Page 1 of 1

calling focusView with Web Author

Posted: Fri Oct 26, 2018 11:14 am
by ojanen
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

Re: calling focusView with Web Author

Posted: Fri Oct 26, 2018 2:58 pm
by Gabriel Titerlea
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

Re: calling focusView with Web Author

Posted: Fri Oct 26, 2018 3:23 pm
by ojanen
Hello

I was missing the setTimeout-function.
Thanks!