mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 07:31:33 +00:00
switch account
This commit is contained in:
20
node_modules/common.js
generated
vendored
20
node_modules/common.js
generated
vendored
@@ -60,6 +60,26 @@ var Common = {
|
||||
callback && callback(false);
|
||||
});
|
||||
},
|
||||
inArray: function(arr, item) {
|
||||
var me = this;
|
||||
if(!arr) {
|
||||
return false;
|
||||
}
|
||||
for(var i = 0; i < arr.length; i++) {
|
||||
if(arr[i] == item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isImageExt: function(ext) {
|
||||
var me = this;
|
||||
if(!ext) {
|
||||
return false;
|
||||
}
|
||||
ext = ext.toLowerCase();
|
||||
return me.inArray(['jpg', 'jpeg', 'bmp', 'png', 'gif'], ext);
|
||||
},
|
||||
// 拆分filePath的各个部分
|
||||
splitFile: function(fullFilePath) {
|
||||
var ret = {
|
||||
|
25
node_modules/file.js
generated
vendored
25
node_modules/file.js
generated
vendored
@@ -180,6 +180,31 @@ var File = {
|
||||
}
|
||||
},
|
||||
|
||||
// tinymce 或 mceeditor上传图片
|
||||
// callback({FileId: "xx"})
|
||||
uploadImage: function(imagePath, callback) {
|
||||
var me = this;
|
||||
// 读取文件, 查看是否是图片
|
||||
var filePathAttr = Common.splitFile(imagePath);
|
||||
var ext = filePathAttr.ext;
|
||||
if(!Common.isImageExt(ext)) {
|
||||
return callback(false, 'Please select a image');
|
||||
}
|
||||
var fileId = Common.objectId();
|
||||
// 复制到图片文件夹
|
||||
filePathAttr.nameNotExt = fileId + '_cp_';
|
||||
var newFilename = fileId + '.' + ext;
|
||||
var newFilePath = User.getCurUserImagesPath() + '/' + newFilename;
|
||||
// 复制之, 并写入到数据库中
|
||||
Common.copyFile(imagePath, newFilePath, function(ret) {
|
||||
if(ret) {
|
||||
me._addImage(fileId, newFilePath, callback);
|
||||
} else {
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 附件操作
|
||||
addAttach: function(filePaths, noteId, callback) {
|
||||
if(!noteId || !filePaths) {
|
||||
|
65
note.html
65
note.html
@@ -201,25 +201,24 @@ function log(o) {
|
||||
<div id="notebookBottom" class="clearfix">
|
||||
<!-- fa-spin -->
|
||||
<a class="pull-left sync-icon"><i class="fa fa-refresh"></i></a>
|
||||
|
||||
<div class="pull-right" id="myProfile">
|
||||
<div class="dropdown">
|
||||
<a class="dropdown-toggle" title="{{.userInfo.Username}}" data-toggle="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="username">
|
||||
life@leanote.com
|
||||
</span>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</span><i class="fa fa-angle-down account-more"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu li-a" role="menu">
|
||||
<li role="presentation" class="my-link" >
|
||||
<a target="_blank" href="{{$.blogUrl}}/{{.userInfo.Username}}">
|
||||
<i class="fa fa-bold"></i>
|
||||
Blog</a>
|
||||
<ul class="dropdown-menu li-a " role="menu">
|
||||
<li role="presentation">
|
||||
<a>Theme</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="login.html">Switch account</a>
|
||||
</li>
|
||||
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation" onclick="logout()">
|
||||
<i class="fa fa-sign-out"></i>
|
||||
Logout
|
||||
<li role="presentation">
|
||||
<a>Full async force</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -379,26 +378,26 @@ function log(o) {
|
||||
<ul id="attachList">
|
||||
</ul>
|
||||
<form id="uploadAttach" method="post" action="/attach/UploadAttach" enctype="multipart/form-data">
|
||||
<div id="dropAttach" class="dropzone">
|
||||
<input id="chooseFileInput" type="file" name="file" multiple/>
|
||||
<input id="downloadFileInput" type="file" nwsaveas="" style=""/>
|
||||
<div id="dropAttach" class="dropzone">
|
||||
<input id="chooseFileInput" type="file" name="file" multiple/>
|
||||
<input id="downloadFileInput" type="file" nwsaveas="" style=""/>
|
||||
|
||||
<a id="chooseFile" class="btn btn-success btn-choose-file">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>Choose Files</span>
|
||||
</a>
|
||||
<a class="btn btn-default" id="downloadAllBtn">
|
||||
<i class="fa fa-download"></i>
|
||||
<span>Download All</span>
|
||||
</a>
|
||||
<a class="btn btn-default" id="linkAllBtn">
|
||||
<i class="fa fa-link"></i>
|
||||
<span>Link All</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="attachUploadMsg">
|
||||
</div>
|
||||
</form>
|
||||
<a id="chooseFile" class="btn btn-success btn-choose-file">
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>Choose Files</span>
|
||||
</a>
|
||||
<a class="btn btn-default" id="downloadAllBtn">
|
||||
<i class="fa fa-download"></i>
|
||||
<span>Download All</span>
|
||||
</a>
|
||||
<a class="btn btn-default" id="linkAllBtn">
|
||||
<i class="fa fa-link"></i>
|
||||
<span>Link All</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="attachUploadMsg">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -755,6 +754,10 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 为了上传图片 -->
|
||||
<input id="chooseImageInput" type="file" name="file" multiple style="display: none"/>
|
||||
|
||||
<script src="public/js/jquery-1.9.0.min.js"></script>
|
||||
<script src="public/js/jquery.ztree.all-3.5.js"></script>
|
||||
<script src="public/js/i18n/msg.en.js"></script>
|
||||
|
@@ -153,13 +153,12 @@ h1, h2, h3 {
|
||||
.dropdown-menu {
|
||||
border-radius: 3px;
|
||||
margin:0;
|
||||
border: 1px solid @hColor;
|
||||
// border: 1px solid @hColor;
|
||||
// border: 1px solid #e6eaed;
|
||||
/*overflow-x: hidden; */
|
||||
/*overflow-y: scroll;*/
|
||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||
|
||||
&:before {
|
||||
&:before {
|
||||
content: "";
|
||||
width: 20px;
|
||||
height: 12px;
|
||||
@@ -182,6 +181,45 @@ h1, h2, h3 {
|
||||
}
|
||||
}
|
||||
|
||||
.sync-icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
#myProfile {
|
||||
.dropdown-menu {
|
||||
top: -110px;
|
||||
&:before {
|
||||
top: auto;
|
||||
bottom: -12px;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
right: 0;
|
||||
text-align: right;
|
||||
.dropdown-toggle {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: block;
|
||||
.username {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 0;
|
||||
right: 18px;
|
||||
line-height: 30px;
|
||||
white-space: nowrap;text-overflow:ellipsis; overflow:hidden;
|
||||
}
|
||||
.account-more {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
line-height: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.dropdown-menu li {
|
||||
list-style: none;
|
||||
padding-left: 10px;
|
||||
@@ -1214,9 +1252,7 @@ top: 4px;
|
||||
|
||||
|
||||
//
|
||||
.sync-icon {
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
#newMyNote {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
|
@@ -149,7 +149,6 @@ h3 {
|
||||
.dropdown-menu {
|
||||
border-radius: 3px;
|
||||
margin: 0;
|
||||
border: 1px solid #0fb264;
|
||||
/*overflow-x: hidden; */
|
||||
/*overflow-y: scroll;*/
|
||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||
@@ -176,6 +175,43 @@ h3 {
|
||||
left: 190px;
|
||||
right: inherit;
|
||||
}
|
||||
.sync-icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
#myProfile {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
right: 0;
|
||||
text-align: right;
|
||||
}
|
||||
#myProfile .dropdown-menu {
|
||||
top: -110px;
|
||||
}
|
||||
#myProfile .dropdown-menu:before {
|
||||
top: auto;
|
||||
bottom: -12px;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
#myProfile .dropdown-toggle {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#myProfile .dropdown-toggle .username {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 0;
|
||||
right: 18px;
|
||||
line-height: 30px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
#myProfile .dropdown-toggle .account-more {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.dropdown-menu li {
|
||||
list-style: none;
|
||||
padding-left: 10px;
|
||||
@@ -1098,9 +1134,6 @@ h3 {
|
||||
.close:focus {
|
||||
outline: none;
|
||||
}
|
||||
.sync-icon {
|
||||
padding: 0 3px;
|
||||
}
|
||||
#newMyNote {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
|
@@ -149,7 +149,6 @@ h3 {
|
||||
.dropdown-menu {
|
||||
border-radius: 3px;
|
||||
margin: 0;
|
||||
border: 1px solid #0fb264;
|
||||
/*overflow-x: hidden; */
|
||||
/*overflow-y: scroll;*/
|
||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||
@@ -176,6 +175,43 @@ h3 {
|
||||
left: 190px;
|
||||
right: inherit;
|
||||
}
|
||||
.sync-icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
#myProfile {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
right: 0;
|
||||
text-align: right;
|
||||
}
|
||||
#myProfile .dropdown-menu {
|
||||
top: -110px;
|
||||
}
|
||||
#myProfile .dropdown-menu:before {
|
||||
top: auto;
|
||||
bottom: -12px;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
#myProfile .dropdown-toggle {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#myProfile .dropdown-toggle .username {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 0;
|
||||
right: 18px;
|
||||
line-height: 30px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
#myProfile .dropdown-toggle .account-more {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.dropdown-menu li {
|
||||
list-style: none;
|
||||
padding-left: 10px;
|
||||
@@ -1098,9 +1134,6 @@ h3 {
|
||||
.close:focus {
|
||||
outline: none;
|
||||
}
|
||||
.sync-icon {
|
||||
padding: 0 3px;
|
||||
}
|
||||
#newMyNote {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
|
@@ -149,7 +149,6 @@ h3 {
|
||||
.dropdown-menu {
|
||||
border-radius: 3px;
|
||||
margin: 0;
|
||||
border: 1px solid #0fb264;
|
||||
/*overflow-x: hidden; */
|
||||
/*overflow-y: scroll;*/
|
||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||
@@ -176,6 +175,43 @@ h3 {
|
||||
left: 190px;
|
||||
right: inherit;
|
||||
}
|
||||
.sync-icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
#myProfile {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
right: 0;
|
||||
text-align: right;
|
||||
}
|
||||
#myProfile .dropdown-menu {
|
||||
top: -110px;
|
||||
}
|
||||
#myProfile .dropdown-menu:before {
|
||||
top: auto;
|
||||
bottom: -12px;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
#myProfile .dropdown-toggle {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#myProfile .dropdown-toggle .username {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 0;
|
||||
right: 18px;
|
||||
line-height: 30px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
#myProfile .dropdown-toggle .account-more {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.dropdown-menu li {
|
||||
list-style: none;
|
||||
padding-left: 10px;
|
||||
@@ -1098,9 +1134,6 @@ h3 {
|
||||
.close:focus {
|
||||
outline: none;
|
||||
}
|
||||
.sync-icon {
|
||||
padding: 0 3px;
|
||||
}
|
||||
#newMyNote {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
|
@@ -149,7 +149,6 @@ h3 {
|
||||
.dropdown-menu {
|
||||
border-radius: 3px;
|
||||
margin: 0;
|
||||
border: 1px solid #0fb264;
|
||||
/*overflow-x: hidden; */
|
||||
/*overflow-y: scroll;*/
|
||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||
@@ -176,6 +175,43 @@ h3 {
|
||||
left: 190px;
|
||||
right: inherit;
|
||||
}
|
||||
.sync-icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
#myProfile {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
right: 0;
|
||||
text-align: right;
|
||||
}
|
||||
#myProfile .dropdown-menu {
|
||||
top: -110px;
|
||||
}
|
||||
#myProfile .dropdown-menu:before {
|
||||
top: auto;
|
||||
bottom: -12px;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
#myProfile .dropdown-toggle {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#myProfile .dropdown-toggle .username {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 0;
|
||||
right: 18px;
|
||||
line-height: 30px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
#myProfile .dropdown-toggle .account-more {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.dropdown-menu li {
|
||||
list-style: none;
|
||||
padding-left: 10px;
|
||||
@@ -1098,9 +1134,6 @@ h3 {
|
||||
.close:focus {
|
||||
outline: none;
|
||||
}
|
||||
.sync-icon {
|
||||
padding: 0 3px;
|
||||
}
|
||||
#newMyNote {
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
|
@@ -498,11 +498,11 @@ function initEditor() {
|
||||
skin : "custom",
|
||||
language: LEA.locale, // 语言
|
||||
plugins : [
|
||||
"autolink link leaui_image lists charmap hr", "paste",
|
||||
"autolink link image lists charmap hr", "paste",
|
||||
"searchreplace leanote_nav leanote_code tabfocus",
|
||||
"table directionality textcolor" ], // nonbreaking
|
||||
|
||||
toolbar1 : "formatselect | forecolor backcolor | bold italic underline strikethrough | leaui_image | leanote_code leanote_inline_code | bullist numlist | alignleft aligncenter alignright alignjustify",
|
||||
toolbar1 : "formatselect | forecolor backcolor | bold italic underline strikethrough | 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
|
||||
@@ -1372,3 +1372,31 @@ function initPage() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 初始bind事件上传图片
|
||||
// tinymce, markdown触发之
|
||||
function initUploadImage() {
|
||||
$('#chooseImageInput').change(function() {
|
||||
var $this = $(this);
|
||||
var imagePath = $this.val();
|
||||
$this.val('');
|
||||
// 上传之
|
||||
FileService.uploadImage(imagePath, function(newImage, msg) {
|
||||
if(newImage) {
|
||||
var note = Note.getCurNote();
|
||||
if(!note.IsMarkdown) {
|
||||
var url = EvtService.getImageLocalUrl(newImage.FileId);
|
||||
tinymce.activeEditor.insertContent('<img src="' + url + '">');
|
||||
} else {
|
||||
// TODO markdown insert Image
|
||||
}
|
||||
} else {
|
||||
alert(msg || "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
$(function() {
|
||||
initUploadImage();
|
||||
});
|
||||
|
@@ -21,7 +21,7 @@ var TagService = Service.tagService;
|
||||
var WebService = require('web');
|
||||
var ServerService = require('server');
|
||||
var FileService = require('file');
|
||||
|
||||
var EvtService = require('evt');
|
||||
|
||||
// 分发服务
|
||||
// route = /note/notebook
|
||||
|
@@ -10,26 +10,15 @@
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
// 与jbimages结合
|
||||
// 使用了jbimages/dialog-v4.htm
|
||||
// jbimages/js/dialog-v4.js
|
||||
tinymce.PluginManager.add('image', function(editor, url) {
|
||||
// 弹框
|
||||
function showDialog() {
|
||||
// 与jbimages结合
|
||||
// Simple default dialog
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert/edit image',
|
||||
file : url + '/dialog.htm',
|
||||
width : 550,
|
||||
height: 345
|
||||
});
|
||||
$('#chooseImageInput').click();
|
||||
}
|
||||
|
||||
// 添加按钮
|
||||
editor.addButton('image', {
|
||||
icon: 'image',
|
||||
tooltip: 'Insert/edit image',
|
||||
tooltip: 'Insert image',
|
||||
onclick: showDialog,
|
||||
stateSelector: 'img:not([data-mce-object])'
|
||||
});
|
||||
|
Reference in New Issue
Block a user