diff --git a/plugins/image-dialog/image-dialog.js b/plugins/image-dialog/image-dialog.js
index 5cb042e..ac67731 100644
--- a/plugins/image-dialog/image-dialog.js
+++ b/plugins/image-dialog/image-dialog.js
@@ -31,13 +31,13 @@
cm.focus();
- var loading = function(show) {
+ var loading = function(show) {
var _loading = dialog.find("." + classPrefix + "dialog-mask");
_loading[(show) ? "show" : "hide"]();
};
if (editor.find("." + dialogName).length < 1)
- {
+ {
var guid = (new Date).getTime();
var action = settings.imageUploadURL + (settings.imageUploadURL.indexOf("?") >= 0 ? "&" : "?") + "guid=" + guid;
@@ -57,14 +57,14 @@
})() +
"
" +
"" +
- "" +
+ "" +
"
" +
"" +
"" +
"
" +
( (settings.imageUpload) ? "" : "");
- //var imageFooterHTML = "";
+ //var imageFooterHTML = "";
dialog = this.createDialog({
title : imageLang.title,
@@ -94,11 +94,11 @@
var altAttr = (alt !== "") ? " \"" + alt + "\"" : "";
if (link === "" || link === "http://")
- {
+ {
cm.replaceSelection("![" + alt + "](" + url + altAttr + ")");
}
- else
- {
+ else
+ {
cm.replaceSelection("[![" + alt + "](" + url + altAttr + ")](" + link + altAttr + ")");
}
@@ -111,7 +111,7 @@
return false;
}],
- cancel : [lang.buttons.cancel, function() {
+ cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
@@ -136,9 +136,9 @@
alert(imageLang.uploadFileEmpty);
}
else if (!isImage.test(fileName))
- {
+ {
alert(imageLang.formatNotAllowed + settings.imageFormats.join(", "));
- }
+ }
else
{
loading(true);
@@ -150,7 +150,12 @@
uploadIframe.onload = function() {
loading(false);
- var json = uploadIframe.contentWindow.document.body.innerText;
+ var json = "";
+ if (uploadIframe.contentWindow) {
+ json = uploadIframe.contentWindow.document.body ? uploadIframe.contentWindow.document.body.innerHTML : null;
+ } else if (uploadIframe.contentDocument) {
+ json = uploadIframe.contentDocument.document.body ? uploadIframe.contentDocument.document.body.innerHTML : null;
+ }
json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");
if (json.success === 1)
@@ -186,10 +191,10 @@
};
};
-
+
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
- {
+ {
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
@@ -206,7 +211,7 @@
factory(editormd);
});
}
- }
+ }
else
{
factory(window.editormd);