paste image

This commit is contained in:
lealife
2015-11-28 17:58:38 +08:00
parent bfa85e2d34
commit 3b3e665a9f
4 changed files with 31 additions and 23 deletions

View File

@ -36,6 +36,7 @@ func (c File) UploadBlogLogo() revel.Result {
func (c File) PasteImage(noteId string) revel.Result {
re := c.uploadImage("pasteImage", "")
if noteId != "" {
userId := c.GetUserId()
note := noteService.GetNoteById(noteId)
if note.UserId != "" {
@ -51,6 +52,7 @@ func (c File) PasteImage(noteId string) revel.Result {
}
}
}
}
return c.RenderJson(re)
}

View File

@ -504,6 +504,7 @@ Group Title=分组名
Search=搜索
Save Success=保存成功
Please save note firstly!=请先保存笔记!
# 必须要加这个, 奇怪
[CN]

View File

@ -1 +1 @@
var MSG={"app":"Leanote","share":"分享","noTag":"无标签","inputUsername":"请输入用户名","inputEmail":"请输入Email","inputPassword":"请输入密码","inputPassword2":"请输入确认密码","confirmPassword":"两次密码输入不正确","history":"历史记录","editorTips":"帮助","editorTipsInfo":"<h4>1. 快捷键</h4>ctrl+shift+c 代码块切换 <h4>2. shift+enter 跳出当前区域</h4>比如在代码块中<img src=\"/images/outofcode.png\" style=\"width: 90px\"/>按shift+enter可跳出当前代码块.","all":"最新","trash":"废纸篓","delete":"删除","unTitled":"无标题","defaultShare":"默认分享","writingMode":"写作模式","normalMode":"普通模式","saving":"正在保存","saveSuccess":"保存成功","Are you sure to delete it ?":"确认删除?","Insert link into content":"将附件链接插入到内容中","Download":"下载","Delete":"删除","update":"更新","Update Time":"更新时间","Create Time":"创建时间","Post Url":"博文链接","close":"关闭","cancel":"取消","send":"发送","shareToFriends":"分享给好友","publicAsBlog":"公开为博客","cancelPublic":"取消公开为博客","move":"移动","copy":"复制","rename":"重命名","exportPdf":"导出PDF","addChildNotebook":"添加子笔记本","deleteAllShared":"删除所有共享","deleteSharedNotebook":"删除共享笔记本","copyToMyNotebook":"复制到我的笔记本","checkEmail":"查看邮件","sendVerifiedEmail":"发送验证邮箱","sendSuccess":"发送成功","sendFailed":"发送失败","friendEmail":"好友邮箱","readOnly":"只读","writable":"可写","inputFriendEmail":"请输入好友邮箱","clickToChangePermission":"点击改变权限","sendInviteEmailToYourFriend":"发送邀请email给Ta","friendNotExits":"该用户还没有注册%s, 复制邀请链接发送给Ta, 邀请链接: %s","emailBodyRequired":"邮件内容不能为空","inviteEmailBody":"Hi, 你好, 我是%s, %s非常好用, 快来注册吧!","historiesNum":"leanote会保存笔记的最近<b>10</b>份历史记录","noHistories":"无历史记录","datetime":"日期","restoreFromThisVersion":"从该版本还原","confirmBackup":"确定要从该版还原? 还原前leanote会备份当前版本到历史记录中.","createAccountSuccess":"帐号创建成功","createAccountFailed":"帐号创建失败","updateUsernameSuccess":"用户名修改成功","usernameIsExisted":"用户名已存在","noSpecialChars":"不能包含特殊字符","minLength":"长度至少为%s","errorEmail":"请输入正确的email","verifiedEmaiHasSent":"验证邮件已发送, 请及时查阅邮件并验证.","emailSendFailed":"邮件发送失败","inputNewPassword":"请输入新密码","errorPassword":"请输入长度不少于6位的密码, 尽量复杂","updatePasswordSuccess":"修改密码成功","Hyperlink":"超链接","Please provide the link URL and an optional title":"请填写链接和一个可选的标题","optional title":"可选标题","Cancel":"取消","Strong":"粗体","strong text":"粗体","Emphasis":"斜体","emphasized text":"斜体","Blockquote":"引用","Code Sample":"代码","enter code here":"代码","Image":"图片","Heading":"标题","Numbered List":"有序列表","Bulleted List":"无序列表","List item":"项目","Horizontal Rule":"水平线","Markdown syntax":"Markdown 语法","Undo":"撤销","Redo":"重做","enter image description here":"图片标题","enter link description here":"链接标题","Edit mode":"编辑模式","Vim mode":"Vim模式","Emacs mode":"Emacs模式","Normal mode":"普通模式","Normal":"普通","Light":"轻量","Light editor":"轻量编辑器","Add Album":"添加相册","Cannot delete default album":"不能删除默认相册","Cannot rename default album":"不能重命名默认相册","Rename Album":"重命名","Add Success!":"添加成功!","Rename Success!":"重命名成功!","Delete Success!":"删除成功","Are you sure to delete this image ?":"确定删除该图片?","click to remove this image":"删除图片","error":"错误","Error":"错误","Prev":"上一页","Next":"下一页","Are you sure ?":"你确定执行该操作?","Are you sure to install it ?":"你确定安装该主题?","Are you sure to delete":"你确定删除","Success":"成功","File exists":"文件已存在","Delete file":"删除文件","No images":"无图片","Filename":"文件名","Group Title":"分组名"};function getMsg(key, data) {var msg = MSG[key];if(msg) {if(data) {if(!isArray(data)) {data = [data];}for(var i = 0; i < data.length; ++i) {msg = msg.replace("%s", data[i]);}}return msg;}return key;}
var MSG={"app":"Leanote","share":"分享","noTag":"无标签","inputUsername":"请输入用户名","inputEmail":"请输入Email","inputPassword":"请输入密码","inputPassword2":"请输入确认密码","confirmPassword":"两次密码输入不正确","history":"历史记录","editorTips":"帮助","editorTipsInfo":"<h4>1. 快捷键</h4>ctrl+shift+c 代码块切换 <h4>2. shift+enter 跳出当前区域</h4>比如在代码块中<img src=\"/images/outofcode.png\" style=\"width: 90px\"/>按shift+enter可跳出当前代码块.","all":"最新","trash":"废纸篓","delete":"删除","unTitled":"无标题","defaultShare":"默认分享","writingMode":"写作模式","normalMode":"普通模式","saving":"正在保存","saveSuccess":"保存成功","Are you sure to delete it ?":"确认删除?","Insert link into content":"将附件链接插入到内容中","Download":"下载","Delete":"删除","update":"更新","Update Time":"更新时间","Create Time":"创建时间","Post Url":"博文链接","close":"关闭","cancel":"取消","send":"发送","shareToFriends":"分享给好友","publicAsBlog":"公开为博客","cancelPublic":"取消公开为博客","move":"移动","copy":"复制","rename":"重命名","exportPdf":"导出PDF","addChildNotebook":"添加子笔记本","deleteAllShared":"删除所有共享","deleteSharedNotebook":"删除共享笔记本","copyToMyNotebook":"复制到我的笔记本","checkEmail":"查看邮件","sendVerifiedEmail":"发送验证邮箱","sendSuccess":"发送成功","sendFailed":"发送失败","friendEmail":"好友邮箱","readOnly":"只读","writable":"可写","inputFriendEmail":"请输入好友邮箱","clickToChangePermission":"点击改变权限","sendInviteEmailToYourFriend":"发送邀请email给Ta","friendNotExits":"该用户还没有注册%s, 复制邀请链接发送给Ta, 邀请链接: %s","emailBodyRequired":"邮件内容不能为空","inviteEmailBody":"Hi, 你好, 我是%s, %s非常好用, 快来注册吧!","historiesNum":"leanote会保存笔记的最近<b>10</b>份历史记录","noHistories":"无历史记录","datetime":"日期","restoreFromThisVersion":"从该版本还原","confirmBackup":"确定要从该版还原? 还原前leanote会备份当前版本到历史记录中.","createAccountSuccess":"帐号创建成功","createAccountFailed":"帐号创建失败","updateUsernameSuccess":"用户名修改成功","usernameIsExisted":"用户名已存在","noSpecialChars":"不能包含特殊字符","minLength":"长度至少为%s","errorEmail":"请输入正确的email","verifiedEmaiHasSent":"验证邮件已发送, 请及时查阅邮件并验证.","emailSendFailed":"邮件发送失败","inputNewPassword":"请输入新密码","errorPassword":"请输入长度不少于6位的密码, 尽量复杂","updatePasswordSuccess":"修改密码成功","Hyperlink":"超链接","Please provide the link URL and an optional title":"请填写链接和一个可选的标题","optional title":"可选标题","Cancel":"取消","Strong":"粗体","strong text":"粗体","Emphasis":"斜体","emphasized text":"斜体","Blockquote":"引用","Code Sample":"代码","enter code here":"代码","Image":"图片","Heading":"标题","Numbered List":"有序列表","Bulleted List":"无序列表","List item":"项目","Horizontal Rule":"水平线","Markdown syntax":"Markdown 语法","Undo":"撤销","Redo":"重做","enter image description here":"图片标题","enter link description here":"链接标题","Edit mode":"编辑模式","Vim mode":"Vim模式","Emacs mode":"Emacs模式","Normal mode":"普通模式","Normal":"普通","Light":"轻量","Light editor":"轻量编辑器","Add Album":"添加相册","Cannot delete default album":"不能删除默认相册","Cannot rename default album":"不能重命名默认相册","Rename Album":"重命名","Add Success!":"添加成功!","Rename Success!":"重命名成功!","Delete Success!":"删除成功","Are you sure to delete this image ?":"确定删除该图片?","click to remove this image":"删除图片","error":"错误","Error":"错误","Prev":"上一页","Next":"下一页","Are you sure ?":"你确定执行该操作?","Are you sure to install it ?":"你确定安装该主题?","Are you sure to delete":"你确定删除","Success":"成功","File exists":"文件已存在","Delete file":"删除文件","No images":"无图片","Filename":"文件名","Group Title":"分组名","Please save note firstly!":"请先保存笔记!"};function getMsg(key, data) {var msg = MSG[key];if(msg) {if(data) {if(!isArray(data)) {data = [data];}for(var i = 0; i < data.length; ++i) {msg = msg.replace("%s", data[i]);}}return msg;}return key;}

View File

@ -313,9 +313,9 @@ define('editor_drop_paste', ['fileupload'], function() {
// 不知道为什么会触发两次
add: function(e, data) {
// 防止两次
// console.trace(e);
var now = (new Date()).getTime();
if (now - lastTime < 500) {
// console.log('haha');
return;
}
// console.log('nono');
@ -324,9 +324,13 @@ define('editor_drop_paste', ['fileupload'], function() {
var note = Note.getCurNote();
curNote = note;
if(!note || note.IsNew) {
alert("This note hasn't saved, please save it firstly!")
return;
// alert(getMsg("Please save note firstly!"));
// return;
}
// LEA.removePasteBin();
// 为什么要延迟? 为了让paste plugin先执行, 删除掉paste bin
setTimeout(function () {
// 先显示loading...
editor = tinymce.EditorManager.activeEditor;
if(!note.IsMarkdown) {
@ -334,6 +338,7 @@ define('editor_drop_paste', ['fileupload'], function() {
}
data.process = process;
var jqXHR = data.submit();
}, 20);
/*
d.id = '__mcenew' + (new Date()).getTime();