Skip to content

TagSpaces is an offline, open source, document manager with tagging support

workarrounding issue with content loading

uggrockcf0687bb5bcc
diff --git a/data/ext/editorHTML/extension.js b/data/ext/editorHTML/extension.js
index fd96cdbdc..84dbb0848 100644
--- a/data/ext/editorHTML/extension.js
+++ b/data/ext/editorHTML/extension.js
@@ -86,7 +86,15 @@ define(function(require, exports, module) {
// removing all scripts from the document
var cleanedBodyContent = bodyContent.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");
- document.getElementById("iframeViewer").contentWindow.setContent(cleanedBodyContent);
+ var contentWindow = document.getElementById("iframeViewer").contentWindow;
+ if(typeof contentWindow.setContent === "function") {
+ contentWindow.setContent(cleanedBodyContent);
+ } else {
+ // TODO optimize setTimeout
+ window.setTimeout(function() {
+ contentWindow.setContent(cleanedBodyContent);
+ }, 500);
+ }
};
var contentVersion = 0;