SketchAPI icon indicating copy to clipboard operation
SketchAPI copied to clipboard

context.document is null when I listen to 'OpenDocument'.

Open Frida-Ma opened this issue 5 years ago • 1 comments

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?

Frida-Ma avatar Jun 12 '19 03:06 Frida-Ma

It's a known bug: https://sketchplugins.com/d/24-api-for-opened-document-url/5. We are currently revamping the entire actions architecture so we will look at it at the same time

mathieudutour avatar Jun 12 '19 12:06 mathieudutour