mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 15:41:19 +00:00
历史记录优化
This commit is contained in:
@@ -181,28 +181,28 @@ var menu = new Menu();
|
||||
// 右键菜单
|
||||
var winHref = '';
|
||||
var $curTarget;
|
||||
$('#noteTitle, #searchNoteInput, #searchNotebookForList, #addTagInput, #wmd-input, #preview-contents, #editorContent, #presentation').on('contextmenu', function (e) {
|
||||
e.preventDefault();
|
||||
var $target = $(e.target);
|
||||
$curTarget = $target;
|
||||
var text = $target.text();
|
||||
winHref = $target.attr('href');
|
||||
if(!winHref) {
|
||||
winHref = text;
|
||||
}
|
||||
// 判断是否满足http://leanote.com
|
||||
if(winHref) {
|
||||
if (winHref.indexOf('http://127.0.0.1') < 0 && isURL(winHref)) {
|
||||
} else {
|
||||
winHref = false;
|
||||
}
|
||||
}
|
||||
var openContextmenu = function (e, canCut2, canPaste2) {
|
||||
e.preventDefault();
|
||||
var $target = $(e.target);
|
||||
$curTarget = $target;
|
||||
var text = $target.text();
|
||||
winHref = $target.attr('href');
|
||||
if(!winHref) {
|
||||
winHref = text;
|
||||
}
|
||||
// 判断是否满足http://leanote.com
|
||||
if(winHref) {
|
||||
if (winHref.indexOf('http://127.0.0.1') < 0 && isURL(winHref)) {
|
||||
} else {
|
||||
winHref = false;
|
||||
}
|
||||
}
|
||||
|
||||
menu.canOpenInBroswer(!!winHref);
|
||||
menu.canSaveAs($target.is('img') && $target.attr('src'));
|
||||
var selectionType = window.getSelection().type.toUpperCase();
|
||||
// var clipData = gui.Clipboard.get().get();
|
||||
// menu.canPaste(clipData.length > 0);
|
||||
menu.canOpenInBroswer(!!winHref);
|
||||
menu.canSaveAs($target.is('img') && $target.attr('src'));
|
||||
var selectionType = window.getSelection().type.toUpperCase();
|
||||
// var clipData = gui.Clipboard.get().get();
|
||||
// menu.canPaste(clipData.length > 0);
|
||||
|
||||
var canPaste = true;
|
||||
var canCut = true;
|
||||
@@ -214,11 +214,23 @@ $('#noteTitle, #searchNoteInput, #searchNotebookForList, #addTagInput, #wmd-inpu
|
||||
canCut = false;
|
||||
}
|
||||
}
|
||||
|
||||
menu.canCopy(selectionType === 'RANGE');
|
||||
|
||||
menu.canCopy(selectionType === 'RANGE');
|
||||
|
||||
menu.canPaste(canPaste);
|
||||
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;"
|
||||
+ "Courier New=courier new,courier;"
|
||||
+ "Tahoma=tahoma,arial,helvetica,sans-serif;"
|
||||
+ "Verdana=verdana,geneva;" + "宋体=SimSun;"
|
||||
+ "新宋体=NSimSun;" + "黑体=SimHei;"
|
||||
+ "微软雅黑=Microsoft YaHei",
|
||||
+ "Verdana=verdana,geneva;"
|
||||
+ "宋体=SimSun;"
|
||||
+ "新宋体=NSimSun;"
|
||||
+ "黑体=SimHei;"
|
||||
+ "Microsoft YaHei=Microsoft YaHei",
|
||||
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.
|
||||
// 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) {
|
||||
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();
|
||||
|
@@ -100,6 +100,14 @@ define(function() {
|
||||
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 () {
|
||||
|
@@ -2629,6 +2629,7 @@ body,
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
-webkit-user-select: text;
|
||||
padding-top: 5px;
|
||||
padding-right: 5px;
|
||||
padding-left: 10px;
|
||||
|
@@ -898,6 +898,7 @@ html, body, #page, #pageInner, #noteList, #notebook, #leftNotebook {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
-webkit-user-select: text;
|
||||
padding-top: 5px;
|
||||
padding-right: 5px;
|
||||
padding-left: 10px;
|
||||
|
Reference in New Issue
Block a user