Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined

15 views
Skip to first unread message

Mihai Petcu

unread,
Apr 16, 2019, 6:08:45 AM4/16/19
to google-apps-sc...@googlegroups.com
Hello all,

This is my attempt to create a refresh system for a Doc add-on sidebar and it works great except for when adding a new item at the end of the document.

You can replicate the behavior using the attached files:
- simply add the files to the editor in your own doc
- add a couple of lines of text, a list, anything you want
- open the console in the browser
- run the add-on and click around on text items the document (notice the console output with the type of the item you clicked)
- add any new text at the end of the document

Result:
Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined
.. and the add-on is broken

The issue manifests only if a call any method exposed by the Position Class, although I validate the return of DocumentApp.getActiveDocument().getCursor() as indicated in the example:

I am pretty sure it has something to do with the context of this I am passing as a second parameter using withUserObject.

Any hints to understand and resolve this error will be greatly appreciated.

Regards,
Mihai Petcu
files.zip
Reply all
Reply to author
Forward
0 new messages