Document.write on Text Editor
Embedding GitHub Gist was painful in the editor for GoNevis.com.
For example, you want to embed via:
That would cause annoying error:
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
How we solved it
There were many solutions to handle it, but most of them were not working for us properly, we needed it to have it working on 3 places:
- Text Editor.
- GoNevis Dash Reader.
- Post Detail page on the blog .
What we did was, we made a proxy to handle it.
This issue has been solved by using a proxy which will not require any weird behavior while using the text editor on GoNevis Dashboard.
We created a page on GoNevis.com that will receive the GitHub Gist URL form the query parameters in the URL:
That's basically it!
Pasting the GitHub Gist link into the editor would do the job pretty easy now.
Happy hacking <3
Alireza Savand • 2018 Dec 18