mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-17 16:45:21 +00:00
历史记录优化
This commit is contained in:
@@ -181,28 +181,28 @@ var menu = new Menu();
|
|||||||
// 右键菜单
|
// 右键菜单
|
||||||
var winHref = '';
|
var winHref = '';
|
||||||
var $curTarget;
|
var $curTarget;
|
||||||
$('#noteTitle, #searchNoteInput, #searchNotebookForList, #addTagInput, #wmd-input, #preview-contents, #editorContent, #presentation').on('contextmenu', function (e) {
|
var openContextmenu = function (e, canCut2, canPaste2) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $target = $(e.target);
|
var $target = $(e.target);
|
||||||
$curTarget = $target;
|
$curTarget = $target;
|
||||||
var text = $target.text();
|
var text = $target.text();
|
||||||
winHref = $target.attr('href');
|
winHref = $target.attr('href');
|
||||||
if(!winHref) {
|
if(!winHref) {
|
||||||
winHref = text;
|
winHref = text;
|
||||||
}
|
}
|
||||||
// 判断是否满足http://leanote.com
|
// 判断是否满足http://leanote.com
|
||||||
if(winHref) {
|
if(winHref) {
|
||||||
if (winHref.indexOf('http://127.0.0.1') < 0 && isURL(winHref)) {
|
if (winHref.indexOf('http://127.0.0.1') < 0 && isURL(winHref)) {
|
||||||
} else {
|
} else {
|
||||||
winHref = false;
|
winHref = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.canOpenInBroswer(!!winHref);
|
menu.canOpenInBroswer(!!winHref);
|
||||||
menu.canSaveAs($target.is('img') && $target.attr('src'));
|
menu.canSaveAs($target.is('img') && $target.attr('src'));
|
||||||
var selectionType = window.getSelection().type.toUpperCase();
|
var selectionType = window.getSelection().type.toUpperCase();
|
||||||
// var clipData = gui.Clipboard.get().get();
|
// var clipData = gui.Clipboard.get().get();
|
||||||
// menu.canPaste(clipData.length > 0);
|
// menu.canPaste(clipData.length > 0);
|
||||||
|
|
||||||
var canPaste = true;
|
var canPaste = true;
|
||||||
var canCut = true;
|
var canCut = true;
|
||||||
@@ -214,11 +214,23 @@ $('#noteTitle, #searchNoteInput, #searchNotebookForList, #addTagInput, #wmd-inpu
|
|||||||
canCut = false;
|
canCut = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.canCopy(selectionType === 'RANGE');
|
menu.canCopy(selectionType === 'RANGE');
|
||||||
|
|
||||||
menu.canPaste(canPaste);
|
menu.canPaste(canPaste);
|
||||||
menu.canCut(canCut);
|
menu.canCut(canCut);
|
||||||
|
|
||||||
menu.popup(e.originalEvent.x, e.originalEvent.y);
|
if (typeof canCut2 !== 'undefined') {
|
||||||
});
|
menu.canCut(!!canCut2);
|
||||||
|
}
|
||||||
|
if (typeof canPaste2 !== 'undefined') {
|
||||||
|
menu.canPaste(!!canPaste2);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.popup(e.originalEvent.x, e.originalEvent.y);
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#noteTitle, #searchNoteInput, #searchNotebookForList, #addTagInput, #wmd-input, #preview-contents, #editorContent, #presentation').on('contextmenu', openContextmenu);
|
||||||
|
$('body').on('contextmenu', '.history-content', function (e) {
|
||||||
|
openContextmenu(e, false, false);
|
||||||
|
});
|
||||||
|
@@ -472,9 +472,11 @@ function initEditor() {
|
|||||||
+ "Times New Roman=times new roman,times;"
|
+ "Times New Roman=times new roman,times;"
|
||||||
+ "Courier New=courier new,courier;"
|
+ "Courier New=courier new,courier;"
|
||||||
+ "Tahoma=tahoma,arial,helvetica,sans-serif;"
|
+ "Tahoma=tahoma,arial,helvetica,sans-serif;"
|
||||||
+ "Verdana=verdana,geneva;" + "宋体=SimSun;"
|
+ "Verdana=verdana,geneva;"
|
||||||
+ "新宋体=NSimSun;" + "黑体=SimHei;"
|
+ "宋体=SimSun;"
|
||||||
+ "微软雅黑=Microsoft YaHei",
|
+ "新宋体=NSimSun;"
|
||||||
|
+ "黑体=SimHei;"
|
||||||
|
+ "Microsoft YaHei=Microsoft YaHei",
|
||||||
block_formats : "Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Paragraph=p",
|
block_formats : "Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Paragraph=p",
|
||||||
// This option specifies whether data:url images (inline images) should be removed or not from the pasted contents.
|
// This option specifies whether data:url images (inline images) should be removed or not from the pasted contents.
|
||||||
// Setting this to "true" will allow the pasted images, and setting this to "false" will disallow pasted images.
|
// Setting this to "true" will allow the pasted images, and setting this to "false" will disallow pasted images.
|
||||||
@@ -1708,11 +1710,6 @@ var Pren = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function isURL(str_url) {
|
|
||||||
var re = new RegExp("^((https|http|ftp|rtsp|mms|emailto)://).+");
|
|
||||||
return re.test(str_url);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 防止在本窗口打开
|
// 防止在本窗口打开
|
||||||
me.presentationO.on('click', 'a', function(e) {
|
me.presentationO.on('click', 'a', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@@ -1676,4 +1676,9 @@ var onClose = function(afterFunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isURL(str_url) {
|
||||||
|
var re = new RegExp("^((https|http|ftp|rtsp|mms|emailto)://).+");
|
||||||
|
return re.test(str_url);
|
||||||
|
}
|
||||||
|
|
||||||
ContextTips.init();
|
ContextTips.init();
|
||||||
|
@@ -100,6 +100,14 @@ define(function() {
|
|||||||
Note.curChangedSaveIt(true);
|
Note.curChangedSaveIt(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$historyContent.on('click', 'a', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var href = $(this).attr('href');
|
||||||
|
if(href && href.indexOf('http://127.0.0.1') < 0 && isURL(href)) {
|
||||||
|
openExternal(href);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getHistories: function () {
|
getHistories: function () {
|
||||||
|
@@ -2629,6 +2629,7 @@ body,
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
-webkit-user-select: text;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
@@ -898,6 +898,7 @@ html, body, #page, #pageInner, #noteList, #notebook, #leftNotebook {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
-webkit-user-select: text;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
Reference in New Issue
Block a user