mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 07:31:33 +00:00
21
node_modules/file.js
generated
vendored
21
node_modules/file.js
generated
vendored
@@ -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;
|
@@ -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' }));
|
||||
|
@@ -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",
|
||||
|
@@ -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)) {
|
||||
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 = $("<div>" + html + "</div");
|
||||
var $html = $("<div>" + html + "</div>");
|
||||
var $imgs = $html.find("img");
|
||||
for(var i = 0; i < $imgs.length; ++i) {
|
||||
var $img = $imgs.eq(i)
|
||||
var src = $img.attr("src");
|
||||
// 是否是外链
|
||||
if(src.indexOf(urlPrefix) == -1) {
|
||||
if(src.indexOf(urlPrefix) == -1 && src.indexOf('http://127.0.0.1') == -1) {
|
||||
time++;
|
||||
var id = "__LEANOTE_IMAGE_" + time;
|
||||
var id = "__LEANOTE_D_IMG_" + time;
|
||||
$img.attr("id", id);
|
||||
if(needCopyImages[src]) {
|
||||
needCopyImages[src].push(id);
|
||||
@@ -1044,25 +1042,10 @@ define("tinymce/pasteplugin/Plugin", [
|
||||
}
|
||||
}
|
||||
|
||||
function togglePasteCopyImage() {
|
||||
if (clipboard.copyImage) {
|
||||
this.active(false);
|
||||
clipboard.copyImage = false
|
||||
} else {
|
||||
clipboard.copyImage = true;
|
||||
this.active(true);
|
||||
if (!userIsInformed2) {
|
||||
editor.windowManager.alert(
|
||||
"When copy other site's images (not in leanote) into editor, it will copy the image into your album."
|
||||
);
|
||||
userIsInformed2 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.clipboard = clipboard = new Clipboard(editor);
|
||||
self.quirks = new Quirks(editor);
|
||||
self.wordFilter = new WordFilter(editor);
|
||||
clipboard.copyImage = true;
|
||||
|
||||
if (editor.settings.paste_as_text) {
|
||||
self.clipboard.pasteFormat = "text";
|
||||
@@ -1116,13 +1099,6 @@ define("tinymce/pasteplugin/Plugin", [
|
||||
active: self.clipboard.pasteFormat == "text"
|
||||
});
|
||||
|
||||
editor.addButton('pasteCopyImage', {
|
||||
icon: 'copy',
|
||||
tooltip: "When Paste other site's image, copy it into my album as public image",
|
||||
onclick: togglePasteCopyImage,
|
||||
active: self.clipboard.copyImage === true
|
||||
});
|
||||
|
||||
editor.addMenuItem('pastetext', {
|
||||
text: 'Paste as text',
|
||||
selectable: true,
|
||||
|
Reference in New Issue
Block a user