mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-17 00:15:12 +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);
|
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的各个部分
|
// 拆分filePath的各个部分
|
||||||
splitFile: function(fullFilePath) {
|
splitFile: function(fullFilePath) {
|
||||||
var ret = {
|
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) {
|
addAttach: function(filePaths, noteId, callback) {
|
||||||
if(!noteId || !filePaths) {
|
if(!noteId || !filePaths) {
|
||||||
|
65
note.html
65
note.html
@@ -201,25 +201,24 @@ function log(o) {
|
|||||||
<div id="notebookBottom" class="clearfix">
|
<div id="notebookBottom" class="clearfix">
|
||||||
<!-- fa-spin -->
|
<!-- fa-spin -->
|
||||||
<a class="pull-left sync-icon"><i class="fa fa-refresh"></i></a>
|
<a class="pull-left sync-icon"><i class="fa fa-refresh"></i></a>
|
||||||
|
|
||||||
<div class="pull-right" id="myProfile">
|
<div class="pull-right" id="myProfile">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<a class="dropdown-toggle" title="{{.userInfo.Username}}" data-toggle="dropdown">
|
<a class="dropdown-toggle" data-toggle="dropdown">
|
||||||
<span class="username">
|
<span class="username">
|
||||||
life@leanote.com
|
life@leanote.com
|
||||||
</span>
|
</span><i class="fa fa-angle-down account-more"></i>
|
||||||
<i class="fa fa-angle-down"></i>
|
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu li-a" role="menu">
|
<ul class="dropdown-menu li-a " role="menu">
|
||||||
<li role="presentation" class="my-link" >
|
<li role="presentation">
|
||||||
<a target="_blank" href="{{$.blogUrl}}/{{.userInfo.Username}}">
|
<a>Theme</a>
|
||||||
<i class="fa fa-bold"></i>
|
</li>
|
||||||
Blog</a>
|
<li role="presentation">
|
||||||
|
<a href="login.html">Switch account</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation" onclick="logout()">
|
<li role="presentation">
|
||||||
<i class="fa fa-sign-out"></i>
|
<a>Full async force</a>
|
||||||
Logout
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -379,26 +378,26 @@ function log(o) {
|
|||||||
<ul id="attachList">
|
<ul id="attachList">
|
||||||
</ul>
|
</ul>
|
||||||
<form id="uploadAttach" method="post" action="/attach/UploadAttach" enctype="multipart/form-data">
|
<form id="uploadAttach" method="post" action="/attach/UploadAttach" enctype="multipart/form-data">
|
||||||
<div id="dropAttach" class="dropzone">
|
<div id="dropAttach" class="dropzone">
|
||||||
<input id="chooseFileInput" type="file" name="file" multiple/>
|
<input id="chooseFileInput" type="file" name="file" multiple/>
|
||||||
<input id="downloadFileInput" type="file" nwsaveas="" style=""/>
|
<input id="downloadFileInput" type="file" nwsaveas="" style=""/>
|
||||||
|
|
||||||
<a id="chooseFile" class="btn btn-success btn-choose-file">
|
<a id="chooseFile" class="btn btn-success btn-choose-file">
|
||||||
<i class="fa fa-upload"></i>
|
<i class="fa fa-upload"></i>
|
||||||
<span>Choose Files</span>
|
<span>Choose Files</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-default" id="downloadAllBtn">
|
<a class="btn btn-default" id="downloadAllBtn">
|
||||||
<i class="fa fa-download"></i>
|
<i class="fa fa-download"></i>
|
||||||
<span>Download All</span>
|
<span>Download All</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-default" id="linkAllBtn">
|
<a class="btn btn-default" id="linkAllBtn">
|
||||||
<i class="fa fa-link"></i>
|
<i class="fa fa-link"></i>
|
||||||
<span>Link All</span>
|
<span>Link All</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="attachUploadMsg">
|
<div id="attachUploadMsg">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -755,6 +754,10 @@ function log(o) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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-1.9.0.min.js"></script>
|
||||||
<script src="public/js/jquery.ztree.all-3.5.js"></script>
|
<script src="public/js/jquery.ztree.all-3.5.js"></script>
|
||||||
<script src="public/js/i18n/msg.en.js"></script>
|
<script src="public/js/i18n/msg.en.js"></script>
|
||||||
|
@@ -153,13 +153,12 @@ h1, h2, h3 {
|
|||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin:0;
|
margin:0;
|
||||||
border: 1px solid @hColor;
|
// border: 1px solid @hColor;
|
||||||
// border: 1px solid #e6eaed;
|
// border: 1px solid #e6eaed;
|
||||||
/*overflow-x: hidden; */
|
/*overflow-x: hidden; */
|
||||||
/*overflow-y: scroll;*/
|
/*overflow-y: scroll;*/
|
||||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||||
|
&:before {
|
||||||
&:before {
|
|
||||||
content: "";
|
content: "";
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 12px;
|
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 {
|
.dropdown-menu li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
@@ -1214,9 +1252,7 @@ top: 4px;
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
.sync-icon {
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
#newMyNote {
|
#newMyNote {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 3px;
|
right: 3px;
|
||||||
|
@@ -149,7 +149,6 @@ h3 {
|
|||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid #0fb264;
|
|
||||||
/*overflow-x: hidden; */
|
/*overflow-x: hidden; */
|
||||||
/*overflow-y: scroll;*/
|
/*overflow-y: scroll;*/
|
||||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||||
@@ -176,6 +175,43 @@ h3 {
|
|||||||
left: 190px;
|
left: 190px;
|
||||||
right: inherit;
|
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 {
|
.dropdown-menu li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
@@ -1098,9 +1134,6 @@ h3 {
|
|||||||
.close:focus {
|
.close:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
.sync-icon {
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
#newMyNote {
|
#newMyNote {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 3px;
|
right: 3px;
|
||||||
|
@@ -149,7 +149,6 @@ h3 {
|
|||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid #0fb264;
|
|
||||||
/*overflow-x: hidden; */
|
/*overflow-x: hidden; */
|
||||||
/*overflow-y: scroll;*/
|
/*overflow-y: scroll;*/
|
||||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||||
@@ -176,6 +175,43 @@ h3 {
|
|||||||
left: 190px;
|
left: 190px;
|
||||||
right: inherit;
|
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 {
|
.dropdown-menu li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
@@ -1098,9 +1134,6 @@ h3 {
|
|||||||
.close:focus {
|
.close:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
.sync-icon {
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
#newMyNote {
|
#newMyNote {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 3px;
|
right: 3px;
|
||||||
|
@@ -149,7 +149,6 @@ h3 {
|
|||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid #0fb264;
|
|
||||||
/*overflow-x: hidden; */
|
/*overflow-x: hidden; */
|
||||||
/*overflow-y: scroll;*/
|
/*overflow-y: scroll;*/
|
||||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||||
@@ -176,6 +175,43 @@ h3 {
|
|||||||
left: 190px;
|
left: 190px;
|
||||||
right: inherit;
|
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 {
|
.dropdown-menu li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
@@ -1098,9 +1134,6 @@ h3 {
|
|||||||
.close:focus {
|
.close:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
.sync-icon {
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
#newMyNote {
|
#newMyNote {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 3px;
|
right: 3px;
|
||||||
|
@@ -149,7 +149,6 @@ h3 {
|
|||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid #0fb264;
|
|
||||||
/*overflow-x: hidden; */
|
/*overflow-x: hidden; */
|
||||||
/*overflow-y: scroll;*/
|
/*overflow-y: scroll;*/
|
||||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||||
@@ -176,6 +175,43 @@ h3 {
|
|||||||
left: 190px;
|
left: 190px;
|
||||||
right: inherit;
|
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 {
|
.dropdown-menu li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
@@ -1098,9 +1134,6 @@ h3 {
|
|||||||
.close:focus {
|
.close:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
.sync-icon {
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
#newMyNote {
|
#newMyNote {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 3px;
|
right: 3px;
|
||||||
|
@@ -498,11 +498,11 @@ function initEditor() {
|
|||||||
skin : "custom",
|
skin : "custom",
|
||||||
language: LEA.locale, // 语言
|
language: LEA.locale, // 语言
|
||||||
plugins : [
|
plugins : [
|
||||||
"autolink link leaui_image lists charmap hr", "paste",
|
"autolink link image lists charmap hr", "paste",
|
||||||
"searchreplace leanote_nav leanote_code tabfocus",
|
"searchreplace leanote_nav leanote_code tabfocus",
|
||||||
"table directionality textcolor" ], // nonbreaking
|
"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",
|
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
|
// 使用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 WebService = require('web');
|
||||||
var ServerService = require('server');
|
var ServerService = require('server');
|
||||||
var FileService = require('file');
|
var FileService = require('file');
|
||||||
|
var EvtService = require('evt');
|
||||||
|
|
||||||
// 分发服务
|
// 分发服务
|
||||||
// route = /note/notebook
|
// route = /note/notebook
|
||||||
|
@@ -10,26 +10,15 @@
|
|||||||
|
|
||||||
/*global tinymce:true */
|
/*global tinymce:true */
|
||||||
|
|
||||||
// 与jbimages结合
|
|
||||||
// 使用了jbimages/dialog-v4.htm
|
|
||||||
// jbimages/js/dialog-v4.js
|
|
||||||
tinymce.PluginManager.add('image', function(editor, url) {
|
tinymce.PluginManager.add('image', function(editor, url) {
|
||||||
// 弹框
|
// 弹框
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
// 与jbimages结合
|
$('#chooseImageInput').click();
|
||||||
// Simple default dialog
|
|
||||||
win = editor.windowManager.open({
|
|
||||||
title: 'Insert/edit image',
|
|
||||||
file : url + '/dialog.htm',
|
|
||||||
width : 550,
|
|
||||||
height: 345
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加按钮
|
// 添加按钮
|
||||||
editor.addButton('image', {
|
editor.addButton('image', {
|
||||||
icon: 'image',
|
icon: 'image',
|
||||||
tooltip: 'Insert/edit image',
|
tooltip: 'Insert image',
|
||||||
onclick: showDialog,
|
onclick: showDialog,
|
||||||
stateSelector: 'img:not([data-mce-object])'
|
stateSelector: 'img:not([data-mce-object])'
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user