Browse Source

Merge pull request #90 from admpub/master

优化对 textarea 中 name 属性值的设置 和 修复 Firefox 下上传图片返回 JSON 数据为 undefined 的问题
master
pandao 10 years ago
parent
commit
fdf1c5abff
  1. 6
      editormd.js
  2. 2
      editormd.min.js
  3. 7
      plugins/image-dialog/image-dialog.js

6
editormd.js

@ -403,8 +403,10 @@
editor.append("<textarea></textarea>");
markdownTextarea = this.markdownTextarea = editor.children("textarea");
}
markdownTextarea.addClass(classNames.textarea.markdown).attr("name", id + "-markdown-doc").attr("placeholder", settings.placeholder);
if(markdownTextarea.attr("name")=="undefined" || markdownTextarea.attr("name")==""){
markdownTextarea.attr("name", id + "-markdown-doc");
}
markdownTextarea.addClass(classNames.textarea.markdown).attr("placeholder", settings.placeholder);
var appendElements = [
(!settings.readOnly) ? "<a href=\"javascript:;\" class=\"fa fa-close " + classPrefix + "preview-close-btn\"></a>" : "",

2
editormd.min.js

File diff suppressed because one or more lines are too long

7
plugins/image-dialog/image-dialog.js

@ -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)

Loading…
Cancel
Save