Merge branch 'dev-life'
Conflicts: app/init.go public/js/common-min.js public/js/common.js
This commit is contained in:
1
public/js/app/attachment_upload-min.js
vendored
Normal file
1
public/js/app/attachment_upload-min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var urlPrefix=UrlPrefix;define("attachment_upload",["jquery.ui.widget","fileupload"],function(){function formatFileSize(bytes){if(typeof bytes!=="number"){return""}if(bytes>=1e9){return(bytes/1e9).toFixed(2)+" GB"}if(bytes>=1e6){return(bytes/1e6).toFixed(2)+" MB"}return(bytes/1e3).toFixed(2)+" KB"}function setDropStyle(dropzoneId,formId){var dropZone=$(dropzoneId);$(formId).bind("dragover",function(e){e.preventDefault();var timeout=window.dropZoneTimeoutAttach;if(timeout){clearTimeout(timeout)}var found=false,node=e.target;do{if(node===dropZone[0]){found=true;break}node=node.parentNode}while(node!=null);if(found){dropZone.addClass("hover")}else{dropZone.removeClass("hover")}window.dropZoneTimeoutAttach=setTimeout(function(){window.dropZoneTimeoutAttach=null;dropZone.removeClass("in hover")},100)})}setDropStyle("#dropAttach","#uploadAttach");setDropStyle("#dropAvatar","#uploadAvatar");var initUploader=function(){$(".dropzone .btn-choose-file").click(function(){$(this).parent().find("input").click()});var $msg=$("#attachUploadMsg");$("#uploadAttach").fileupload({dataType:"json",pasteZone:"",dropZone:$("#dropAttach"),formData:function(form){return[{name:"noteId",value:Note.curNoteId}]},add:function(e,data){var note=Note.getCurNote();if(!note||note.IsNew){alert("This note hasn't saved, please save it firstly!");return}var tpl=$('<div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div>');tpl.append(data.files[0].name+" <small>[<i>"+formatFileSize(data.files[0].size)+"</i>]</small>");$msg.html(tpl);data.context=$msg;var size=data.files[0].size;var maxFileSize=+GlobalConfigs["uploadAttachSize"]||100;if(typeof size=="number"&&size>1024*1024*maxFileSize){tpl.find("img").remove();tpl.removeClass("alert-info").addClass("alert-danger");tpl.append(" Warning: File size is bigger than "+maxFileSize+"M");setTimeout(function(tpl){return function(){tpl.remove()}}(tpl),3e3);return}var jqXHR;setTimeout(function(){jqXHR=data.submit()},10)},done:function(e,data){if(data.result.Ok==true){data.context.html("");Attach.addAttach(data.result.Item)}else{var re=data.result;data.context.html("");var tpl=$('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');tpl.append("<b>Error:</b> "+data.files[0].name+" <small>[<i>"+formatFileSize(data.files[0].size)+"</i>]</small> "+data.result.Msg);data.context.html(tpl);setTimeout(function(tpl){return function(){tpl.remove()}}(tpl),3e3)}$("#uploadAttachMsg").scrollTop(1e3)},fail:function(e,data){data.context.html("");var tpl=$('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');tpl.append("<b>Error:</b> "+data.files[0].name+" <small>[<i>"+formatFileSize(data.files[0].size)+"</i>]</small> "+data.errorThrown);data.context.html(tpl);setTimeout(function(tpl){return function(){tpl.remove()}}(tpl),3e3);$("#uploadAttachMsg").scrollTop(1e3)}});var $msg2=$("#avatarUploadMsg");$("#uploadAvatar").fileupload({dataType:"json",dropZone:$("#dropAvatar"),pasteZone:"",add:function(e,data){var tpl=$('<div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div>');tpl.append(data.files[0].name+" <small>[<i>"+formatFileSize(data.files[0].size)+"</i>]</small>");$msg2.html(tpl);data.context=$msg2;var size=data.files[0].size;var maxFileSize=+GlobalConfigs["uploadAvatarSize"]||100;if(typeof size=="number"&&size>1024*1024*maxFileSize){tpl.find("img").remove();tpl.removeClass("alert-info").addClass("alert-danger");tpl.append(" Warning: File size is bigger than "+maxFileSize+"M");setTimeout(function(tpl){return function(){tpl.remove()}}(tpl),3e3);return}var jqXHR;setTimeout(function(){jqXHR=data.submit()},10)},done:function(e,data){if(data.result.Ok==true){data.context.html("");var re=data.result;$("#avatar").attr("src",UrlPrefix+"/"+re.Id)}else{var re=data.result;data.context.html("");var tpl=$('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');tpl.append("<b>Error:</b> "+data.files[0].name+" <small>[<i>"+formatFileSize(data.files[0].size)+"</i>]</small> "+data.result.Msg);data.context.html(tpl);setTimeout(function(tpl){return function(){tpl.remove()}}(tpl),3e3)}},fail:function(e,data){data.context.html("");var tpl=$('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');tpl.append("<b>Error:</b> "+data.files[0].name+" <small>[<i>"+formatFileSize(data.files[0].size)+"</i>]</small> "+data.errorThrown);data.context.html(tpl);setTimeout(function(tpl){return function(){tpl.remove()}}(tpl),3e3)}})};initUploader()});
|
@ -54,11 +54,12 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
|
||||
$('.dropzone .btn-choose-file').click(function() {
|
||||
$(this).parent().find('input').click();
|
||||
});
|
||||
|
||||
|
||||
var $msg = $('#attachUploadMsg');
|
||||
// Initialize the jQuery File Upload plugin
|
||||
$('#uploadAttach').fileupload({
|
||||
dataType: 'json',
|
||||
pasteZone: '', // 不能通过paste来上传图片
|
||||
// This element will accept file drag/drop uploading
|
||||
dropZone: $('#dropAttach'),
|
||||
formData: function(form) {
|
||||
@ -72,6 +73,7 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
|
||||
alert("This note hasn't saved, please save it firstly!")
|
||||
return;
|
||||
}
|
||||
|
||||
var tpl = $('<div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div>');
|
||||
|
||||
// Append the file name and file size
|
||||
@ -140,11 +142,13 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
|
||||
});
|
||||
|
||||
//-------------------
|
||||
// 已经过时, 没有avatar了
|
||||
|
||||
var $msg2 = $('#avatarUploadMsg');
|
||||
$('#uploadAvatar').fileupload({
|
||||
dataType: 'json',
|
||||
dropZone: $('#dropAvatar'),
|
||||
pasteZone: '',
|
||||
add: function(e, data) {
|
||||
var tpl = $('<div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div>');
|
||||
|
||||
@ -206,7 +210,7 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
|
||||
})(tpl), 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
initUploader();
|
||||
});
|
1
public/js/app/editor_drop_paste-min.js
vendored
Normal file
1
public/js/app/editor_drop_paste-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
375
public/js/app/editor_drop_paste.js
Normal file
375
public/js/app/editor_drop_paste.js
Normal file
@ -0,0 +1,375 @@
|
||||
// for editor.
|
||||
// drag image to editor
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
define('editor_drop_paste', ['jquery.ui.widget', 'fileupload'], function(){
|
||||
function Process(editor) {
|
||||
var id = '__mcenew' + (new Date()).getTime();
|
||||
var str = '<div contenteditable="false" id="' + id + '" class="leanote-image-container">' +
|
||||
'<img class="loader" src="/images/ajax-loader.gif">' +
|
||||
'<div class="progress">' +
|
||||
'<div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="2" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">' +
|
||||
'0%' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
this.containerStr = str;
|
||||
editor.insertContent(str);
|
||||
var container = $('#' + id);
|
||||
this.container = container;
|
||||
this.id = id;
|
||||
this.processBar = container.find('.progress-bar');
|
||||
}
|
||||
Process.prototype.update = function(process) {
|
||||
var me = this;
|
||||
// 98%, 不要小数
|
||||
process = Math.ceil(process * 100);
|
||||
if(process >= 100) {
|
||||
process = 99;
|
||||
}
|
||||
process += "%";
|
||||
$('#' + me.id + ' .progress-bar').html(process).css('width', process);
|
||||
}
|
||||
Process.prototype.replace = function(src) {
|
||||
var me = this;
|
||||
getImageSize(src, function() {
|
||||
$('#' + me.id).replaceWith('<img src="' + src + '" />');
|
||||
});
|
||||
}
|
||||
Process.prototype.remove = function() {
|
||||
var me = this;
|
||||
$('#' + me.id).remove();
|
||||
}
|
||||
|
||||
// 当url改变时, 得到图片的大小
|
||||
function getImageSize(url, callback) {
|
||||
var img = document.createElement('img');
|
||||
|
||||
function done(width, height) {
|
||||
img.parentNode.removeChild(img);
|
||||
callback({width: width, height: height});
|
||||
}
|
||||
|
||||
img.onload = function() {
|
||||
done(img.clientWidth, img.clientHeight);
|
||||
};
|
||||
|
||||
img.onerror = function() {
|
||||
done();
|
||||
};
|
||||
|
||||
img.src = url;
|
||||
|
||||
var style = img.style;
|
||||
style.visibility = 'hidden';
|
||||
style.position = 'fixed';
|
||||
style.bottom = style.left = 0;
|
||||
style.width = style.height = 'auto';
|
||||
|
||||
document.body.appendChild(img);
|
||||
}
|
||||
|
||||
var i = 1;
|
||||
function insertImage(data) {
|
||||
var editor = tinymce.activeEditor;
|
||||
var dom = editor.dom;
|
||||
|
||||
var renderImage = function(data2) {
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
var d = {};
|
||||
var imgElm;
|
||||
// 先显示loading...
|
||||
d.id = '__mcenew' + (i++);
|
||||
d.src = "http://leanote.com/images/loading-24.gif";
|
||||
imgElm = dom.createHTML('img', d);
|
||||
tinymce.activeEditor.insertContent(imgElm);
|
||||
imgElm = dom.get(d.id);
|
||||
|
||||
function callback (wh) {
|
||||
dom.setAttrib(imgElm, 'src', data2.src);
|
||||
// dom.setAttrib(imgElm, 'width', data2.width);
|
||||
if(data2.title) {
|
||||
dom.setAttrib(imgElm, 'title', data2.title);
|
||||
}
|
||||
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
};
|
||||
getImageSize(data.src, callback);
|
||||
}
|
||||
|
||||
//-------------
|
||||
// outputImage?fileId=123232323
|
||||
var fileId = "";
|
||||
fileIds = data.src.split("fileId=")
|
||||
if(fileIds.length == 2 && fileIds[1].length == "53aecf8a8a039a43c8036282".length) {
|
||||
fileId = fileIds[1];
|
||||
}
|
||||
if(fileId) {
|
||||
// 得到fileId, 如果这个笔记不是我的, 那么肯定是协作的笔记, 那么需要将图片copy给原note owner
|
||||
var curNote = Note.getCurNote();
|
||||
if(curNote && curNote.UserId != UserInfo.UserId) {
|
||||
(function(data) {
|
||||
ajaxPost("/file/copyImage", {userId: UserInfo.UserId, fileId: fileId, toUserId: curNote.UserId}, function(re) {
|
||||
if(reIsOk(re) && re.Id) {
|
||||
var urlPrefix = window.location.protocol + "//" + window.location.host;
|
||||
data.src = urlPrefix + "/file/outputImage?fileId=" + re.Id;
|
||||
}
|
||||
renderImage(data);
|
||||
});
|
||||
})(data);
|
||||
} else {
|
||||
renderImage(data);
|
||||
}
|
||||
} else {
|
||||
renderImage(data);
|
||||
}
|
||||
}
|
||||
|
||||
var initUploader = function() {
|
||||
var ul = $('#upload ul');
|
||||
|
||||
$('#drop a').click(function() {
|
||||
// trigger to show file select
|
||||
$(this).parent().find('input').click();
|
||||
});
|
||||
|
||||
// Initialize the jQuery File Upload plugin
|
||||
$('#upload').fileupload({
|
||||
dataType: 'json',
|
||||
pasteZone: '', // 不允许paste
|
||||
acceptFileTypes: /(\.|\/)(gif|jpg|jpeg|png|jpe)$/i,
|
||||
maxFileSize: 210000,
|
||||
|
||||
// This element will accept file drag/drop uploading
|
||||
dropZone: $('#drop'),
|
||||
formData: function(form) {
|
||||
return [{name: 'albumId', value: ""}]
|
||||
},
|
||||
// This function is called when a file is added to the queue;
|
||||
// either via the browse button, or via drag/drop:
|
||||
add: function(e, data) {
|
||||
var tpl = $('<li><div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div></li>');
|
||||
|
||||
// Append the file name and file size
|
||||
tpl.find('div').append(data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small>');
|
||||
|
||||
// Add the HTML to the UL element
|
||||
data.context = tpl.appendTo(ul);
|
||||
|
||||
// data.form[0].action += "&album_id=" + $("#albumsForUpload").val();
|
||||
|
||||
// Automatically upload the file once it is added to the queue
|
||||
var jqXHR = data.submit();
|
||||
},
|
||||
|
||||
done: function(e, data) {
|
||||
if (data.result.Ok == true) {
|
||||
data.context.remove();
|
||||
// life
|
||||
var data2 = {src: urlPrefix + "/file/outputImage?fileId=" + data.result.Id}
|
||||
insertImage(data2);
|
||||
} else {
|
||||
data.context.empty();
|
||||
var tpl = $('<li><div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div></li>');
|
||||
tpl.find('div').append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.result.Msg);
|
||||
data.context.append(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 2000);
|
||||
}
|
||||
$("#uploadMsg").scrollTop(1000);
|
||||
},
|
||||
fail: function(e, data) {
|
||||
data.context.empty();
|
||||
var tpl = $('<li><div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div></li>');
|
||||
tpl.find('div').append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.errorThrown);
|
||||
data.context.append(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 2000);
|
||||
|
||||
$("#uploadMsg").scrollTop(1000);
|
||||
}
|
||||
});
|
||||
|
||||
// Prevent the default action when a file is dropped on the window
|
||||
$(document).on('drop dragover', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Helper function that formats the file sizes
|
||||
function formatFileSize(bytes) {
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
}
|
||||
|
||||
function showUpload() {
|
||||
$("#upload").css("z-index", 12);
|
||||
var top = +$("#mceToolbar").css("height").slice(0, -2); // px
|
||||
$("#upload").css("top", top - 8);
|
||||
$("#upload").show();
|
||||
}
|
||||
|
||||
function hideUpload() {
|
||||
$("#upload").css("z-index", 0).css("top", "auto").hide();
|
||||
}
|
||||
|
||||
// drag css
|
||||
$(document).bind('dragover', function (e) {
|
||||
var dropZone = $('#drop'),
|
||||
timeout = window.dropZoneTimeout;
|
||||
if (!timeout) {
|
||||
dropZone.addClass('in');
|
||||
showUpload();
|
||||
} else {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
var found = false,
|
||||
node = e.target;
|
||||
do {
|
||||
if (node === dropZone[0]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
node = node.parentNode;
|
||||
} while (node != null);
|
||||
if (found) {
|
||||
dropZone.addClass('hover');
|
||||
} else {
|
||||
dropZone.removeClass('hover');
|
||||
}
|
||||
window.dropZoneTimeout = setTimeout(function () {
|
||||
window.dropZoneTimeout = null;
|
||||
dropZone.removeClass('in hover');
|
||||
hideUpload();
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// pasteImage
|
||||
var pasteImageInit = function() {
|
||||
// Initialize the jQuery File Upload plugin
|
||||
var dom, editor;
|
||||
$('#editorContent').fileupload({
|
||||
dataType: 'json',
|
||||
pasteZone: $('#editorContent'),
|
||||
dropZone: '', // 只允许paste
|
||||
maxFileSize: 210000,
|
||||
url: "/file/pasteImage",
|
||||
paramName: 'file',
|
||||
formData: function(form) {
|
||||
return [{name: 'from', value: 'pasteImage'}, {name: 'noteId', value: Note.curNoteId}]
|
||||
},
|
||||
/*
|
||||
paste: function(e, data) {
|
||||
var jqXHR = data.submit();
|
||||
},
|
||||
*/
|
||||
progress: function(e, data) {
|
||||
data.process.update(data.loaded / data.total);
|
||||
},
|
||||
add: function(e, data) {
|
||||
var note = Note.getCurNote();
|
||||
if(!note || note.IsNew) {
|
||||
alert("This note hasn't saved, please save it firstly!")
|
||||
return;
|
||||
}
|
||||
// 先显示loading...
|
||||
editor = tinymce.EditorManager.activeEditor;
|
||||
var process = new Process(editor);
|
||||
data.process = process;
|
||||
var jqXHR = data.submit();
|
||||
/*
|
||||
d.id = '__mcenew' + (new Date()).getTime();
|
||||
d.src = "http://leanote.com/images/loading-24.gif"; // 写死了
|
||||
var img = '<img src="' + d.src + '" id="' + d.id + '" />';
|
||||
editor.insertContent(img);
|
||||
var imgElm = $(d.id);
|
||||
data.imgId = d.id;
|
||||
data.context = imgElm;
|
||||
*/
|
||||
|
||||
/*
|
||||
// 上传之
|
||||
var c = new FormData;
|
||||
c.append("from", "pasteImage");
|
||||
// var d;
|
||||
// d = $.ajaxSettings.xhr();
|
||||
// d.withCredentials = i;var d = {};
|
||||
|
||||
// 先显示loading...
|
||||
var editor = tinymce.EditorManager.activeEditor;
|
||||
var dom = editor.dom;
|
||||
var d = {};
|
||||
d.id = '__mcenew';
|
||||
d.src = "http://leanote.com/images/loading-24.gif"; // 写死了
|
||||
editor.insertContent(dom.createHTML('img', d));
|
||||
var imgElm = dom.get('__mcenew');
|
||||
$.ajax({url: "/file/pasteImage", contentType:false, processData:false , data: c, type: "POST"}
|
||||
).done(function(re) {
|
||||
if(!re || typeof re != "object" || !re.Ok) {
|
||||
// 删除
|
||||
dom.remove(imgElm);
|
||||
return;
|
||||
}
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
var src = urlPrefix + "/file/outputImage?fileId=" + re.Id;
|
||||
getImageSize(src, function(wh) {
|
||||
// life 4/25
|
||||
if(wh && wh.width) {
|
||||
if(wh.width > 600) {
|
||||
wh.width = 600;
|
||||
}
|
||||
d.width = wh.width;
|
||||
dom.setAttrib(imgElm, 'width', d.width);
|
||||
}
|
||||
dom.setAttrib(imgElm, 'src', src);
|
||||
});
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
});
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
*/
|
||||
},
|
||||
|
||||
done: function(e, data) {
|
||||
if (data.result.Ok == true) {
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
var re = data.result;
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
var src = urlPrefix + "/file/outputImage?fileId=" + re.Id;
|
||||
|
||||
data.process.replace(src);
|
||||
/*
|
||||
getImageSize(src, function() {
|
||||
$img.attr('src', src);
|
||||
$img.removeAttr('id');
|
||||
});
|
||||
*/
|
||||
} else {
|
||||
data.process.remove();
|
||||
}
|
||||
},
|
||||
fail: function(e, data) {
|
||||
data.process.remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
initUploader();
|
||||
pasteImageInit();
|
||||
});
|
2
public/js/app/note-min.js
vendored
2
public/js/app/note-min.js
vendored
File diff suppressed because one or more lines are too long
@ -14,15 +14,15 @@ Note.interval = ""; // 定时器
|
||||
Note.itemIsBlog = '<div class="item-blog"><i class="fa fa-bold" title="blog"></i></div><div class="item-setting"><i class="fa fa-cog" title="setting"></i></div>';
|
||||
// for render
|
||||
Note.itemTplNoImg = '<li href="#" class="item ?" noteId="?">'
|
||||
Note.itemTplNoImg += Note.itemIsBlog +'<div class="item-desc"><p class="item-title">?</p><p class="item-info"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span></p><p class="desc">?</p></div></li>';
|
||||
Note.itemTplNoImg += Note.itemIsBlog +'<div class="item-desc"><p class="item-title">?</p><p class="item-info"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-clock-o"></i> <span class="updated-time">?</span></p><p class="desc">?</p></div></li>';
|
||||
|
||||
// 有image
|
||||
Note.itemTpl = '<li href="#" class="item ? item-image" noteId="?"><div class="item-thumb" style=""><img src="?"/></div>'
|
||||
Note.itemTpl +=Note.itemIsBlog + '<div class="item-desc" style=""><p class="item-title">?</p><p class="item-info"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span></p><p class="desc">?</p></div></li>';
|
||||
Note.itemTpl +=Note.itemIsBlog + '<div class="item-desc" style=""><p class="item-title">?</p><p class="item-info"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-clock-o"></i> <span class="updated-time">?</span></p><p class="desc">?</p></div></li>';
|
||||
|
||||
// for new
|
||||
Note.newItemTpl = '<li href="#" class="item item-active ?" fromUserId="?" noteId="?">'
|
||||
Note.newItemTpl += Note.itemIsBlog + '<div class="item-desc" style="right: 0px;"><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span><br /><span class="desc">?</span></p></div></li>';
|
||||
Note.newItemTpl += Note.itemIsBlog + '<div class="item-desc" style="right: 0px;"><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-clock-o"></i> <span class="updated-time">?</span><br /><span class="desc">?</span></p></div></li>';
|
||||
|
||||
Note.noteItemListO = $("#noteItemList");
|
||||
|
||||
@ -178,10 +178,9 @@ Note.renderNotesAndFirstOneContent = function(ret) {
|
||||
Note.renderNotes(ret);
|
||||
// 渲染第一个
|
||||
if(!isEmpty(ret[0])) {
|
||||
Note.changeNote(ret[0].NoteId);
|
||||
Note.changeNoteForPjax(ret[0].NoteId, true, false);
|
||||
} else {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 当前的note是否改变过了?
|
||||
@ -248,17 +247,19 @@ Note.curHasChanged = function(force) {
|
||||
}
|
||||
|
||||
// 比较text, 因为note Nav会添加dom会导致content改变
|
||||
if((force && cacheNote.Content != content) || (!force && $(cacheNote.Content).text() != contentText)) {
|
||||
if((force && cacheNote.Content != content) || (!force && (/**/(!cacheNote.IsMarkdown && $(cacheNote.Content).text() != contentText) || (cacheNote.IsMarkdown && cacheNote.Content != contentText)) /**/) ) {
|
||||
hasChanged.hasChanged = true;
|
||||
hasChanged.Content = content;
|
||||
|
||||
// 从html中得到...
|
||||
var c = preview || content;
|
||||
|
||||
hasChanged.Desc = Note.genDesc(c);
|
||||
hasChanged.ImgSrc = Note.getImgSrc(c);
|
||||
hasChanged.Abstract = Note.genAbstract(c);
|
||||
|
||||
// 不是博客或没有自定义设置的
|
||||
if(!cacheNote.HasSelfDefined || !cacheNote.IsBlog) {
|
||||
hasChanged.Desc = Note.genDesc(c);
|
||||
hasChanged.ImgSrc = Note.getImgSrc(c);
|
||||
hasChanged.Abstract = Note.genAbstract(c);
|
||||
}
|
||||
} else {
|
||||
log("text相同");
|
||||
log(cacheNote.Content == content);
|
||||
@ -303,6 +304,7 @@ Note.genDesc = function(content) {
|
||||
// 避免其它的<img 之类的不完全
|
||||
content = $("<div></div>").html(content).text();
|
||||
|
||||
|
||||
// pre下text()会将< => < > => >
|
||||
content = content.replace(/</g, "<");
|
||||
content = content.replace(/>/g, ">");
|
||||
@ -315,6 +317,9 @@ Note.genDesc = function(content) {
|
||||
|
||||
// 得到摘要
|
||||
Note.genAbstract = function(content, len) {
|
||||
if(!content) {
|
||||
return "";
|
||||
}
|
||||
if(len == undefined) {
|
||||
len = 1000;
|
||||
}
|
||||
@ -392,11 +397,14 @@ Note.curChangedSaveIt = function(force) {
|
||||
|
||||
// 保存之
|
||||
showMsg(getMsg("saving"));
|
||||
ajaxPost("/note/UpdateNoteOrContent", hasChanged, function(ret) {
|
||||
ajaxPost("/note/updateNoteOrContent", hasChanged, function(ret) {
|
||||
if(hasChanged.IsNew) {
|
||||
// 缓存之, 后台得到其它信息
|
||||
ret.IsNew = false;
|
||||
Note.setNoteCache(ret, false);
|
||||
|
||||
// 新建笔记也要change history
|
||||
Pjax.changeNote(ret);
|
||||
}
|
||||
showMsg(getMsg("saveSuccess"), 1000);
|
||||
});
|
||||
@ -418,14 +426,93 @@ Note.selectTarget = function(target) {
|
||||
// 2. ajax得到现在的note
|
||||
Note.showContentLoading = function() {
|
||||
$("#noteMaskForLoading").css("z-index", 99999);
|
||||
}
|
||||
};
|
||||
Note.hideContentLoading = function() {
|
||||
$("#noteMaskForLoading").css("z-index", -1);
|
||||
}
|
||||
};
|
||||
|
||||
Note.directToNote = function(noteId) {
|
||||
var $p = $("#noteItemList");
|
||||
var pHeight = $p.height();
|
||||
// 相对于父亲的位置
|
||||
var pTop = $("[noteId='" + noteId + "']").position().top;
|
||||
var scrollTop = $p.scrollTop();
|
||||
pTop += scrollTop;
|
||||
/*
|
||||
log("..");
|
||||
log(noteId);
|
||||
log(pTop + ' ' + pHeight + ' ' + scrollTop);
|
||||
*/
|
||||
|
||||
// 当前的可视范围的元素位置是[scrollTop, pHeight + scrollTop]
|
||||
if(pTop >= scrollTop && pTop <= pHeight + scrollTop) {
|
||||
} else {
|
||||
var top = pTop;
|
||||
log("定位到特定note, 在可视范围内");
|
||||
// 手机不用slimScroll
|
||||
if(!LEA.isMobile && !Mobile.isMobile()) {
|
||||
$("#noteItemList").scrollTop(top);
|
||||
$("#noteItemList").slimScroll({ scrollTo: top + 'px', height: "100%", onlyScrollBar: true});
|
||||
} else {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// mustPush表示是否将状态push到state中, 默认为true
|
||||
// 什么时候为false, 在popstate时
|
||||
// needTargetNobook默认为false, 在点击notebook, renderfirst时为false
|
||||
Note.changeNoteForPjax = function(noteId, mustPush, needTargetNotebook) {
|
||||
var me = this;
|
||||
var note = me.getNote(noteId);
|
||||
if(!note) {
|
||||
return;
|
||||
}
|
||||
var isShare = note.Perm != undefined;
|
||||
if(needTargetNotebook == undefined) {
|
||||
needTargetNotebook = true;
|
||||
}
|
||||
me.changeNote(noteId, isShare, true, function(note) {
|
||||
// push state
|
||||
if(mustPush == undefined) {
|
||||
mustPush = true;
|
||||
}
|
||||
if(mustPush) {
|
||||
Pjax.changeNote(note);
|
||||
}
|
||||
|
||||
// popstate时虽然选中了note, 但位置可能不可见
|
||||
if(needTargetNotebook) {
|
||||
Note.directToNote(noteId);
|
||||
}
|
||||
});
|
||||
|
||||
// 第一次render时定位到第一个笔记的notebook 12.06 life
|
||||
// 或通过pop时
|
||||
// 什么时候需要? 1. 第一次changeNote, 2. pop时, 只有当点击了notebook后才不要
|
||||
|
||||
// 这里, 万一是共享笔记呢?
|
||||
// 切换到共享中
|
||||
if(needTargetNotebook) {
|
||||
if(isShare) {
|
||||
if($("#myShareNotebooks").hasClass("closed")) {
|
||||
$("#myShareNotebooks .folderHeader").trigger("click");
|
||||
}
|
||||
} else {
|
||||
if($("#myNotebooks").hasClass("closed")) {
|
||||
$("#myNotebooks .folderHeader").trigger("click");
|
||||
}
|
||||
}
|
||||
// 如果是子笔记本, 那么要展开父笔记本
|
||||
Notebook.expandNotebookTo(note.NotebookId);
|
||||
}
|
||||
};
|
||||
|
||||
// 点击notebook时调用, 渲染第一个笔记
|
||||
Note.contentAjax = null;
|
||||
Note.contentAjaxSeq = 1;
|
||||
Note.changeNote = function(selectNoteId, isShare, needSaveChanged) {
|
||||
Note.changeNote = function(selectNoteId, isShare, needSaveChanged, callback) {
|
||||
var self = this;
|
||||
|
||||
// -1 停止定时器
|
||||
Note.stopInterval();
|
||||
|
||||
@ -486,6 +573,8 @@ Note.changeNote = function(selectNoteId, isShare, needSaveChanged) {
|
||||
Note.renderNoteContentReadOnly(ret);
|
||||
}
|
||||
self.hideContentLoading();
|
||||
|
||||
callback && callback(ret);
|
||||
}
|
||||
|
||||
if(cacheNote.Content) {
|
||||
@ -493,10 +582,10 @@ Note.changeNote = function(selectNoteId, isShare, needSaveChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = "/note/GetNoteContent";
|
||||
var url = "/note/getNoteContent";
|
||||
var param = {noteId: selectNoteId};
|
||||
if(isShare) {
|
||||
url = "/share/GetShareNoteContent";
|
||||
url = "/share/getShareNoteContent";
|
||||
param.sharedUserId = cacheNote.UserId // 谁的笔记
|
||||
}
|
||||
|
||||
@ -550,8 +639,10 @@ Note.clearNoteInfo = function() {
|
||||
setEditorContent("");
|
||||
|
||||
// markdown editor
|
||||
/*
|
||||
$("#wmd-input").val("");
|
||||
$("#wmd-preview").html("");
|
||||
*/
|
||||
|
||||
// 只隐藏即可
|
||||
$("#noteRead").hide();
|
||||
@ -592,22 +683,22 @@ Note.renderNoteContent = function(content) {
|
||||
}
|
||||
|
||||
// 初始化时渲染最初的notes
|
||||
/**
|
||||
<div id="noteItemList">
|
||||
<!--
|
||||
<div href="#" class="item">
|
||||
<div class="item-thumb" style="">
|
||||
<img src="images/a.gif"/>
|
||||
</div>
|
||||
|
||||
<div class="item-desc" style="">
|
||||
<p class="item-title">?</p>
|
||||
<p class="item-text">
|
||||
?
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
/**
|
||||
<div id="noteItemList">
|
||||
<!--
|
||||
<div href="#" class="item">
|
||||
<div class="item-thumb" style="">
|
||||
<img src="images/a.gif"/>
|
||||
</div>
|
||||
|
||||
<div class="item-desc" style="">
|
||||
<p class="item-title">?</p>
|
||||
<p class="item-text">
|
||||
?
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
*/
|
||||
|
||||
Note.showEditorMask = function() {
|
||||
@ -891,7 +982,7 @@ Note.deleteNote = function(target, contextmenuItem, isShared) {
|
||||
// 显示共享信息
|
||||
Note.listNoteShareUserInfo = function(target) {
|
||||
var noteId = $(target).attr("noteId");
|
||||
showDialogRemote("share/listNoteShareUserInfo", {noteId: noteId});
|
||||
showDialogRemote("/share/listNoteShareUserInfo", {noteId: noteId});
|
||||
}
|
||||
|
||||
// 共享笔记
|
||||
@ -918,7 +1009,7 @@ Note.listNoteContentHistories = function() {
|
||||
options.show = true;
|
||||
$("#leanoteDialog").modal(options);
|
||||
|
||||
ajaxGet("noteContentHistory/listHistories", {noteId: Note.curNoteId}, function(re) {
|
||||
ajaxGet("/noteContentHistory/listHistories", {noteId: Note.curNoteId}, function(re) {
|
||||
if(!isArray(re)) {$content.html(getMsg("noHistories")); return}
|
||||
// 组装成一个tab
|
||||
var str = "<p>" + getMsg("historiesNum") + '</p><div id="historyList"><table class="table table-hover">';
|
||||
@ -968,6 +1059,13 @@ Note.listNoteContentHistories = function() {
|
||||
});
|
||||
}
|
||||
|
||||
// 导出成PDF
|
||||
Note.exportPDF = function(target) {
|
||||
var noteId = $(target).attr("noteId");
|
||||
ajaxGet("/note/exportPdf", {noteId: noteId}, function(ret) {
|
||||
});
|
||||
};
|
||||
|
||||
// 长微博
|
||||
Note.html2Image = function(target) {
|
||||
var noteId = $(target).attr("noteId");
|
||||
@ -1296,8 +1394,9 @@ Note.initContextmenu = function() {
|
||||
{ type: "splitLine" },
|
||||
{ text: getMsg("publicAsBlog"), alias: 'set2Blog', faIcon: "fa-bold", action: Note.setNote2Blog },
|
||||
{ text: getMsg("cancelPublic"), alias: 'unset2Blog', faIcon: "fa-undo", action: Note.setNote2Blog },
|
||||
//{ type: "splitLine" },
|
||||
//{ text: "分享到社区", alias: 'html2Image', icon: "", action: Note.html2Image},
|
||||
// { type: "splitLine" },
|
||||
// { text: "分享到社区", alias: 'html2Image', icon: "", action: Note.html2Image},
|
||||
// { text: "导出PDF", alias: 'exportPDF', icon: "", action: Note.exportPDF},
|
||||
{ type: "splitLine" },
|
||||
{ text: getMsg("delete"), icon: "", faIcon: "fa-trash-o", action: Note.deleteNote },
|
||||
{ text: getMsg("move"), alias: "move", faIcon: "fa-arrow-right",
|
||||
@ -1422,8 +1521,8 @@ var Attach = {
|
||||
var attachId = $(this).closest('li').data("id");
|
||||
var attach = self.attachsMap[attachId];
|
||||
var src = UrlPrefix + "/attach/download?attachId=" + attachId;
|
||||
if(LEA.isMarkdownEditor() && MarkdownEditor) {
|
||||
MarkdownEditor.insertLink(src, attach.Title);
|
||||
if(LEA.isMarkdownEditor() && MD) {
|
||||
MD.insertLink(src, attach.Title);
|
||||
} else {
|
||||
tinymce.activeEditor.insertContent('<a target="_blank" href="' + src + '">' + attach.Title + '</a>');
|
||||
}
|
||||
@ -1439,8 +1538,8 @@ var Attach = {
|
||||
var src = UrlPrefix + "/attach/downloadAll?noteId=" + Note.curNoteId
|
||||
var title = note.Title ? note.Title + ".tar.gz" : "all.tar.gz";
|
||||
|
||||
if(LEA.isMarkdownEditor() && MarkdownEditor) {
|
||||
MarkdownEditor.insertLink(src, title);
|
||||
if(LEA.isMarkdownEditor() && MD) {
|
||||
MD.insertLink(src, title);
|
||||
} else {
|
||||
tinymce.activeEditor.insertContent('<a target="_blank" href="' + src + '">' + title + '</a>');
|
||||
}
|
||||
@ -1573,9 +1672,15 @@ $(function() {
|
||||
Attach.init();
|
||||
|
||||
//-----------------
|
||||
// for list nav
|
||||
// 点击笔记展示之
|
||||
// 避免iphone, ipad两次点击
|
||||
// http://stackoverflow.com/questions/3038898/ipad-iphone-hover-problem-causes-the-user-to-double-click-a-link
|
||||
$("#noteItemList").on("mouseenter", ".item", function(event) {
|
||||
if(LEA.isIpad || LEA.isIphone) {
|
||||
$(this).trigger("click");
|
||||
}
|
||||
});
|
||||
$("#noteItemList").on("click", ".item", function(event) {
|
||||
log(event);
|
||||
event.stopPropagation();
|
||||
var noteId = $(this).attr("noteId");
|
||||
|
||||
@ -1587,7 +1692,8 @@ $(function() {
|
||||
}
|
||||
// 当前的和所选的是一个, 不改变
|
||||
if(Note.curNoteId != noteId) {
|
||||
Note.changeNote(noteId);
|
||||
// 不用重定向到notebook
|
||||
Note.changeNoteForPjax(noteId, true, false);
|
||||
}
|
||||
});
|
||||
|
||||
@ -1631,7 +1737,7 @@ $(function() {
|
||||
});
|
||||
*/
|
||||
$("#searchNoteInput").on("keydown", function(e) {
|
||||
var theEvent = e; // window.event || arguments.callee.caller.arguments[0];
|
||||
var theEvent = e; // window.event || arguments.callee.caller.arguments[0];
|
||||
if(theEvent.keyCode == 13 || theEvent.keyCode == 108) {
|
||||
theEvent.preventDefault();
|
||||
Note.searchNote();
|
||||
@ -1658,7 +1764,7 @@ $(function() {
|
||||
e.stopPropagation();
|
||||
// 得到ID
|
||||
var noteId = $(this).parent().attr('noteId');
|
||||
window.open("/blog/post/" + noteId);
|
||||
window.open("/blog/view/" + noteId);
|
||||
});
|
||||
|
||||
// note setting
|
||||
|
2
public/js/app/notebook-min.js
vendored
2
public/js/app/notebook-min.js
vendored
File diff suppressed because one or more lines are too long
@ -289,6 +289,41 @@ Notebook.cacheAllNotebooks = function(notebooks) {
|
||||
}
|
||||
}
|
||||
|
||||
// 展开到笔记本
|
||||
Notebook.expandNotebookTo = function(notebookId, userId) {
|
||||
var me = this;
|
||||
var selected = false;
|
||||
var tree = me.tree;
|
||||
|
||||
// 共享的
|
||||
if(userId) {
|
||||
tree = Share.trees[userId];
|
||||
}
|
||||
if(!tree) {
|
||||
return;
|
||||
}
|
||||
var curNode = tree.getNodeByTId(notebookId);
|
||||
if(!curNode) {
|
||||
return;
|
||||
}
|
||||
while(true) {
|
||||
var pNode = curNode.getParentNode();
|
||||
if(pNode) {
|
||||
tree.expandNode(pNode, true);
|
||||
if(!selected) {
|
||||
Notebook.changeNotebookNav(notebookId);
|
||||
selected = true;
|
||||
}
|
||||
curNode = pNode;
|
||||
} else {
|
||||
if(!selected) {
|
||||
Notebook.changeNotebookNav(notebookId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// RenderNotebooks调用,
|
||||
// nav 为了新建, 快速选择, 移动笔记
|
||||
@ -507,10 +542,11 @@ Notebook.toggleToMyNav = function(userId, notebookId) {
|
||||
$("#tagSearch").hide();
|
||||
}
|
||||
Notebook.changeNotebookNav = function(notebookId) {
|
||||
Notebook.curNotebookId = notebookId;
|
||||
Notebook.toggleToMyNav();
|
||||
|
||||
// 1
|
||||
Notebook.selectNotebook($(tt('#notebookList [notebookId="?"]', notebookId)));
|
||||
// 1 改变当前的notebook
|
||||
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', notebookId)));
|
||||
|
||||
var notebook = Notebook.cache[notebookId];
|
||||
|
||||
@ -542,7 +578,9 @@ Notebook.curActiveNotebookIsAll = function() {
|
||||
// 1. 改变note, 此时需要先保存
|
||||
// 2. ajax得到该notebook下的所有note
|
||||
// 3. 使用Note.RederNotes()
|
||||
Notebook.changeNotebook = function(notebookId) {
|
||||
// callback Pjax, 当popstate时调用
|
||||
Notebook.changeNotebook = function(notebookId, callback) {
|
||||
var me = this;
|
||||
Notebook.changeNotebookNav(notebookId);
|
||||
|
||||
Notebook.curNotebookId = notebookId;
|
||||
@ -553,7 +591,7 @@ Notebook.changeNotebook = function(notebookId) {
|
||||
// 2 先清空所有
|
||||
Note.clearAll();
|
||||
|
||||
var url = "/note/ListNotes/";
|
||||
var url = "/note/listNotes/";
|
||||
var param = {notebookId: notebookId};
|
||||
|
||||
// 废纸篓
|
||||
@ -565,22 +603,46 @@ Notebook.changeNotebook = function(notebookId) {
|
||||
// 得到全部的...
|
||||
cacheNotes = Note.getNotesByNotebookId();
|
||||
if(!isEmpty(cacheNotes)) { // 万一真的是没有呢?
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
if(callback) {
|
||||
callback(cacheNotes);
|
||||
} else {
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
cacheNotes = Note.getNotesByNotebookId(notebookId);
|
||||
if(!isEmpty(cacheNotes)) { // 万一真的是没有呢?
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
if(!isEmpty(cacheNotes)) { // 万一真的是没有呢? 执行后面的ajax
|
||||
if(callback) {
|
||||
callback(cacheNotes);
|
||||
} else {
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 2 得到笔记本
|
||||
// 这里可以缓存起来, note按notebookId缓存
|
||||
ajaxGet(url, param, Note.renderNotesAndFirstOneContent);
|
||||
me.showNoteAndEditorLoading();
|
||||
ajaxGet(url, param, function(cacheNotes) {
|
||||
if(callback) {
|
||||
callback(cacheNotes);
|
||||
} else {
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
}
|
||||
me.hideNoteAndEditorLoading();
|
||||
});
|
||||
}
|
||||
|
||||
// 笔记列表与编辑器的mask loading
|
||||
Notebook.showNoteAndEditorLoading = function() {
|
||||
$("#noteAndEditorMask").show();
|
||||
};
|
||||
Notebook.hideNoteAndEditorLoading = function() {
|
||||
$("#noteAndEditorMask").hide();
|
||||
};
|
||||
|
||||
// 是否是当前选中的notebookId
|
||||
// 还包括共享
|
||||
// called by Note
|
||||
@ -596,10 +658,10 @@ Notebook.changeNotebookForNewNote = function(notebookId) {
|
||||
return;
|
||||
}
|
||||
|
||||
Notebook.changeNotebookNav(notebookId);
|
||||
Notebook.changeNotebookNav(notebookId, true);
|
||||
Notebook.curNotebookId = notebookId;
|
||||
|
||||
var url = "/note/ListNotes/";
|
||||
var url = "/note/listNotes/";
|
||||
var param = {notebookId: notebookId};
|
||||
|
||||
// 2 得到笔记本
|
||||
@ -614,7 +676,7 @@ Notebook.changeNotebookForNewNote = function(notebookId) {
|
||||
// 显示共享信息
|
||||
Notebook.listNotebookShareUserInfo = function(target) {
|
||||
var notebookId = $(target).attr("notebookId");
|
||||
showDialogRemote("share/listNotebookShareUserInfo", {notebookId: notebookId});
|
||||
showDialogRemote("/share/listNotebookShareUserInfo", {notebookId: notebookId});
|
||||
}
|
||||
// 共享笔记本
|
||||
Notebook.shareNotebooks= function(target) {
|
||||
@ -657,7 +719,7 @@ Notebook.setNotebook2Blog = function(target) {
|
||||
}
|
||||
});
|
||||
}
|
||||
ajaxPost("notebook/setNotebook2Blog", {notebookId: notebookId, isBlog: isBlog}, function(ret) {
|
||||
ajaxPost("/notebook/setNotebook2Blog", {notebookId: notebookId, isBlog: isBlog}, function(ret) {
|
||||
if(ret) {
|
||||
// 这里要设置notebook下的note的blog状态
|
||||
Note.setAllNoteBlogStatus(notebookId, isBlog);
|
||||
@ -849,12 +911,6 @@ $(function() {
|
||||
} else {
|
||||
items.push("set2Blog");
|
||||
}
|
||||
|
||||
//asktalk bebug#23
|
||||
if(notebookId=="548125adf4e872105c000007"){
|
||||
items.push("delete");
|
||||
}
|
||||
|
||||
// 是否还有笔记
|
||||
if(Note.notebookHasNotes(notebookId)) {
|
||||
items.push("delete");
|
||||
|
2
public/js/app/page-min.js
vendored
2
public/js/app/page-min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,10 +4,9 @@
|
||||
//----------------------
|
||||
// 编辑器模式
|
||||
function editorMode() {
|
||||
this.writingHash = "#writing";
|
||||
this.normalHash = "#normal";
|
||||
this.isWritingMode = location.hash == this.writingHash;
|
||||
|
||||
this.writingHash = "writing";
|
||||
this.normalHash = "normal";
|
||||
this.isWritingMode = location.hash.indexOf(this.writingHash) >= 0;
|
||||
this.toggleA = null;
|
||||
}
|
||||
|
||||
@ -17,27 +16,33 @@ editorMode.prototype.toggleAText = function(isWriting) {
|
||||
var toggleA = $(".toggle-editor-mode a");
|
||||
var toggleSpan = $(".toggle-editor-mode span");
|
||||
if(isWriting) {
|
||||
toggleA.attr("href", self.normalHash);
|
||||
toggleA.attr("href", "#" + self.normalHash);
|
||||
toggleSpan.text(getMsg("normalMode"));
|
||||
} else {
|
||||
toggleA.attr("href", self.writingHash);
|
||||
toggleA.attr("href", "#" + self.writingHash);
|
||||
toggleSpan.text(getMsg("writingMode"));
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
editorMode.prototype.isWriting = function(hash) {
|
||||
return hash == this.writingHash;
|
||||
return hash.indexOf(this.writingHash) >= 0
|
||||
}
|
||||
editorMode.prototype.init = function() {
|
||||
this.changeMode(this.isWritingMode);
|
||||
var self = this;
|
||||
$(".toggle-editor-mode").click(function() {
|
||||
//
|
||||
$(".toggle-editor-mode").click(function(e) {
|
||||
e.preventDefault();
|
||||
saveBookmark();
|
||||
var $a = $(this).find("a");
|
||||
var isWriting = self.isWriting($a.attr("href"));
|
||||
self.changeMode(isWriting);
|
||||
//
|
||||
if(isWriting) {
|
||||
setHash("m", self.writingHash);
|
||||
} else {
|
||||
setHash("m", self.normalHash);
|
||||
}
|
||||
|
||||
restoreBookmark();
|
||||
});
|
||||
}
|
||||
@ -123,7 +128,7 @@ editorMode.prototype.writtingMode = function() {
|
||||
|
||||
editorMode.prototype.getWritingCss = function() {
|
||||
if(this.isWritingMode) {
|
||||
return ["css/editor/editor-writting-mode.css"];
|
||||
return ["/css/editor/editor-writting-mode.css"];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
@ -144,8 +149,8 @@ var Resize = {
|
||||
note: $("#note"),
|
||||
body: $("body"),
|
||||
leftColumn: $("#left-column"),
|
||||
rightColumn: $("#right-column"),
|
||||
mdSplitter: $("#mdSplitter"),
|
||||
rightColumn: $("#right-column"), // $("#preview-panel"), //
|
||||
mdSplitter: $("#mdSplitter2"),
|
||||
|
||||
init: function() {
|
||||
var self = this;
|
||||
@ -168,8 +173,10 @@ var Resize = {
|
||||
// 鼠标点下
|
||||
self.mdSplitter.bind("mousedown", function(event) {
|
||||
event.preventDefault(); // 防止选择文本
|
||||
self.mdLineMove = true;
|
||||
$(this).css("background-color", "#ccc");
|
||||
if($(this).hasClass('open')) {
|
||||
self.mdLineMove = true;
|
||||
}
|
||||
// $(this).css("background-color", "#ccc");
|
||||
});
|
||||
|
||||
// 鼠标移动时
|
||||
@ -189,6 +196,37 @@ var Resize = {
|
||||
// 取消遮罩
|
||||
$("#noteMask").css("z-index", -1);
|
||||
});
|
||||
|
||||
// 瞬间
|
||||
var everLeftWidth;
|
||||
$('.layout-toggler-preview').click(function() {
|
||||
var $t = $(this);
|
||||
var $p = self.leftColumn.parent();
|
||||
// 是开的
|
||||
if($t.hasClass('open')) {
|
||||
var totalWidth = $p.width();
|
||||
var minRightWidth = 22;
|
||||
var leftWidth = totalWidth - minRightWidth;
|
||||
everLeftWidth = self.leftColumn.width();
|
||||
self.leftColumn.width(leftWidth);
|
||||
self.rightColumn.css('left', 'auto').width(minRightWidth);
|
||||
|
||||
// 禁止split
|
||||
$t.removeClass('open');//.addClass('close');
|
||||
self.rightColumn.find('.layout-resizer').removeClass('open');
|
||||
$('.preview-container').hide();
|
||||
} else {
|
||||
$t.addClass('open');
|
||||
self.rightColumn.find('.layout-resizer').addClass('open');
|
||||
self.leftColumn.width(everLeftWidth);
|
||||
$('.preview-container').show();
|
||||
self.rightColumn.css('left', everLeftWidth).width('auto');
|
||||
|
||||
if(MD) {
|
||||
MD.onResize();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 停止, 保存数据
|
||||
stopResize: function() {
|
||||
@ -252,7 +290,7 @@ var Resize = {
|
||||
resizeMdColumns: function(event) {
|
||||
var self = this;
|
||||
if (self.mdLineMove) {
|
||||
var mdEditorWidth = event.clientX - self.leftNotebook.width() - self.noteList.width();
|
||||
var mdEditorWidth = event.clientX - self.leftColumn.offset().left; // self.leftNotebook.width() - self.noteList.width();
|
||||
self.setMdColumnWidth(mdEditorWidth);
|
||||
}
|
||||
},
|
||||
@ -261,9 +299,15 @@ var Resize = {
|
||||
var self = this;
|
||||
if(mdEditorWidth > 100) {
|
||||
UserInfo.MdEditorWidth = mdEditorWidth;
|
||||
log(mdEditorWidth)
|
||||
self.leftColumn.width(mdEditorWidth);
|
||||
self.rightColumn.css("left", mdEditorWidth);
|
||||
self.mdSplitter.css("left", mdEditorWidth);
|
||||
// self.mdSplitter.css("left", mdEditorWidth);
|
||||
}
|
||||
|
||||
// 这样, scrollPreview 才会到正确的位置
|
||||
if(MD) {
|
||||
MD.onResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -276,6 +320,7 @@ Mobile = {
|
||||
noteO: $("#note"),
|
||||
bodyO: $("body"),
|
||||
setMenuO: $("#setMenu"),
|
||||
// 弃用, 统一使用Pjax
|
||||
hashChange: function() {
|
||||
var self = Mobile;
|
||||
var hash = location.hash;
|
||||
@ -292,8 +337,8 @@ Mobile = {
|
||||
init: function() {
|
||||
var self = this;
|
||||
self.isMobile();
|
||||
$(window).on("hashchange", self.hashChange);
|
||||
self.hashChange();
|
||||
// $(window).on("hashchange", self.hashChange);
|
||||
// self.hashChange();
|
||||
/*
|
||||
$("#noteItemList").on("tap", ".item", function(event) {
|
||||
$(this).click();
|
||||
@ -314,12 +359,15 @@ Mobile = {
|
||||
var u = navigator.userAgent;
|
||||
LEA.isMobile = false;
|
||||
LEA.isMobile = /Mobile|Android|iPhone|iPad/i.test(u);
|
||||
LEA.isIpad = /iPhone|iPad/i.test(u);
|
||||
LEA.isIpad = /iPad/i.test(u);
|
||||
LEA.isIphone = /iPhone/i.test(u);
|
||||
if(!LEA.isMobile && $(document).width() <= 700){
|
||||
LEA.isMobile = true
|
||||
}
|
||||
return LEA.isMobile;
|
||||
},
|
||||
// 改变笔记, 此时切换到编辑器模式下
|
||||
// note.js click事件处理, 先切换到纯编辑器下, 再调用Note.changeNote()
|
||||
changeNote: function(noteId) {
|
||||
var self = this;
|
||||
if(!LEA.isMobile) {return true;}
|
||||
@ -331,21 +379,25 @@ Mobile = {
|
||||
var self = this;
|
||||
self.bodyO.addClass("full-editor");
|
||||
self.noteO.addClass("editor-show");
|
||||
/*
|
||||
if(changeHash) {
|
||||
if(!noteId) {
|
||||
noteId = Note.curNoteId;
|
||||
}
|
||||
location.hash = "noteId=" + noteId;
|
||||
}
|
||||
*/
|
||||
},
|
||||
toNormal: function(changeHash) {
|
||||
var self = this;
|
||||
self.bodyO.removeClass("full-editor");
|
||||
self.noteO.removeClass("editor-show");
|
||||
|
||||
/*
|
||||
if(changeHash) {
|
||||
location.hash = "notebookAndNote";
|
||||
}
|
||||
*/
|
||||
},
|
||||
switchPage: function() {
|
||||
var self = this;
|
||||
@ -370,10 +422,12 @@ function initSlimScroll() {
|
||||
$("#noteItemList").slimScroll({
|
||||
height: "100%", // ($("#leftNotebook").height()-42)+"px"
|
||||
});
|
||||
/*
|
||||
$("#wmd-input").slimScroll({
|
||||
height: "100%", // $("#wmd-input").height()+"px"
|
||||
});
|
||||
$("#wmd-input").css("width", "100%");
|
||||
*/
|
||||
|
||||
$("#wmd-panel-preview").slimScroll({
|
||||
height: "100%", // $("#wmd-panel-preview").height()+"px"
|
||||
@ -410,43 +464,24 @@ function initEditor() {
|
||||
|
||||
// 初始化编辑器
|
||||
tinymce.init({
|
||||
inline: true,
|
||||
valid_children: "+pre[div|#text|p|span|textarea|i|b|strong]", // ace
|
||||
/*
|
||||
protect: [
|
||||
/\<\/?(if|endif)\>/g, // Protect <if> & </endif>
|
||||
/\<xsl\:[^>]+\>/g, // Protect <xsl:...>
|
||||
// /<pre.*?>.*?<\/pre>/g, // Protect <pre ></pre>
|
||||
// /<p.*?>.*?<\/p>/g, // Protect <pre ></pre>
|
||||
// /<\?php.*?\?>/g // Protect php code
|
||||
],
|
||||
*/
|
||||
setup: function(ed) {
|
||||
ed.on('keydown', Note.saveNote);
|
||||
// indent outdent
|
||||
ed.on('keydown', function(e) {
|
||||
var num = e.which ? e.which : e.keyCode;
|
||||
if (num == 9) { // tab pressed
|
||||
|
||||
if(!e.shiftKey) {
|
||||
// ed.execCommand('Indent');
|
||||
// TODO 如果当前在li, ul, ol下不执行!!
|
||||
// 如果在pre下就加tab
|
||||
var node = ed.selection.getNode();
|
||||
if(node.nodeName == "PRE") {
|
||||
ed.execCommand('mceInsertRawHTML', false, '\x09'); // inserts tab
|
||||
} else {
|
||||
ed.execCommand('mceInsertRawHTML', false, " "); // inserts 空格
|
||||
}
|
||||
} else {
|
||||
// delete 4 个空格
|
||||
// ed.execCommand('Outdent');
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// 为了把下拉菜单关闭
|
||||
ed.on("click", function(e) {
|
||||
$("body").trigger("click");
|
||||
});
|
||||
|
||||
// 鼠标移上时
|
||||
ed.on("click", function() {
|
||||
log(ed.selection.getNode())
|
||||
});
|
||||
},
|
||||
|
||||
// fix TinyMCE Removes site base url
|
||||
@ -458,16 +493,17 @@ function initEditor() {
|
||||
selector : "#editorContent",
|
||||
// height: 100,//这个应该是文档的高度, 而其上层的高度是$("#content").height(),
|
||||
// parentHeight: $("#content").height(),
|
||||
content_css : ["css/bootstrap.css", "css/editor/editor.css"].concat(em.getWritingCss()),
|
||||
// content_css : ["/css/bootstrap.css", "/css/editor/editor.css"].concat(em.getWritingCss()),
|
||||
content_css : ["/css/editor/editor.css"].concat(em.getWritingCss()),
|
||||
skin : "custom",
|
||||
language: LEA.locale, // 语言
|
||||
plugins : [
|
||||
"autolink link leaui_image lists charmap hr", "paste",
|
||||
"searchreplace leanote_nav leanote_code tabfocus",
|
||||
"table directionality textcolor codemirror" ], // nonbreaking
|
||||
"table directionality textcolor" ], // nonbreaking
|
||||
|
||||
toolbar1 : "formatselect | forecolor backcolor | bold italic underline strikethrough | leaui_image | leanote_code | bullist numlist | alignleft aligncenter alignright alignjustify",
|
||||
toolbar2 : "outdent indent blockquote | link unlink | table | hr removeformat | subscript superscript |searchreplace | code | pastetext pasteCopyImage | fontselect fontsizeselect",
|
||||
toolbar1 : "formatselect | forecolor backcolor | bold italic underline strikethrough | leaui_image | leanote_code leanote_inline_code | bullist numlist | alignleft aligncenter alignright alignjustify",
|
||||
toolbar2 : "outdent indent blockquote | link unlink | table | hr removeformat | subscript superscript |searchreplace | pastetext pasteCopyImage | leanote_ace_pre | fontselect fontsizeselect",
|
||||
|
||||
// 使用tab键: http://www.tinymce.com/wiki.php/Plugin3x:nonbreaking
|
||||
// http://stackoverflow.com/questions/13543220/tiny-mce-how-to-allow-people-to-indent
|
||||
@ -485,7 +521,8 @@ function initEditor() {
|
||||
+ "Verdana=verdana,geneva;" + "宋体=SimSun;"
|
||||
+ "新宋体=NSimSun;" + "黑体=SimHei;"
|
||||
+ "微软雅黑=Microsoft YaHei",
|
||||
block_formats : "Header 1=h1;Header 2=h2;Header 3=h3; Header 4=h4;Pre=pre;Paragraph=p",
|
||||
block_formats : "Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Paragraph=p",
|
||||
/*
|
||||
codemirror: {
|
||||
indentOnInit: true, // Whether or not to indent code on init.
|
||||
path: 'CodeMirror', // Path to CodeMirror distribution
|
||||
@ -498,6 +535,7 @@ function initEditor() {
|
||||
//'mode/php/php.js'
|
||||
]
|
||||
},
|
||||
*/
|
||||
// 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.
|
||||
// For example, Firefox enables you to paste images directly into any contentEditable field. This is normally not something people want, so this option is "false" by default.
|
||||
@ -517,7 +555,7 @@ function initEditor() {
|
||||
// 导航
|
||||
var random = 1;
|
||||
function scrollTo(self, tagName, text) {
|
||||
var iframe = $("#editorContent_ifr").contents();
|
||||
var iframe = $("#editorContent"); // .contents();
|
||||
var target = iframe.find(tagName + ":contains(" + text + ")");
|
||||
random++;
|
||||
|
||||
@ -535,12 +573,15 @@ function scrollTo(self, tagName, text) {
|
||||
if (target.size() >= i+1) {
|
||||
target = target.eq(i);
|
||||
// 之前插入, 防止多行定位不准
|
||||
var top = target.offset().top;
|
||||
var nowTop = iframe.scrollTop();
|
||||
|
||||
// log(target.scrollTop());
|
||||
var top = iframe.scrollTop() - iframe.offset().top + target.offset().top; // 相对于iframe的位置
|
||||
// var nowTop = iframe.scrollTop();
|
||||
// log(nowTop);
|
||||
// log(top);
|
||||
// iframe.scrollTop(top);
|
||||
// $(iframe).animate({scrollTop: top}, 300); // 有问题
|
||||
iframe.animate({scrollTop: top}, 300); // 有问题
|
||||
|
||||
/*
|
||||
var d = 200; // 时间间隔
|
||||
for(var i = 0; i < d; i++) {
|
||||
setTimeout(
|
||||
@ -554,6 +595,7 @@ function scrollTo(self, tagName, text) {
|
||||
setTimeout(function() {
|
||||
iframe.scrollTop(top);
|
||||
}, d+5);
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -588,11 +630,12 @@ $(function() {
|
||||
});
|
||||
|
||||
// 导航隐藏与显示
|
||||
$("#leanoteNav h1").on("click", function(e) {
|
||||
if (!$("#leanoteNav").hasClass("unfolder")) {
|
||||
$("#leanoteNav").addClass("unfolder");
|
||||
$(".leanoteNav h1").on("click", function(e) {
|
||||
var $leanoteNav = $(this).closest('.leanoteNav');
|
||||
if (!$leanoteNav.hasClass("unfolder")) {
|
||||
$leanoteNav.addClass("unfolder");
|
||||
} else {
|
||||
$("#leanoteNav").removeClass("unfolder");
|
||||
$leanoteNav.removeClass("unfolder");
|
||||
}
|
||||
});
|
||||
|
||||
@ -690,10 +733,10 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
$("#leftSwitcher2").click(function() {
|
||||
$("#leftSwitcher2").on('click', function() {
|
||||
maxLeft(true);
|
||||
});
|
||||
$("#leftSwitcher").click(function() {
|
||||
$("#leftSwitcher").click('click', function() {
|
||||
if(Mobile.switchPage()) {
|
||||
minLeft(true);
|
||||
}
|
||||
@ -797,3 +840,510 @@ $(function() {
|
||||
Mobile.init();
|
||||
});
|
||||
|
||||
|
||||
//------------
|
||||
// pjax
|
||||
//------------
|
||||
var Pjax = {
|
||||
init: function() {
|
||||
var me = this;
|
||||
// 当history改变时
|
||||
window.addEventListener('popstate', function(evt){
|
||||
var state = evt.state;
|
||||
if(!state) {
|
||||
return;
|
||||
}
|
||||
document.title = state.title || "Untitled";
|
||||
log("pop");
|
||||
me.changeNotebookAndNote(state.noteId);
|
||||
}, false);
|
||||
|
||||
// ie9
|
||||
if(!history.pushState) {
|
||||
$(window).on("hashchange", function() {
|
||||
var noteId = getHash("noteId");;
|
||||
if(noteId) {
|
||||
me.changeNotebookAndNote(noteId);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// pjax调用
|
||||
// popstate事件发生时, 转换到noteId下, 此时要转换notebookId
|
||||
changeNotebookAndNote: function(noteId) {
|
||||
var note = Note.getNote(noteId);
|
||||
if(!note) {
|
||||
return;
|
||||
}
|
||||
var isShare = note.Perm != undefined;
|
||||
|
||||
var notebookId = note.NotebookId;
|
||||
// 如果是在当前notebook下, 就不要转换notebook了
|
||||
if(Notebook.curNotebookId == notebookId) {
|
||||
// 不push state
|
||||
Note.changeNoteForPjax(noteId, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// 自己的
|
||||
if(!isShare) {
|
||||
// 先切换到notebook下, 得到notes列表, 再changeNote
|
||||
Notebook.changeNotebook(notebookId, function(notes) {
|
||||
Note.renderNotes(notes);
|
||||
// 不push state
|
||||
Note.changeNoteForPjax(noteId, false, true);
|
||||
});
|
||||
// 共享笔记
|
||||
} else {
|
||||
Share.changeNotebook(note.UserId, notebookId, function(notes) {
|
||||
Note.renderNotes(notes);
|
||||
// 不push state
|
||||
Note.changeNoteForPjax(noteId, false, true);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// ajax后调用
|
||||
changeNote: function(noteInfo) {
|
||||
var me = this;
|
||||
log("push");
|
||||
var noteId = noteInfo.NoteId;
|
||||
var title = noteInfo.Title;
|
||||
var url = '/note/' + noteId;
|
||||
if(location.hash) {
|
||||
url += location.hash;
|
||||
}
|
||||
// 如果支持pushState
|
||||
if(history.pushState) {
|
||||
var state=({
|
||||
url: url,
|
||||
noteId: noteId,
|
||||
title: title,
|
||||
});
|
||||
history.pushState(state, title, url);
|
||||
document.title = title || 'Untitled';
|
||||
// 不支持, 则用hash
|
||||
} else {
|
||||
setHash("noteId", noteId);
|
||||
}
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
Pjax.init();
|
||||
});
|
||||
|
||||
//----------
|
||||
// aceEditor
|
||||
LeaAce = {
|
||||
// aceEditorID
|
||||
_aceId: 0,
|
||||
// {id=>ace}
|
||||
_aceEditors: {},
|
||||
_isInit: false,
|
||||
_canAce: false,
|
||||
isAce: true, // 切换pre, 默认是true
|
||||
disableAddHistory: function() {
|
||||
tinymce.activeEditor.undoManager.setCanAdd(false);
|
||||
},
|
||||
resetAddHistory: function() {
|
||||
tinymce.activeEditor.undoManager.setCanAdd(true);
|
||||
},
|
||||
canAce: function() {
|
||||
if(this._isInit) {
|
||||
return this._canAce;
|
||||
}
|
||||
if(getVendorPrefix() == "webkit" && !Mobile.isMobile()) {
|
||||
this._canAce = true;
|
||||
} else {
|
||||
this._canAce = false;
|
||||
}
|
||||
this._isInit = true;
|
||||
return this._canAce;
|
||||
},
|
||||
canAndIsAce: function() {
|
||||
return this.canAce() && this.isAce;
|
||||
},
|
||||
getAceId: function () {
|
||||
this.aceId++;
|
||||
return "leanote_ace_" + (new Date()).getTime() + "_" + this._aceId;
|
||||
},
|
||||
initAce: function(id, val, force) {
|
||||
var me = this;
|
||||
if(!force && !me.canAndIsAce()) {
|
||||
return;
|
||||
}
|
||||
me.disableAddHistory();
|
||||
var $pre = $('#' + id);
|
||||
$pre.find('.toggle-raw').remove();
|
||||
var preHtml = $pre.html();
|
||||
|
||||
$pre.removeClass('ace-to-pre');
|
||||
$pre.attr("contenteditable", false); // ? 避免tinymce编辑
|
||||
var aceEditor = ace.edit(id);
|
||||
aceEditor.setTheme("ace/theme/tomorrow");
|
||||
|
||||
var brush = me.getPreBrush($pre);
|
||||
var b = "";
|
||||
if(brush) {
|
||||
try {
|
||||
b = brush.split(':')[1];
|
||||
} catch(e) {}
|
||||
}
|
||||
b = b || "javascript";
|
||||
aceEditor.session.setMode("ace/mode/" + b);
|
||||
aceEditor.getSession().setUseWorker(false); // 不用语法检查
|
||||
aceEditor.setOption("showInvisibles", false); // 不显示空格, 没用
|
||||
aceEditor.setOption("wrap", "free");
|
||||
aceEditor.setShowInvisibles(false);
|
||||
aceEditor.setAutoScrollEditorIntoView(true);
|
||||
aceEditor.setOption("maxLines", 100);
|
||||
aceEditor.commands.addCommand({
|
||||
name: "undo",
|
||||
bindKey: {win: "Ctrl-z", mac: "Command-z"},
|
||||
exec: function(editor) {
|
||||
var undoManager = editor.getSession().getUndoManager();
|
||||
if(undoManager.hasUndo()){
|
||||
undoManager.undo();
|
||||
} else {
|
||||
undoManager.reset();
|
||||
tinymce.activeEditor.undoManager.undo();
|
||||
}
|
||||
}
|
||||
});
|
||||
this._aceEditors[id] = aceEditor;
|
||||
if(val) {
|
||||
aceEditor.setValue(val);
|
||||
// 不要选择代码
|
||||
// TODO
|
||||
} else {
|
||||
// 防止 <pre><div>xx</div></pre> 这里的<div>消失
|
||||
// preHtml = preHtml.replace('/ /g', ' '); // 以前是把' ' 全换成了
|
||||
// aceEditor.setValue(preHtml);
|
||||
// 全不选
|
||||
// aceEditor.selection.clearSelection();
|
||||
}
|
||||
|
||||
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
me.resetAddHistory();
|
||||
return aceEditor;
|
||||
},
|
||||
clearIntervalForInitAce: null,
|
||||
initAceFromContent: function(editor) {
|
||||
if(!this.canAndIsAce()) {
|
||||
var content = $(editor.getBody());
|
||||
content.find('pre').removeClass('ace_editor');
|
||||
return;
|
||||
}
|
||||
var me = this;
|
||||
// 延迟
|
||||
if(this.clearIntervalForInitAce) {
|
||||
clearInterval(this.clearIntervalForInitAce);
|
||||
}
|
||||
this.clearIntervalForInitAce = setTimeout(function() {
|
||||
var content = $(editor.getBody());
|
||||
var pres = content.find('pre');
|
||||
for(var i = 0 ; i < pres.length; ++i) {
|
||||
var pre = pres.eq(i);
|
||||
// 如果不是ace
|
||||
if(me.isInAce(pre)) {
|
||||
break;
|
||||
}
|
||||
setTimeout((function(pre) {
|
||||
return function() {
|
||||
pre.find('.toggle-raw').remove();
|
||||
var value = pre.html();
|
||||
log(value);
|
||||
value = value.replace(/ /g, " ").replace(/\<br *\/*\>/gi,"\n").replace(/</g, '<').replace(/>/g, '>');
|
||||
pre.html(value);
|
||||
var id = pre.attr('id');
|
||||
if(!id) {
|
||||
id = me.getAceId();
|
||||
pre.attr('id', id);
|
||||
}
|
||||
me.initAce(id);
|
||||
}
|
||||
})(pre));
|
||||
}
|
||||
}, 10);
|
||||
},
|
||||
|
||||
allToPre: function(editor) {
|
||||
if(!this.canAndIsAce()) {
|
||||
return;
|
||||
}
|
||||
var me = this;
|
||||
// 延迟
|
||||
if(me.clearIntervalForInitAce) {
|
||||
clearInterval(me.clearIntervalForInitAce);
|
||||
}
|
||||
me.clearIntervalForInitAce = setTimeout(function() {
|
||||
var content = $(editor.getBody());
|
||||
var pres = content.find('pre');
|
||||
for(var i = 0 ; i < pres.length; ++i) {
|
||||
var pre = pres.eq(i);
|
||||
setTimeout((function(pre) {
|
||||
return function() {
|
||||
me.aceToPre(pre);
|
||||
}
|
||||
})(pre));
|
||||
}
|
||||
}, 10);
|
||||
},
|
||||
|
||||
undo: function(editor) {
|
||||
if(!this.canAndIsAce()) {
|
||||
return;
|
||||
}
|
||||
var me = this;
|
||||
// 延迟
|
||||
if(this.clearIntervalForInitAce) {
|
||||
clearInterval(this.clearIntervalForInitAce);
|
||||
}
|
||||
this.clearIntervalForInitAce = setTimeout(function() {
|
||||
var content = $(editor.getBody());
|
||||
var pres = content.find('pre');
|
||||
for(var i = 0 ; i < pres.length; ++i) {
|
||||
var pre = pres.eq(i);
|
||||
setTimeout((function(pre) {
|
||||
return function() {
|
||||
var value = pre.html();
|
||||
var id = pre.attr('id');
|
||||
var aceEditor = me.getAce(id);
|
||||
if(aceEditor) {
|
||||
var value = aceEditor.getValue();
|
||||
aceEditor.destroy();
|
||||
var aceEditor = me.initAce(id, value);
|
||||
// 全不选
|
||||
aceEditor.selection.clearSelection();
|
||||
} else {
|
||||
value = value.replace(/ /g, " ").replace(/\<br *\/*\>/gi,"\n");
|
||||
pre.html(value);
|
||||
var id = pre.attr('id');
|
||||
if(!id) {
|
||||
id = me.getAceId();
|
||||
pre.attr('id', id);
|
||||
}
|
||||
me.initAce(id);
|
||||
}
|
||||
}
|
||||
})(pre));
|
||||
}
|
||||
}, 10);
|
||||
},
|
||||
destroyAceFromContent: function(everContent) {
|
||||
if(!this.canAce()) {
|
||||
return;
|
||||
}
|
||||
var pres = everContent.find('pre');
|
||||
for(var i = 0 ; i < pres.length; ++i) {
|
||||
var id = pres.eq(i).attr('id');
|
||||
var aceEditorAndPre = this.getAce(id);
|
||||
if(aceEditorAndPre) {
|
||||
aceEditorAndPre.destroy();
|
||||
this._aceEditors[id] = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
getAce: function(id) {
|
||||
if(!this.canAce()) {
|
||||
return;
|
||||
}
|
||||
return this._aceEditors[id];
|
||||
},
|
||||
// 当前焦点是否在aceEditor中
|
||||
nowIsInAce: function () {
|
||||
if(!this.canAce()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var node = tinymce.activeEditor.selection.getNode();
|
||||
// log("now...");
|
||||
// log(node);
|
||||
return this.isInAce(node);
|
||||
|
||||
},
|
||||
nowIsInPre: function(){
|
||||
var node = tinymce.activeEditor.selection.getNode();
|
||||
// log("now...");
|
||||
// log(node);
|
||||
return this.isInPre(node);
|
||||
},
|
||||
isInPre: function(node) {
|
||||
var $node = $(node);
|
||||
var node = $node.get(0);
|
||||
if(node.nodeName == "PRE") {
|
||||
return true;
|
||||
} else {
|
||||
// 找到父是pre
|
||||
$pre = $node.closest("pre");
|
||||
if($pre.length == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
// 是否在node内
|
||||
isInAce: function(node) {
|
||||
if(!this.canAce()) {
|
||||
return;
|
||||
}
|
||||
var $node = $(node);
|
||||
var node = $node.get(0);
|
||||
if(node.nodeName == "PRE") {
|
||||
// $node.data('brush', brush);
|
||||
var id = $node.attr('id');
|
||||
var aceEditor = this.getAce(id);
|
||||
if(aceEditor) {
|
||||
return [aceEditor, $node];
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// 找到父是pre
|
||||
$pre = $node.closest("pre");
|
||||
if($pre.length == 0) {
|
||||
return false;
|
||||
}
|
||||
return this.isInAce($pre);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getPreBrush: function (node) {
|
||||
var $pre = $(node);
|
||||
var classes = $pre.attr('class');
|
||||
if(!classes) {
|
||||
return '';
|
||||
}
|
||||
var m = classes.match(/brush:[^ ]*/);
|
||||
var everBrush = "";
|
||||
if(m && m.length > 0) {
|
||||
everBrush = m[0];
|
||||
}
|
||||
return everBrush;
|
||||
},
|
||||
// pre转换成ace
|
||||
preToAce: function (pre, force) {
|
||||
if(!force && !this.canAce()) {
|
||||
return;
|
||||
}
|
||||
var $pre = $(pre);
|
||||
var id = this.getAceId();
|
||||
$pre.attr('id', id);
|
||||
var editor = this.initAce(id, "", true);
|
||||
if(editor) {
|
||||
editor.focus();
|
||||
}
|
||||
},
|
||||
aceToPre: function(pre, isFocus) {
|
||||
var me = this;
|
||||
var $pre = $(pre);
|
||||
// 转成pre
|
||||
var aceEditorAndPre = me.isInAce($pre);
|
||||
if(aceEditorAndPre) {
|
||||
var aceEditor = aceEditorAndPre[0];
|
||||
var $pre = aceEditorAndPre[1];
|
||||
var value = aceEditor.getValue();
|
||||
value = value.replace(/</g, '<').replace(/>/g, '>');
|
||||
// var id = getAceId();
|
||||
var replacePre = $('<pre class="' + $pre.attr('class') + ' ace-to-pre">' + value + "</pre>");
|
||||
$pre.replaceWith(replacePre);
|
||||
aceEditor.destroy();
|
||||
me._aceEditors[$pre.attr('id')] = null;
|
||||
// log($replacePre);
|
||||
if(isFocus) {
|
||||
setTimeout(function() {
|
||||
var tinymceEditor = tinymce.activeEditor;
|
||||
var selection = tinymceEditor.selection;
|
||||
var rng = selection.getRng();
|
||||
// rng.setStart(replacePre.get(0), 1);
|
||||
// rng.setEnd(replacePre.get(0), 9);
|
||||
rng.selectNode(replacePre.get(0));
|
||||
// selection.setRng(rng);
|
||||
// replacePre.focus();
|
||||
tinymceEditor.focus();
|
||||
replacePre.trigger("click");
|
||||
replacePre.html(value + " ");
|
||||
// log(">>>>>>>>>>>>>>")
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 转换raw <-> code
|
||||
handleEvent: function () {
|
||||
if(!this.canAce()) {
|
||||
return;
|
||||
}
|
||||
var me = this;
|
||||
$("#editorContent").on('mouseenter', 'pre', function(){
|
||||
// log('in');
|
||||
// log($(this));
|
||||
var $t = $(this);
|
||||
$raw = $t.find('.toggle-raw');
|
||||
if($raw.length == 0) {
|
||||
$t.append('<div class="toggle-raw" title="Toggle code with raw html"><input type="checkbox" /></div>');
|
||||
}
|
||||
$input = $t.find('.toggle-raw input');
|
||||
if(LeaAce.isInAce($t)) {
|
||||
$input.prop('checked', true);
|
||||
} else {
|
||||
$input.prop('checked', false);
|
||||
}
|
||||
});
|
||||
$("#editorContent").on('mouseleave', 'pre', function(){
|
||||
var $raw = $(this).find('.toggle-raw');
|
||||
$raw.remove();
|
||||
});
|
||||
$("#editorContent").on('change', '.toggle-raw input', function(){
|
||||
var checked = $(this).prop('checked');
|
||||
var $pre = $(this).closest('pre');
|
||||
if(checked) {
|
||||
// 转成ace
|
||||
me.preToAce($pre, true);
|
||||
} else {
|
||||
me.aceToPre($pre, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// note.html调用
|
||||
// 实始化页面
|
||||
function initPage() {
|
||||
$(function() {
|
||||
Notebook.renderNotebooks(notebooks);
|
||||
Share.renderShareNotebooks(sharedUserInfos, shareNotebooks);
|
||||
|
||||
// 如果初始打开的是共享的笔记
|
||||
// 那么定位到我的笔记
|
||||
if(curSharedNoteNotebookId) {
|
||||
Share.firstRenderShareNote(curSharedUserId, curSharedNoteNotebookId, curNoteId);
|
||||
// 初始打开的是我的笔记
|
||||
} else {
|
||||
Note.setNoteCache(noteContentJson);
|
||||
Note.renderNotes(notes);
|
||||
if(curNoteId) {
|
||||
// 指定某个note时才target notebook, /note定位到最新
|
||||
// ie10&+要setTimeout
|
||||
setTimeout(function() {
|
||||
Note.changeNoteForPjax(curNoteId, true, curNotebookId);
|
||||
});
|
||||
if(!curNotebookId) {
|
||||
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', Notebook.allNotebookId)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 指定笔记, 也要保存最新笔记
|
||||
if(latestNotes.length > 0) {
|
||||
for(var i = 0; i < latestNotes.length; ++i) {
|
||||
Note.addNoteCache(latestNotes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Tag.renderTagNav(tagsJson);
|
||||
// init notebook后才调用
|
||||
initSlimScroll();
|
||||
|
||||
LeaAce.handleEvent();
|
||||
});
|
||||
}
|
||||
|
2
public/js/app/share-min.js
vendored
2
public/js/app/share-min.js
vendored
File diff suppressed because one or more lines are too long
@ -26,25 +26,25 @@ Share.setCache = function(note) {
|
||||
Share.cache[note.NoteId] = note;
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的共享notebooks
|
||||
<div id="shareNotebooks">
|
||||
<div class="folderNote closed">
|
||||
<div class="folderHeader">
|
||||
<a>
|
||||
<h1>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
Life's</h1>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="folderBody">
|
||||
<li><a>Hadoop</a></li>
|
||||
<li><a>Node webkit</a></li>
|
||||
<li><a>Hadoop</a></li>
|
||||
<li><a>Node webkit</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
*/
|
||||
/**
|
||||
* 我的共享notebooks
|
||||
<div id="shareNotebooks">
|
||||
<div class="folderNote closed">
|
||||
<div class="folderHeader">
|
||||
<a>
|
||||
<h1>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
Life's</h1>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="folderBody">
|
||||
<li><a>Hadoop</a></li>
|
||||
<li><a>Node webkit</a></li>
|
||||
<li><a>Hadoop</a></li>
|
||||
<li><a>Node webkit</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
*/
|
||||
// TODO 层级
|
||||
// shareNotebooks = {userId => {}}
|
||||
Share.getNotebooksForNew = function(userId, notebooks) {
|
||||
@ -94,7 +94,7 @@ Share.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
|
||||
}
|
||||
|
||||
if(!shareNotebooks || typeof shareNotebooks != "object" || shareNotebooks.length < 0) {
|
||||
shareNotebooks = {};
|
||||
shareNotebooks = {};
|
||||
}
|
||||
|
||||
var $shareNotebooks = $("#shareNotebooks");
|
||||
@ -113,7 +113,7 @@ Share.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
|
||||
Share.sharedUserInfos[userInfo.UserId] = userInfo;
|
||||
var userId = userInfo.UserId;
|
||||
var header = tt('<li class="each-user"><div class="friend-header" fromUserId="?"><i class="fa fa-angle-down"></i><span>?</span> <span class="fa notebook-setting" title="setting"></span> </div>', userInfo.UserId, username);
|
||||
var friendId = "friendContainer_" + userId;
|
||||
var friendId = "friendContainer_" + userId;
|
||||
var body = '<ul class="friend-notebooks ztree" id="' + friendId + '" fromUserId="' + userId + '"></ul>';
|
||||
$shareNotebooks.append(header + body + "</li>")
|
||||
|
||||
@ -193,7 +193,7 @@ Share.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
|
||||
e.stopPropagation();
|
||||
var $p = $(this).parent();
|
||||
menuNotebooks.showMenu(e, $p);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Share.isDefaultNotebookId = function(notebookId) {
|
||||
@ -243,25 +243,47 @@ Share.toggleToSharedNav = function(userId, notebookId) {
|
||||
$("#tagSearch").hide();
|
||||
}
|
||||
|
||||
// 刷新加载共享的笔记本, page.js调用
|
||||
Share.firstRenderShareNote = function(ownerUserId, notebookId, noteId) {
|
||||
$("#myShareNotebooks .folderHeader").trigger("click");
|
||||
// 这里, 可能这个笔记本是子笔记本, 所以先扩展
|
||||
Notebook.expandNotebookTo(notebookId, ownerUserId);
|
||||
Share.changeNotebook(ownerUserId, notebookId, function(notes) {
|
||||
Note.renderNotes(notes);
|
||||
// 不push state
|
||||
Note.changeNoteForPjax(noteId, false, false);
|
||||
});
|
||||
};
|
||||
|
||||
//改变笔记本
|
||||
//0. 改变样式
|
||||
//1. 改变note, 此时需要先保存
|
||||
//2. ajax得到该notebook下的所有note
|
||||
//3. 使用Note.RederNotes()
|
||||
Share.changeNotebook = function(userId, notebookId) {
|
||||
Share.changeNotebook = function(userId, notebookId, callback) {
|
||||
var me = this;
|
||||
Notebook.curNotebookId = notebookId;
|
||||
// 选中
|
||||
Notebook.selectNotebook($(tt('#friendContainer_? a[notebookId="?"]', userId, notebookId)));
|
||||
var $t = $(tt('#friendContainer_? a[notebookId="?"]', userId, notebookId));
|
||||
if($t.length == 0) {
|
||||
// 切换到默认共享中
|
||||
// 表示是popstate的默认共享笔记本下
|
||||
Notebook.selectNotebook($(tt('#friendContainer_? a[notebookId="?"]', userId, me.defaultNotebookId)));
|
||||
notebookId = me.defaultNotebookId;
|
||||
} else {
|
||||
Notebook.selectNotebook($t);
|
||||
}
|
||||
|
||||
// 改变nav!!!! TODO
|
||||
Share.toggleToSharedNav(userId, notebookId);
|
||||
|
||||
|
||||
// 1
|
||||
Note.curChangedSaveIt();
|
||||
|
||||
// 2 先清空所有
|
||||
Note.clearAll();
|
||||
|
||||
var url = "/share/ListShareNotes/";
|
||||
var url = "/share/listShareNotes";
|
||||
var param = {userId: userId};
|
||||
if(!Share.isDefaultNotebookId(notebookId)) {
|
||||
param.notebookId = notebookId;
|
||||
@ -276,21 +298,28 @@ Share.changeNotebook = function(userId, notebookId) {
|
||||
if(param.notebookId) {
|
||||
|
||||
}
|
||||
Note.renderNotes(ret, false, true);
|
||||
// 渲染第一个
|
||||
// 这里, 有点小复杂, 还要判断权限...
|
||||
if(!isEmpty(ret)) {
|
||||
// 定位
|
||||
Note.changeNote(ret[0].NoteId, true);
|
||||
if(callback) {
|
||||
callback(ret);
|
||||
} else {
|
||||
Note.renderNotes(ret, false, true);
|
||||
// 渲染第一个
|
||||
// 这里, 有点小复杂, 还要判断权限...
|
||||
if(!isEmpty(ret)) {
|
||||
// 定位
|
||||
Note.changeNoteForPjax(ret[0].NoteId, true, false);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 是否有更新权限
|
||||
// called by Note
|
||||
Share.hasUpdatePerm = function(notebookId) {
|
||||
var note = Share.cache[notebookId];
|
||||
Share.hasUpdatePerm = function(noteId) {
|
||||
var note = Share.cache[noteId];
|
||||
if(!note) {
|
||||
note = Note.getNote(noteId);
|
||||
}
|
||||
if(!note || !note.Perm) {
|
||||
return false;
|
||||
}
|
||||
@ -338,7 +367,7 @@ Share.changeNotebookForNewNote = function(notebookId) {
|
||||
Share.toggleToSharedNav(userId, notebookId);
|
||||
|
||||
// 得到笔记本
|
||||
var url = "/share/ListShareNotes/";
|
||||
var url = "/share/listShareNotes";
|
||||
var param = {userId: userId, notebookId: notebookId};
|
||||
|
||||
// 2 得到笔记本
|
||||
@ -401,7 +430,7 @@ Share.initContextmenu = function(notebooksCopy) {
|
||||
}
|
||||
|
||||
Share.contextmenu = $("#noteItemList .item-shared").contextmenu(noteListMenu);
|
||||
}
|
||||
};
|
||||
|
||||
$(function() {
|
||||
// note setting
|
||||
@ -413,8 +442,6 @@ $(function() {
|
||||
Share.contextmenu.showMenu(e, $p);
|
||||
});
|
||||
|
||||
|
||||
|
||||
//---------------------------
|
||||
// 新建笔记
|
||||
// 1. 直接点击新建 OR
|
||||
@ -453,10 +480,10 @@ $(function() {
|
||||
toHtml = getMsg("readOnly");
|
||||
toPerm = "0";
|
||||
}
|
||||
var url = "/share/UpdateShareNotebookPerm";
|
||||
var url = "/share/updateShareNotebookPerm";
|
||||
var param = {perm: toPerm, toUserId: toUserId};
|
||||
if(Share.dialogIsNote) {
|
||||
url = "/share/UpdateShareNotePerm";
|
||||
url = "/share/updateShareNotePerm";
|
||||
param.noteId = noteOrNotebookId;
|
||||
} else {
|
||||
param.notebookId = noteOrNotebookId;
|
||||
@ -474,10 +501,10 @@ $(function() {
|
||||
var noteOrNotebookId = $(this).attr("noteOrNotebookId");
|
||||
var toUserId = $(this).attr("toUserId");
|
||||
|
||||
var url = "/share/DeleteShareNotebook";
|
||||
var url = "/share/deleteShareNotebook";
|
||||
var param = {toUserId: toUserId};
|
||||
if(Share.dialogIsNote) {
|
||||
url = "/share/DeleteShareNote";
|
||||
url = "/share/deleteShareNote";
|
||||
param.noteId = noteOrNotebookId;
|
||||
} else {
|
||||
param.notebookId = noteOrNotebookId;
|
||||
@ -533,10 +560,10 @@ function addShareNoteOrNotebook(trSeq) {
|
||||
var shareNotePerm = $(trId + ' input[name="perm' + trSeq + '"]:checked').val() || 0;
|
||||
var perm = shareNotePerm;
|
||||
// emails = emails.split(";");
|
||||
var url = "share/addShareNote";
|
||||
var url = "/share/addShareNote";
|
||||
var data = {noteId: id, emails: [emails], perm: shareNotePerm};
|
||||
if(!Share.dialogIsNote) {
|
||||
url = "share/addShareNotebook";
|
||||
url = "/share/addShareNotebook";
|
||||
data = {notebookId: id, emails: [emails], perm: shareNotePerm};
|
||||
}
|
||||
hideAlert("#shareMsg");
|
||||
@ -552,16 +579,8 @@ function addShareNoteOrNotebook(trSeq) {
|
||||
tpl += tt('<td><a href="#" noteOrNotebookId="?" toUserId="?" class="btn btn-warning delete-share">' + getMsg("delete") +'</a></td>', id, ret.Id);
|
||||
$(trId).html(tpl);
|
||||
} else {
|
||||
var shareUrl = UrlPrefix + '/register?from=' + UserInfo.Username;
|
||||
showAlert("#shareMsg", getMsg('friendNotExits', [getMsg("app"), shareUrl]) + ' <a id="shareCopy" data-clipboard-target="copyDiv">' + getMsg("clickToCopy") + '</a> <span id="copyStatus"></span> <br /> ' + getMsg("sendInviteEmailToYourFriend") + ', <a href="#" onclick="sendRegisterEmail(\'' + emails + '\')">' + getMsg("send"), "warning");
|
||||
$("#copyDiv").text(shareUrl);
|
||||
initCopy("shareCopy", function(args) {
|
||||
if(args.text) {
|
||||
showMsg2("#copyStatus", getMsg("copySuccess"), 1000);
|
||||
} else {
|
||||
showMsg2("#copyStatus", getMsg("copyFailed"), 1000);
|
||||
}
|
||||
});
|
||||
var shareUrl = UrlPrefix + '/register?iu=' + UserInfo.Username;
|
||||
showAlert("#shareMsg", getMsg('friendNotExits', [getMsg("app"), '<input style="background: none;border: 1px solid #ccc;width: 300px;padding: 3px;border-radius: 3px;outline: none;" onclick="$(this).focus().select()" type="text" value="' + shareUrl + '" />']) + '</a> <br /> ' + getMsg("sendInviteEmailToYourFriend") + ', <a href="#" onclick="sendRegisterEmail(\'' + emails + '\')">' + getMsg("send"), "warning");
|
||||
}
|
||||
}
|
||||
}, trId + " .btn-success");
|
||||
@ -580,4 +599,4 @@ function sendRegisterEmail(email) {
|
||||
|
||||
function deleteShareNoteOrNotebook(trSeq) {
|
||||
$("#tr" + trSeq).remove();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user