diff --git a/public/config.js b/public/config.js index c1f9b20aa..a944ff584 100644 --- a/public/config.js +++ b/public/config.js @@ -33,8 +33,8 @@ var Config = { "name": "日本語" } ], - "lang": "zh-cn", - "theme": "night", + "lang": "en-us", + "theme": "", "view": "list", "mdTheme": "github2" }; \ No newline at end of file diff --git a/public/js/app/page.js b/public/js/app/page.js index 7f1e33c36..0bcfaa3d2 100644 --- a/public/js/app/page.js +++ b/public/js/app/page.js @@ -2260,19 +2260,70 @@ function userMenu(allUsers) { }); } -$(function() { - initUploadImage(); - Writting.init(); +function InitDragAndDropImages(){ - // disable drag & drop + // disable default drag & drop document.body.addEventListener('dragover', function(e){ e.preventDefault(); - e.stopPropagation(); }, false); + document.body.addEventListener('drop', function(e){ + + var note = Note.getCurNote(); + if(note) + { + if(!Note.readOnly) + { + var files = e.dataTransfer.files; + var imageTypes = ['image/png', 'image/gif', 'image/bmp', 'image/jpg', 'image/jpeg']; + + for(var i=0;i'); + } else { + MD.insertLink(url, '', true); + } + } else { + alert(msg || "error"); + } + }); + + + } else { + console.log('dropped file is not an image', files[i]); + } + } + } + } + else{ + console.log("note is read only"); + } + } + else{ + console.log("no note...:)"); + } + + e.preventDefault(); e.stopPropagation(); }, false); +} + +$(function() { + initUploadImage(); + Writting.init(); + + InitDragAndDropImages(); // 为了解决linux下重复粘贴的问题 var everPaste;