context.document is null when  I  listen to 'OpenDocument'.
I want to add a sidebar when I open a document. So I listen to 'OpenDocument'. There is a line in my code:
const contentView = context.document.documentWindow().contentView();
But the context.document is null and the context. actionContext.document.documentWindow()
is null. So I can not get the contentView. 
After the document is opened, I run the command in menu and can get the contentView. So what should I do? Should I use another action?