diff --git a/CHANGE.md b/CHANGE.md index 8c7c232..15b5446 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -452,4 +452,5 @@ v1.2.0 主要更新: ####v1.4.4 - 修复 Bug [#81](https://github.com/pandao/editor.md/issues/81),即不支持 `:+1:` 的问题; -- 修复 Bug [#85](https://github.com/pandao/editor.md/issues/85),即图片上传返回结果不支持 `Content-Type=application/json` 的问题; \ No newline at end of file +- 修复 Bug [#85](https://github.com/pandao/editor.md/issues/85),即图片上传返回结果不支持 `Content-Type=application/json` 的问题; +- 修复图片上传无法显示 loading 的问题; \ No newline at end of file diff --git a/plugins/image-dialog/image-dialog.js b/plugins/image-dialog/image-dialog.js index 4f66bac..5cb042e 100644 --- a/plugins/image-dialog/image-dialog.js +++ b/plugins/image-dialog/image-dialog.js @@ -3,7 +3,7 @@ * * @file image-dialog.js * @author pandao - * @version 1.3.1 + * @version 1.3.2 * @updateTime 2015-05-09 * {@link https://github.com/pandao/editor.md} * @license MIT @@ -31,6 +31,11 @@ cm.focus(); + 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(); @@ -136,18 +141,14 @@ } else { - if (typeof (dialog.loading) == "function") { - dialog.loading(true); - } + loading(true); var submitHandler = function() { var uploadIframe = document.getElementById(iframeName); uploadIframe.onload = function() { - if (typeof (dialog.loading) == "function") { - dialog.loading(false); - } + loading(false); var json = uploadIframe.contentWindow.document.body.innerText; json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");