markdown编辑器paste图片

This commit is contained in:
life
2015-03-02 23:34:00 +08:00
parent c2adc45da6
commit 026f031f5e
3 changed files with 13 additions and 7 deletions

View File

@@ -826,6 +826,11 @@ $(function() {
e.preventDefault();
return false;
});
// markdown编辑器paste
$('#wmd-input-sub').on('paste', function(e) {
pasteImage(e);
});
});

View File

@@ -79,10 +79,10 @@ $(function() {
// bind close event
// 保存当前打开的笔记
// win.on('close', function() {
win.on('close', function() {
// TODO
// win.close(true);
// });
win.close(true);
});
function isURL(str_url){
var re = new RegExp("^((https|http|ftp|rtsp|mms)://).+");
@@ -109,8 +109,9 @@ $('#noteTitle, #searchNoteInput, #searchNotebookForList, #addTagInput, #wmd-inpu
menu.canOpenInBroswer(!!winHref);
var selectionType = window.getSelection().type.toUpperCase();
var clipData = gui.Clipboard.get().get();
menu.canPaste(clipData.length > 0);
// var clipData = gui.Clipboard.get().get();
// menu.canPaste(clipData.length > 0);
menu.canPaste(true);
menu.canCopy(selectionType === 'RANGE');
menu.popup(e.originalEvent.x, e.originalEvent.y);
});

View File

@@ -441,10 +441,10 @@ function pasteImage(e) {
}
// 插入图片(链接)
// TODO Markdown 插入图片
// Markdown 插入图片
function insertImage(link) {
if(LEA.isMarkdownEditor()) {
MD.insertLink(link);
MD.insertLink(link, '', true);
} else {
tinymce.activeEditor.insertContent('<img src="' + link + '">');
}