diff --git a/src/data/version b/src/data/version
index 87b0e046..1278ff12 100644
--- a/src/data/version
+++ b/src/data/version
@@ -1 +1 @@
-{"version":"0.6.3","updatedTime":"2015-05-23T07:11:51.505Z"}
\ No newline at end of file
+{"version":"0.6.4","updatedTime":"2015-09-22T07:11:51.505Z"}
\ No newline at end of file
diff --git a/src/node_modules/api.js b/src/node_modules/api.js
index 9591b5db..cde3f505 100644
--- a/src/node_modules/api.js
+++ b/src/node_modules/api.js
@@ -670,7 +670,7 @@ var Api = {
exportPdf: function(noteId, callback) {
var me = this;
- console.log(me.getUrl('note/exportPdf', {noteId: noteId}));
+ // console.log(me.getUrl('note/exportPdf', {noteId: noteId}));
needle.get(me.getUrl('note/exportPdf', {noteId: noteId}), function(err, resp) {
me.checkError(err, resp);
if(err) {
@@ -684,7 +684,7 @@ var Api = {
'content-type': 'image/png',
date: 'Mon, 19 Jan 2015 15:01:47 GMT',
*/
-
+
var body = resp.body;
if(typeof body == "object" && body.Msg === false) {
return callback(false, "", body.Msg);
@@ -695,8 +695,8 @@ var Api = {
var imagePathAll = imagePath + '/' + filename;
fs.writeFile(imagePathAll, resp.body, function(err) {
if(err) {
- log(err);
- log('local save pdf failed 本地保存失败');
+ // log(err);
+ // log('local save pdf failed 本地保存失败');
callback(false);
} else {
callback(imagePathAll, filename);
diff --git a/src/note.html b/src/note.html
index 38ecd0b3..a908a63f 100755
--- a/src/note.html
+++ b/src/note.html
@@ -594,9 +594,19 @@ function log(o) {
+
+
+
+
+
+
diff --git a/src/public/js/common.js b/src/public/js/common.js
index a8b25981..b70b7992 100644
--- a/src/public/js/common.js
+++ b/src/public/js/common.js
@@ -1557,10 +1557,36 @@ var trimTitle = function(title) {
};
var Loading = {
- show: function(msg) {
+ $loadingDialog: $('#loadingDialog'),
+ $progressBar: $('#loadingDialog .progress-bar'),
+ // option {hasProgress: true, onClose: function}
+ inited: false,
+ show: function(msg, option) {
+ option = option || {};
msg || (msg = getMsg("loading..."));
$('#loadingDialogBodyMsg').html(msg);
- $('#loadingDialog').modal({backdrop: 'static', keyboard: false});
+ this.$loadingDialog.modal({backdrop: 'static', keyboard: true});
+ if (option.hasProgress) {
+ this.$loadingDialog.addClass('has-progress');
+ }
+ else {
+ this.$loadingDialog.removeClass('has-progress');
+ }
+ this.onClose = option.onClose;
+ if (!this.inited) {
+ this.init();
+ }
+ },
+ init: function () {
+ this.inited = true;
+ var me = this;
+ this.$loadingDialog.on('hidden.bs.modal', function (e) {
+ me.onClose && me.onClose();
+ });
+ },
+ // '100'
+ setProgress: function (rate) {
+ this.$progressBar.width(rate + '%');
},
hide: function() {
$('#loadingDialog').modal('hide');
diff --git a/src/public/plugins/export_pdf/plugin.js b/src/public/plugins/export_pdf/plugin.js
index 918d9f9a..dd2069e0 100644
--- a/src/public/plugins/export_pdf/plugin.js
+++ b/src/public/plugins/export_pdf/plugin.js
@@ -53,10 +53,29 @@ define(function() {
me.init();
}
- Api.loading.show();
+ var closed = false;
+ var interval;
+ Api.loading.show('', {hasProgress: true, onClose: function () {
+ closed = true;
+ clearInterval(interval);
+ }});
+ Api.loading.setProgress(1);
+ var progress = 1;
+ interval = setInterval(function () {
+ progress += 5;
+ if (progress > 90) {
+ progress = 90;
+ }
+ Api.loading.setProgress(progress);
+ }, 500);
// 保存
Api.noteService.exportPdf(note.NoteId, function(curPath, filename, msg) {
+ clearInterval(interval);
+ if (closed) {
+ return;
+ }
+ Api.loading.setProgress(99);
Api.loading.hide();
setTimeout(function() {
diff --git a/src/public/themes/basic.less b/src/public/themes/basic.less
index acf1f500..ce40130c 100644
--- a/src/public/themes/basic.less
+++ b/src/public/themes/basic.less
@@ -1817,6 +1817,29 @@ img::selection {
#loadingDialogBodyMsg {
font-size: 16px;
}
+
+ .progress {
+ margin: 0;
+ margin-top: 20px;
+ height: 1px;
+ display: none;
+ }
+
+ &.has-progress {
+ .progress {
+ display: block;
+ }
+ }
+
+ button {
+ margin: 5px;
+ font-size: 14px;
+ position: absolute;
+ z-index: 10;
+ right: 5px;
+ top: 0;
+ text-shadow: none;
+ }
}
#editorMask {
diff --git a/src/public/themes/default.css b/src/public/themes/default.css
index a7cb2d11..e857e376 100644
--- a/src/public/themes/default.css
+++ b/src/public/themes/default.css
@@ -1605,6 +1605,24 @@ img::selection {
#loadingDialog #loadingDialogBodyMsg {
font-size: 16px;
}
+#loadingDialog .progress {
+ margin: 0;
+ margin-top: 20px;
+ height: 1px;
+ display: none;
+}
+#loadingDialog.has-progress .progress {
+ display: block;
+}
+#loadingDialog button {
+ margin: 5px;
+ font-size: 14px;
+ position: absolute;
+ z-index: 10;
+ right: 5px;
+ top: 0;
+ text-shadow: none;
+}
#editorMask {
z-index: 1030 !important;
}