diff --git a/node_modules/file.js b/node_modules/file.js index 6085f4c6..9adbb03e 100644 --- a/node_modules/file.js +++ b/node_modules/file.js @@ -589,8 +589,27 @@ var File = { } }); } - }, + + // 复制外站图片 + copyOtherSiteImage: function(src, callback) { + var me = this; + me.downloadImg(src, function (filePath) { + if (filePath) { + me._addImage(Common.objectId(), filePath, function(file) { + if (file) { + callback(Evt.getImageLocalUrl(file.FileId)); + } + else { + callback(false); + } + }); + } + else { + callback(false); + } + }); + } }; module.exports = File; \ No newline at end of file diff --git a/public/js/app/page.js b/public/js/app/page.js index 98eacc39..e5ed1588 100644 --- a/public/js/app/page.js +++ b/public/js/app/page.js @@ -452,7 +452,7 @@ function initEditor() { // parentHeight: $("#content").height(), // content_css : ["public/css/editor/editor.css"], // skin : "custom", - language: Api.curLang == 'zh-cn' ? 'zh' : 'en', // 语言 + language: Api.curLang.indexOf('zh') >= 0 ? 'zh' : 'en', // 语言 plugins : [ "autolink link image lists charmap hr", "paste", "searchreplace leanote_nav leanote_code tabfocus", @@ -2020,7 +2020,7 @@ function userMenu(allUsers) { this.menu.append(themeMenu); } - var height = 180; + var height = 210; if(!isMac()) { this.menu.append(new gui.MenuItem({ type: 'separator' })); @@ -2028,7 +2028,7 @@ function userMenu(allUsers) { this.menu.append(Pren.view); this.menu.append(Pren.fullScreen); - height = 270; + height += 90; } this.menu.append(new gui.MenuItem({ type: 'separator' })); diff --git a/public/tinymce/langs/zh.js b/public/tinymce/langs/zh.js index a825873a..5a638363 100644 --- a/public/tinymce/langs/zh.js +++ b/public/tinymce/langs/zh.js @@ -79,6 +79,8 @@ tinymce.addI18n('zh',{ "Insert\/edit mind map": "新建/编辑思维导图", "Insert Mind Map": "插入思维导图", "Mind Map": "思维导图", +"Image": "图片", +"Insert Image": "插入", "General": "\u666e\u901a", "Advanced": "\u9ad8\u7ea7", "Source": "\u5730\u5740", @@ -180,4 +182,4 @@ tinymce.addI18n('zh',{ "View": "\u89c6\u56fe", "Table": "\u8868\u683c", "Format": "\u683c\u5f0f" -}); \ No newline at end of file +}); diff --git a/public/tinymce/plugins/paste/plugin.js b/public/tinymce/plugins/paste/plugin.js index 41efe189..52fe63a0 100644 --- a/public/tinymce/plugins/paste/plugin.js +++ b/public/tinymce/plugins/paste/plugin.js @@ -222,26 +222,24 @@ define("tinymce/pasteplugin/Clipboard", [ var pasteBinDefaultContent = '%MCEPASTEBIN%', keyboardPastePlainTextState; /** - * Pastes the specified HTML. This means that the HTML is filtered and then - * inserted at the current selection in the editor. It will also fire paste events - * for custom user filtering. - * - * @param {String} html HTML code to paste into the current selection. + * 复制外链图片, copy到本地 */ - function copyImage(src, ids) { - ajaxPost("/file/copyHttpImage", {src: src}, function(ret) { - if(reIsOk(ret)) { + function copyImage(src, ids) { + FileService.copyOtherSiteImage(src, function(url) { + if (url) { // 将图片替换之 - var src = urlPrefix + "/" + ret.Item; - var dom = editor.dom + var dom = editor.dom; for(var i in ids) { var id = ids[i]; var imgElm = dom.get(id); - dom.setAttrib(imgElm, 'src', src); + if (imgElm) { + dom.setAttrib(imgElm, 'src', url); + } } } }); } + // 粘贴HTML // 当在pre下时不能粘贴成HTML // life add text @@ -299,15 +297,15 @@ define("tinymce/pasteplugin/Clipboard", [ var needCopyImages = {}; // src => [id1,id2] var time = (new Date()).getTime(); try { - var $html = $("