From 54720e0ae7734b20ea277dce1643f75c43c6ef61 Mon Sep 17 00:00:00 2001 From: life Date: Sat, 4 Apr 2015 21:14:18 +0800 Subject: [PATCH] export pdf --- src/node_modules/api.js | 37 + src/node_modules/note.js | 11 +- src/note.html | 14 + src/public/css/css/simple.css | 2336 +++++++++++++++++++++++++++++++ src/public/css/theme/basic.less | 19 + src/public/css/theme/simple.css | 15 + src/public/js/app/note.js | 89 +- src/public/js/common.js | 11 + src/test2.js | 5 +- 9 files changed, 2521 insertions(+), 16 deletions(-) create mode 100644 src/public/css/css/simple.css diff --git a/src/node_modules/api.js b/src/node_modules/api.js index 22f814da..ef19e72d 100644 --- a/src/node_modules/api.js +++ b/src/node_modules/api.js @@ -668,6 +668,43 @@ var Api = { }); }, + exportPdf: function(noteId, callback) { + var me = this; + console.log(me.getUrl('note/exportPdf', {noteId: noteId})); + needle.get(me.getUrl('note/exportPdf', {noteId: noteId}), function(err, resp) { + me.checkError(err, resp); + if(err) { + return callback && callback(false); + } + // log(resp.body); + /* + { 'accept-ranges': 'bytes', + 'content-disposition': 'inline; filename="logo.png"', + 'content-length': '8583', + 'content-type': 'image/png', + date: 'Mon, 19 Jan 2015 15:01:47 GMT', + */ + + var body = resp.body; + if(typeof body == "object" && body.Msg === false) { + return callback(false, "", body.Msg); + } + + var filename = Common.uuid() + '.pdf'; + var imagePath = User.getCurUserImagesPath(); + var imagePathAll = imagePath + '/' + filename; + fs.writeFile(imagePathAll, resp.body, function(err) { + if(err) { + log(err); + log('local save pdf failed 本地保存失败'); + callback(false); + } else { + callback(imagePathAll, filename); + } + }); + }); + }, + // 添加标签 addTag: function(title, callback) { var me = this; diff --git a/src/node_modules/note.js b/src/node_modules/note.js index 67e7111d..1c9d7126 100644 --- a/src/node_modules/note.js +++ b/src/node_modules/note.js @@ -1572,7 +1572,16 @@ var Note = { callback({}); } }); - + }, + exportPdf: function(noteId, callback) { + var me = this; + me.getServerNoteIdByNoteId(noteId, function(serverNoteId) { + if(!serverNoteId) { + callback(false); + } else { + Api.exportPdf(serverNoteId, callback); + } + }) } }; diff --git a/src/note.html b/src/note.html index 2a78010a..07dfebf2 100755 --- a/src/note.html +++ b/src/note.html @@ -768,6 +768,18 @@ function log(o) { + + + diff --git a/src/public/css/css/simple.css b/src/public/css/css/simple.css new file mode 100644 index 00000000..9aa5c08a --- /dev/null +++ b/src/public/css/css/simple.css @@ -0,0 +1,2336 @@ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 300; + src: local('Open Sans Light'), local('OpenSans-Light'), url('../../fonts/open-sans2/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff') format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans'), local('OpenSans'), url('../../fonts/open-sans2/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff') format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 700; + src: local('Open Sans Bold'), local('OpenSans-Bold'), url('../../fonts/open-sans2/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff') format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: italic; + font-weight: 400; + src: local('Open Sans Italic'), local('OpenSans-Italic'), url('../../fonts/open-sans2/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff') format('woff'); +} +/* leanote */ +@font-face { + font-family: 'leanoteregular'; + src: url('../../fonts/leanote/leanote-regular-webfont.eot'); + src: url('../../fonts/leanote/leanote-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../../fonts/leanote/leanote-regular-webfont.woff') format('woff'), url('../../fonts/leanote/leanote-regular-webfont.ttf') format('truetype'), url('../../fonts/leanote/leanote-regular-webfont.svg#leanoteregular') format('svg'); + font-weight: normal; + font-style: normal; +} +#pageInner { + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 0; + overflow: hidden; +} +*, +.h1, +.h2, +.h3, +.h4, +.h5, +.h6 { + font-family: 'Open Sans', 'Helvetica Neue', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; +} +body { + font-family: 'Open Sans', 'Helvetica Neue', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; + font-weight: 300; + font-size: 14px; +} +h1, +h2, +h3 { + font-family: 'Open Sans', 'Helvetica Neue', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; + font-weight: 300 !important; +} +/*"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue", Helvetica, "Microsoft Yahei", Verdana, Simsun, "Segoe UI", "Segoe UI Web Regular", "Segoe UI Symbol", "BBAlpha Sans", "S60 Sans", Arial, sans-serif;*/ +#noteItemList, +#notebook, +#leftNotebook, +.slimScrollDiv, +#editorContent, +#editorContent_ifr, +.mce-edit-area, +.mce-container-body, +.mce-tinymce, +#editor .mce-ifr, +.wmd-input, +#noteReadContent, +#attachList, +#tags, +.editor-content, +.preview-container { + -webkit-overflow-scrolling: touch !important; +} +.ios7-a { + display: inline-block; + padding: 0 10px 0 5px; + height: 36px; + vertical-align: middle; + line-height: 36px; + cursor: pointer; +} +#tool { + border-bottom: 1px solid #ddd; + height: 36px; +} +#tag { + height: 36px; + line-height: 36px; +} +#tags { + display: block; + float: left; + line-height: 25px; + height: 25px; + margin-top: 0; +} +#tags .label { + margin-right: 2px; +} +#tagDropdown { + float: left; +} +#editor, +#mdEditor { + position: absolute; + z-index: 2; + top: 36px; + bottom: 30px; + right: 0; + left: 0; + padding: 0; + display: none; +} +#mdEditor { + z-index: 1; + background-color: #fff; +} +#mdEditor #md-section-helper, +#mdEditor #wmd-input { + font-size: 14px; + line-height: 22px; +} +#tag .dropdown { + line-height: 30px; +} +.btn { + border-radius: 2px; +} +.alert { + margin-bottom: 10px; +} +#logo { + font-family: "leanoteregular"; + font-size: 36px; +} +#logo:before { + content: "a"; +} +#switcher span { + font-family: "leanoteregular"; + border-radius: 5px; + display: inline-block; + cursor: pointer; + font-size: 18px; + height: 34px; + line-height: 34px; + margin-top: 8px; + padding: 0 5px; +} +#switcher span:before { + content: "b"; +} +.noteSplit { + position: absolute; + top: 0; + width: 5px; + height: 100%; + overflow: hidden; + z-index: 5; + cursor: col-resize; +} +.dropdown-menu { + border-radius: 3px; + margin: 0; + /*overflow-x: hidden; */ + /*overflow-y: scroll;*/ + box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px; +} +.dropdown-menu:before { + content: ""; + width: 20px; + height: 12px; + position: absolute; + top: -12px; + right: 20px; + background-image: url("../../images/triangle_2x.png"); + background-size: 20px 12px; +} +.dropdown-submenu .dropdown-menu:before { + background: none; +} +#searchNotebookForAddDropdownList, +#searchNotebookForAddShareDropdownList { + left: -200px; +} +#searchNotebookForAddDropdownList:before, +#searchNotebookForAddShareDropdownList:before { + left: 190px; + right: inherit; +} +.sync-icon { + margin-left: 10px; +} +#syncWarning { + color: #f0ad4e; + display: none; + cursor: pointer; +} +#myProfile { + position: absolute; + left: 45px; + 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; +} +.sync-progress { + height: 2px; + position: absolute; + z-index: 2; + bottom: 0; + left: 0; + right: 0; + margin: 0; + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} +.dropdown-menu li { + list-style: none; + padding-left: 10px; + width: 100%; + height: 30px; + line-height: 30px; +} +.dropdown-menu li > a { + color: #000000; + display: block; + padding-right: 20px; +} +.dropdown-menu > li > a { + padding: 3px 20px 3px 0; +} +#notebookNavForNewNote li:hover { + background: none; +} +#noteList { + position: absolute; + bottom: 0; + top: 0; + /* + overflow-x: hidden; + overflow-y: hidden; + */ + background: #fcfcfc; +} +#noteAndEditorMask { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: #fff; + text-align: center; + padding-top: 60px; + opacity: .3; + z-index: 20; + display: none; +} +.dropdown-submenu { + position: relative; +} +.dropdown-submenu > ul.dropdown-menu { + top: 0; + left: 100%; + margin-left: -3px !important; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + padding-top: 10px !important; +} +.dropdown-submenu:hover > .dropdown-menu { + display: block; +} +.dropdown-submenu:after { + display: block; + content: " "; + position: absolute; + right: 0; + top: 10px; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #666; +} +.dropdown-submenu:hover > a:after { + border-left-color: #fff; +} +.dropdown-submenu.pull-left { + float: none; +} +.dropdown-submenu.pull-left > .dropdown-menu { + left: -100%; + margin-left: 10px; + -webkit-border-radius: 6px 0 6px 6px; + -moz-border-radius: 6px 0 6px 6px; + border-radius: 6px 0 6px 6px; +} +.open > .dropdown-menu, +.dropdown-submenu:hover > .dropdown-menu { + opacity: 1; + transform: scale(1, 1); + -webkit-transform: scale(1, 1); + -moz-transform: scale(1, 1); + -o-transform: scale(1, 1); +} +.dropdown-menu { + opacity: 0; + display: block; + -webkit-transform: scale(0, 0); + -webkit-transform-origin: top; + -webkit-animation-fill-mode: forwards; + -webkit-transition: all 0.2s cubic-bezier(0.34, 1.21, 0.4, 1); + -o-transform: scale(0, 0); + -o-transform-origin: top; + -o-animation-fill-mode: forwards; + -o-transition: all 0.2s cubic-bezier(0.34, 1.21, 0.4, 1); + -moz-transform: scale(0, 0); + -moz-transform-origin: top; + -moz-animation-fill-mode: forwards; + -moz-transition: all 0.2s cubic-bezier(0.34, 1.21, 0.4, 1); + transform: scale(0, 0); + transform-origin: top; + animation-fill-mode: forwards; + transition: all 0.2s cubic-bezier(0.34, 1.21, 0.4, 1); +} +.dropdown-list { + width: 530px; + border-radius: 3px; +} +.dropdown-list ul { + margin: 0; + padding: 0; +} +.dropdown-list ul li { + float: left; + width: 120px; + margin-left: 10px; + margin-bottom: 10px; + border: 1px dashed #ccc; +} +.new-note-right { + padding: 0 5px; + padding-left: 3px; +} +#leanoteMsg { + line-height: 40px; + margin-top: 10px; + margin-left: 10px; +} +#newNoteWrap { + line-height: 40px; + margin-top: 10px; +} +#searchNotebookForAdd { + line-height: normal; + width: 200px; + margin: 0 10px; + margin-bottom: 10px; + height: 30px; + border-color: #ebeff2; + box-shadow: none; +} +#myNotebooks .folderBody { + padding-top: 3px; +} +.folderBody { + overflow-x: hidden; +} +#searchNotebookForList { + height: 30px; + width: 90%; + margin: 3px auto; + margin-top: 0; + border-color: #ebeff2; + box-shadow: none; +} +#noteItemList .item-setting, +#noteItemList .item-blog, +#noteItemList .item-star, +#noteItemList .item-conflict-info { + position: absolute; + right: 1px; + font-size: 10px; + z-index: 2; + padding: 3px; + border-radius: 5px; + cursor: pointer; + width: 20px; + text-align: center; + opacity: 0.5; + background-color: #464C5E; +} +#noteItemList .item-setting .fa, +#noteItemList .item-blog .fa, +#noteItemList .item-star .fa, +#noteItemList .item-conflict-info .fa { + color: #fff; +} +#noteItemList .item-setting:hover, +#noteItemList .item-blog:hover, +#noteItemList .item-star:hover, +#noteItemList .item-conflict-info:hover { + opacity: 0.8; +} +#noteItemList .item-blog { + bottom: 0; + right: 45px; + display: none; +} +#noteItemList .item-setting { + bottom: 0; + display: none; +} +#noteItemList .item-star { + bottom: 0; + right: 23px; + display: none; +} +#noteItemList .item-conflict-info { + bottom: 0; + right: 45px; + display: none; +} +#noteItemList .item-conflict-info .fa { + color: #f0ad4e !important; +} +#noteItemList .item-is-star .item-star .fa:before { + content: "\f005"; +} +#noteItemList .item-is-star .item-star .fa { + color: yellow !important; +} +#noteItemList .item:hover .item-setting, +#noteItemList .item:hover .item-star, +#noteItemList .item:hover .item-blog { + display: block; +} +#noteItemList .item:hover.item-conflict .item-conflict-info { + display: block; +} +.friend-header { + position: relative; +} +.friend-header .notebook-setting { + display: none; +} +.friend-header:hover .notebook-setting { + display: block; +} +.each-user { + margin-bottom: 5px; + margin-left: 5px; + margin-right: 5px; + margin-top: 3px; + border: 1px solid #eee; + border-radius: 3px; +} +.notebook-number-notes { + position: absolute; + right: 10px; + top: 0; + bottom: 0; + z-index: 1; + display: inline-block; + line-height: 20px !important; + height: 20px; + margin-top: 5px; + padding: 0 3px; +} +.notebook-setting { + display: none; + position: absolute; + right: 1px; + top: 0; + bottom: 0; + z-index: 2; + line-height: 30px; +} +.notebook-setting:before { + content: "\f013"; +} +.ztree li a:hover .notebook-setting { + display: block; +} +#myTag .folderBody { + padding: 0 3px; + padding-bottom: 3px; + padding-left: 5px; +} +#myTag .folderBody li { + padding: 3px; + line-height: normal; +} +#notebookList { + border-top: 1px solid rgba(255, 255, 255, 0.05); +} +.ztree { + padding: 0px; +} +#upload { + position: absolute; + z-index: 0; + bottom: 0; + right: 0; + left: 0px; + padding: 0; + background-color: #fff; + text-align: center; + display: none; +} +#upload #drop { + width: 100%; + height: 100%; + padding-top: 100px; +} +#drop.in { + border: 1px solid #000000; +} +#drop.hover { + border: 2px solid #000000; +} +#uploadMsg { + position: absolute; + top: 3px; + right: 3px; + bottom: 10px; + overflow: scroll; + list-style: none; +} +#uploadAttach { + position: relative; + margin-top: 5px; +} +.dropzone { + text-align: center; +} +.dropzone input { + display: none; +} +.dropzone.in { + border: 1px solid #000000; +} +.dropzone.hover { + border: 2px solid #000000; +} +#attachUploadMsg, +#avatarUploadMsg { + list-style-type: none; + margin: 0; + padding: 0; + max-height: 240px; + z-index: 3; +} +#attachUploadMsg .alert, +#avatarUploadMsg .alert { + margin: 0; + padding: 0 3px; + margin-top: 10px; +} +#attachMenu { + width: 450px; + padding: 10px 5px; +} +#attachList { + margin: 0; + padding: 0; + max-height: 450px; + overflow-y: auto; +} +#attachList li { + display: block; + margin: 0; + padding: 0 3px; + border-radius: 3px; + border-bottom: 1px dashed #eee; + height: 45px; + line-height: 45px; +} +#attachList li div { + float: left; +} +#attachList li .attach-title { + width: 290px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +#attachList li .attach-process { + float: right; +} +#attachList li.loading { + text-align: center; +} +.animated { + -webkit-animation-fill-mode: both; + -moz-animation-fill-mode: both; + -ms-animation-fill-mode: both; + -o-animation-fill-mode: both; + animation-fill-mode: both; + -webkit-animation-duration: 0.5s; + -moz-animation-duration: 0.5s; + -ms-animation-duration: 0.5s; + -o-animation-duration: 0.5s; + animation-duration: 0.5s; +} +@-webkit-keyframes fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-o-keyframes fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +.fadeIn { + -webkit-animation-name: fadeIn; + -moz-animation-name: fadeIn; + -o-animation-name: fadeIn; + animation-name: fadeIn; +} +@-webkit-keyframes fadeInUp { + 0% { + opacity: 0; + -webkit-transform: translateY(20px); + } + 100% { + opacity: 1; + -webkit-transform: translateY(0); + } +} +@-moz-keyframes fadeInUp { + 0% { + opacity: 0; + -moz-transform: translateY(20px); + } + 100% { + opacity: 1; + -moz-transform: translateY(0); + } +} +@-o-keyframes fadeInUp { + 0% { + opacity: 0; + -o-transform: translateY(20px); + } + 100% { + opacity: 1; + -o-transform: translateY(0); + } +} +@keyframes fadeInUp { + 0% { + opacity: 0; + transform: translateY(20px); + } + 100% { + opacity: 1; + transform: translateY(0); + } +} +.fadeInUp { + -webkit-animation-name: fadeInUp; + -moz-animation-name: fadeInUp; + -o-animation-name: fadeInUp; + animation-name: fadeInUp; +} +#historyList img { + max-width: 100%; +} +#avatar { + height: 60px; + max-width: 200px; + display: inline-block; + margin: 10px; +} +#noteReadTitle { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +#noteReadInfo { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + color: #666; +} +.my-link, +.new-markdown-text-abbr, +.new-note-text-abbr { + display: none; +} +#myAvatar { + height: 30px; + max-width: 30px; + overflow: hidden; + border-radius: 50%; +} +#tool { + position: relative; +} +#editorBottom { + position: absolute; + left: 0; + right: 0; + bottom: 0; + height: 30px; + border-top: 1px solid #eee; +} +#tag { + position: absolute; + right: 0; + top: 0; + left: 5px; + bottom: 0; +} +#tagColor { + left: 10px; + top: -130px; +} +#tagColor:before { + content: ""; + background-image: none; +} +#addTagInput { + width: 100px; +} +#notesAndSort { + height: 36px; +} +#noteItemListWrap { + position: absolute; + left: 0; + right: 0; + top: 69px; + bottom: 3px; +} +#mdEditorPreview { + position: absolute; + top: 35px; + left: 0; + right: 0; + bottom: 0; +} +#left-column, +#right-column, +#mdSplitter { + position: absolute; + top: 0; + bottom: 0; +} +#mdSplitter { + width: 5px; + height: 100%; + overflow: hidden; + z-index: 5; + cursor: col-resize; + left: 450px; + background: none; +} +#left-column { + left: 0; + width: 450px; +} +#right-column { + left: 450px; + right: 0; + overflow: hidden; +} +.wmd-panel-editor, +.preview-container, +#wmd-input { + height: 100%; +} +.wmd-input, +.wmd-input:focus, +#md-section-helper { + width: 100%; + border: 1px #eee solid; + border-radius: 5px; + outline: none; + font-size: 14px; + resize: none; + overflow-x: hidden; +} +/* 不能为display: none */ +#md-section-helper { + position: absolute; + height: 0; + overflow-y: scroll; + padding: 0 6px; + top: 10px; + /*一条横线....*/ + z-index: -1; + opacity: none; +} +.preview-container { + overflow: auto; +} +.wmd-preview { + width: 100%; + font-size: 14px; + overflow: auto; + overflow-x: hidden; +} +.wmd-button-row, +.preview-button-row { + padding: 0px; + height: auto; + margin: 0; +} +.wmd-spacer { + width: 0px; + height: 20px; + margin-left: 10px; + background-color: Silver; + display: inline-block; + list-style: none; +} +.wmd-button, +.preview-button { + width: 20px; + height: 20px; + display: inline-block; + list-style: none; + cursor: pointer; + font-size: 17px; +} +.wmd-button { + margin-left: 10px; +} +.preview-button { + margin-right: 10px; +} +.wmd-button > span, +.preview-button > span { + width: 20px; + height: 20px; + display: inline-block; + font-size: 14px; +} +.top-nav { + margin: 0 10px; + display: inline-block; + line-height: 60px; +} +.cm-item { + position: relative; +} +.cm-item .cm-text { + position: absolute; + left: 23px; + right: 10px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.cm-item .cm-text .c-text { + display: initial; +} +.b-m-mpanel { + border-radius: 3px; +} +/* item list */ +#noteItemList { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: 100%; + overflow-y: scroll; + padding: 0 5px; +} +#noteItemList .item { + position: relative; + height: 110px; + overflow: hidden; + cursor: default; + border: 1px solid #ebeff2; + border-radius: 3px; + margin-top: 5px; + background-color: #fff; +} +#noteItemList .item:hover, +#noteItemList .contextmenu-hover { + background-color: #ddd !important; +} +.item-active, +#noteItemList .item-active:hover { + background-color: #65bd77 !important; + color: #fff; +} +.item-active .fa, +#noteItemList .item-active:hover .fa { + color: #eee; +} +.item-active .item-info .fa, +#noteItemList .item-active:hover .item-info .fa { + color: #eee !important; +} +.item-active .item-title, +#noteItemList .item-active:hover .item-title { + color: #fff; +} +#noteItemList .item-thumb { + width: 100px; + overflow: hidden; + position: absolute; + z-index: 1; + right: 0px; + top: 4px; + height: 100px; + background-color: #fff; + margin-right: 5px; + line-height: 100px; + text-align: center; +} +.item-thumb img { + max-width: 100px; +} +.item-title { + /*font-weight: 400;*/ + font-size: 16px; + height: 22px; + line-height: 20px; + overflow: hidden; + margin-bottom: 0px; + color: #000000; + border-bottom: dashed 1px #ebeff2; +} +#noteItemList .item-desc { + position: absolute; + left: 0; + top: 4px; + right: 0px; + margin-left: 4px; +} +#noteItemList .item-desc .fa { + color: #666; +} +#noteItemList .item-image .item-desc { + right: 100px; +} +.item-info { + margin: 0; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.desc { + margin: 0; + word-wrap: break-word; +} +#editorMask { + position: absolute; + top: 0px; + bottom: 0px; + right: 0; + left: 0; + background-color: #fff; + display: none; + z-index: -10; + padding-top: 50px; + text-align: center; +} +#editorMask .fa, +#editorMask a { + font-size: 24px; +} +#editorMask a { + display: inline-block; + border-radius: 3px; + border: 1px solid #ebeff2; + padding: 10px; +} +#editorMask a:hover { + background-color: #65bd77; + color: #fff; +} +.note-mask { + position: absolute; + top: 0px; + bottom: 0px; + right: 0; + left: 3px; + z-index: -1; +} +#noteMaskForLoading { + padding-top: 60px; + background: #fff; + text-align: center; + opacity: .3; +} +#themeForm td { + padding: 5px; + text-align: center; +} +#themeForm img { + border: 1px solid #eee; + padding: 2px; +} +.dropdown-menu .divider { + margin: 3px 0; +} +.ace_eidtor, +.ace_editor * { + font: 12px / normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; +} +/* leanote nav */ +.leanoteNav { + position: absolute; + right: 0px; + border: 1px solid #ccc; + border-radius: 3px; + background-color: #fff; + opacity: 0.5; + z-index: 11; + margin-top: 4px; +} +.leanoteNav h1 { + margin: 0; + font-size: 16px; + padding: 3px; + cursor: pointer; +} +.leanoteNav i { + padding: 3px; +} +.leanoteNav span { + display: none; +} +.leanoteNav .leanoteNavContent { + display: none; + overflow: auto; +} +.leanoteNav.unfolder { + min-width: 200px; + max-width: 300px; + opacity: 0.8; +} +.leanoteNav.unfolder h1 { + border-bottom: 1px dashed #ebeff2; +} +.leanoteNav.unfolder span { + display: inline; +} +.leanoteNav.unfolder .leanoteNavContent { + display: block; + min-height: 30px; +} +.leanoteNav ul { + margin: 0; + padding-left: 23px; +} +.leanoteNav ul li { + list-style-type: disc; +} +.leanoteNav ul li a:hover { + color: #0fb264; +} +.leanoteNav ul .nav-h2 { + margin-left: 20px; +} +.leanoteNav ul .nav-h3 { + margin-left: 30px; +} +.leanoteNav ul .nav-h4 { + margin-left: 40px; +} +.leanoteNav ul .nav-h5 { + margin-left: 50px; +} +.scrollTo-a { + cursor: pointer !important; +} +#editorContent { + padding: 5px 10px; + outline: none; + margin-top: 5px; + bottom: 5px !important; +} +#editorContent pre { + position: relative; + -mo-height: auto !important; +} +#editorContent pre .toggle-raw { + position: absolute; + left: 2px; + top: -2px; + z-index: 100; + display: none; +} +#editorContent pre:hover .toggle-raw { + display: block; +} +.ace_invisible_space { + visibility: hidden !important; +} +.mce-tinymce-inline { + border-width: 0 !important; +} +#editorContent a { + color: #2a6496; + text-decoration: underline; +} +#editorContent pre { + font: 12px / normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + color: #4D4D4C; +} +#editorContent .ace-tomorrow { + padding: 0; + padding-left: 44px; +} +#editorContent .ace-to-pre { + padding: 0; + padding-left: 5px; +} +#editorContent .ace_scrollbar-v { + overflow-y: hidden; +} +#editorContent .leanote-image-container { + display: inline-block; + width: 100px; +} +#editorContent .leanote-image-container .loader { + display: inline-block; + vertical-align: top; + margin-right: 3px; + margin-top: 5px; +} +#editorContent .leanote-image-container .progress { + display: inline-block; + margin: 0; + width: 80px; +} +.close:focus { + outline: none; +} +#newMyNote { + position: absolute; + right: 3px; + top: 0; + bottom: 0; + line-height: 30px; + width: 50px; +} +#newMyNote * { + font-size: 14px; +} +#newMyNote .new-split { + color: #ccc; + display: none; +} +#newMyNote #newNoteBtn { + display: inline-block; + border: 1px solid #eee; + border-radius: 5px; + text-align: center; + height: 25px; + width: 20px; + line-height: initial; +} +#newMyNote #newNoteMarkdownBtn { + display: inline-block; + border: 1px solid #eee; + border-radius: 5px; + /* width: 100px; */ + margin-left: 1px; + padding: 0 1px; + height: 25px; + line-height: initial; + text-align: center; +} +#myNotebookNavForListNav { + position: absolute; + line-height: 30px; + left: 55px; + right: 55px; + text-align: center; + font-style: 16px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} +#myNotebookNavForListNav span { + cursor: default; +} +#searchNote { + margin-top: 2px; +} +#sortType { + position: absolute; + left: 4px; + line-height: 36px; + color: #ccc; +} +#starNotes li { + position: relative; + margin: 0; + height: 30px; + border-bottom: 1px dashed #eee; +} +#starNotes li.selected { + background: #eee; +} +#starNotes li a { + padding-left: 20px; + line-height: 30px; + display: block; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} +#starNotes li .delete-star { + position: absolute; + right: 10px; + bottom: 0; + color: #ccc; + display: none; + cursor: pointer; +} +#starNotes li .delete-star:hover { + color: #000; +} +#starNotes li:hover .delete-star { + display: block; +} +#notebookBottom { + position: absolute; + bottom: 0px; + height: 30px; + right: 0; + left: 0; + line-height: 30px; + text-align: right; + padding-right: 5px; + background-color: #f5f6f7; + border-top: 1px solid transparent; + border-color: rgba(0, 0, 0, 0.05); +} +/* editor */ +#editorTool { + margin: 0; + padding: 0; + list-style: none; +} +#editorTool li { + display: inline-block; +} +#noteTitleDiv { + position: absolute; + left: 0; + right: 120px; + height: 35px; + line-height: 35px; + padding-left: 10px; +} +#noteTitle { + height: 100%; + width: 100%; + border: none; + font-size: 20px; +} +#noteTitle:focus { + outline: none !important; +} +#editorContent { + position: absolute; + top: 30px; + bottom: 10px; + right: 0; + left: 0; + overflow: auto; +} +#mdEditor .layout-wrapper-l3 { + top: 30px; + margin-top: 0 !important; + border: none !important; + border-radius: 0 !important; +} +#noteItemList .item-conflict { + border: 2px solid #DBB624; +} +#tagNav i, +#tagNav em { + font-style: normal; +} +#tagNav .tag-delete { + display: none; + margin-left: 3px; + font-size: 12px; +} +#tagNav li:hover .tag-delete { + display: inline-block; +} +#tagNav a:hover { + background: none !important; +} +.fa-spin { + -webkit-animation: fa-spin 1s infinite linear !important; + animation: fa-spin 1s infinite linear !important; +} +.context-tips { + position: absolute; + z-index: 99999; + background: #fff; + border: 1px solid #ccc; + padding: 5px; + border-radius: 5px; + left: 0px; + top: 0px; + /* shaddow */ + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + background-clip: padding-box; + overflow: auto; + width: 100px; + height: 100px; + display: none; +} +#conflictTips { + width: 230px; + height: 80px; +} +.conflict-title { + display: block; + text-decoration: underline; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +html, +body, +#page, +#pageInner { + position: absolute; + left: 0px; + right: 0px; + bottom: 0; + top: 0; + padding: 0; + margin: 0; + border-radius: 5px; + overflow: hidden; + background: transparent; +} +.modal-backdrop { + right: 5px; + left: 5px; + bottom: 5px; + border-radius: 5px; +} +#mainContainer, +#mainMask { + border-radius: 5px; +} +#noteAndEditor { + background-color: #fff; +} +body { + -webkit-user-select: none; + border: 1px solid #ccc; + left: 5px; + right: 5px; + bottom: 5px; + box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); +} +body.no-drag { + -webkit-app-region: no-drag; +} +body.init #winTool { + display: none; +} +body.init #allProcess, +body.init #syncProcess, +body.init .loading-footer { + display: none; +} +body.init #pageInner { + display: none; +} +#preview-contents { + -webkit-user-select: text; +} +#leftNotebook { + overflow: hidden; + border-radius: 5px 0 0 0; +} +#notebook, +#winTool { + overflow: hidden; + border-radius: 5px 0 0 0; +} +#notebook { + background: transparent !important; +} +#leftNotebook { + background: url(images/mohu.png) !important; + background-repeat: repeat; +} +#notebookBottom { + background: transparent !important; +} +#notesAndSort, +.win-tool { + -webkit-user-select: none; +} +#mainMask { + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 0; + background-color: rgba(255, 255, 255, 0.95); + text-align: center; + padding-top: 10px; + z-index: 1000; +} +#mainMask table, +#mainMask td { + width: 100%; + height: 100%; + border: none; + vertical-align: middle; +} +#mainMask #syncProcess { + margin-top: 20px; +} +#mainMask .loading-footer { + text-align: center; + position: absolute; + left: 0; + right: 0; + bottom: 10px; +} +#mainMask .loading-footer a { + color: #ccc; +} +#presentation { + display: none; +} +#editor #mceToolbar { + height: 30px; +} +#editor.all-tool #mceToolbar { + height: 60px; +} +#editor.all-tool .more-fa:before { + content: "\f106"; +} +#editor.all-tool #editorContent { + top: 60px; +} +#editor .more-fa:before { + content: "\f107"; +} +.opened .folderHeader span { + font-weight: bold; +} +#noteList, +#note { + top: 5px; +} +#noteList { + top: 0; + padding-top: 5px; +} +#notebook { + top: 40px !important; +} +#noteItemListWrap { + top: 75px; +} +#myNotebookNavForListNav { + line-height: 35px; +} +#notebook #myStarredNotes .folderHeader { + border-top: 1px solid rgba(0, 0, 0, 0.05); +} +#sortType { + display: none; +} +#myNotebookNavForListNav span { + font-size: 16px; +} +#newMyNote, +#tool { + z-index: 1001; +} +#topDrag { + -webkit-app-region: drag; + position: absolute; + top: 0; + left: 0; + right: 0; + height: 40px; + z-index: 1000; + cursor: move; +} +.no-info { + text-align: center; + margin: 10px 0; + opacity: 0.8; +} +img::selection { + background: transparent; + color: #ffffff; +} +#loadingDialog .modal-dialog { + width: 200px !important; +} +#loadingDialog .modal-body { + text-align: center; + border-radius: 5px; +} +#loadingDialog #loadingDialogBodyMsg { + font-size: 16px; +} +.win-tool { + padding: 5px; + position: absolute; + left: 0; + top: 0; + z-index: 99999; +} +.win-tool a { + display: block; + float: left; + width: 14px; + height: 14px; + background-size: 14px 14px !important; + margin-right: 5px; +} +.win-tool .tool-close { + background: url(icon/traffic-close@2x.png); +} +.win-tool .tool-close:before { + content: ' '; + background: url(icon/traffic-close-hover@2x.png); +} +.win-tool .tool-close-blur { + background: url(icon/traffic-disabled@2x.png); +} +.win-tool .tool-close-blur:before { + content: ' '; + background: url(icon/traffic-close-hover@2x.png); +} +.win-tool .tool-min { + background: url(icon/traffic-minimise@2x.png); +} +.win-tool .tool-min:before { + content: ' '; + background: url(icon/traffic-minimise-hover@2x.png); +} +.win-tool .tool-max { + background: url(icon/traffic-fullscreen@2x.png); +} +.win-tool .tool-max:before { + content: ' '; + background: url(icon/traffic-zoom-hover@2x.png); +} +.win-tool:hover .tool-close, +.win-tool:hover .tool-close-blur { + background: url(icon/traffic-close-hover@2x.png); +} +.win-tool:hover .tool-min { + background: url(icon/traffic-minimise-hover@2x.png); +} +.win-tool:hover .tool-max { + background: url(icon/traffic-zoom-hover@2x.png); +} +.blur .win-tool a { + background: url(icon/traffic-disabled@2x.png); +} +@keyframes rond { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} +@-webkit-keyframes rond { + 0% { + -webkit-transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + } +} +#loadingLogo { + position: relative; + width: 100px; + display: block; + margin: auto; + border: 1px solid #4092C5; + border-radius: 50%; +} +#loadingLogo img { + width: 100px; + padding: 20px; +} +#loadingLogo.loading { + animation: rond 2s infinite; + -webkit-animation: rond 2s infinite; +} +.loading-spin { + animation: rond 2s infinite; + -webkit-animation: rond 2s infinite; +} +::selection { + background: #000000; + color: #ffffff; +} +::-moz-selection { + background: #000000; + color: #ffffff; +} +::-webkit-selection { + background: #000000; + color: #ffffff; +} +a { + color: #000000; + cursor: pointer; +} +a:hover { + text-decoration: none !important; + color: #000000; +} +a.raw { + color: #428bca; +} +a.raw:hover { + color: #2a6496; +} +/* header */ +#header { + height: 60px; + background-color: #ffffff; + color: #ffffff; + border-bottom: 1px solid #ebeff2; + /* for app */ + webkit-user-select: none; + /* 还不知 */ + -webkit-app-region: drag; + /* -webkit-app-region: no-drag; */ +} +#header { + color: #000000; +} +#logo, +#logo span { + line-height: 50px; +} +#logo { + width: 140px; + height: 60px; + padding-left: 10px; + padding-top: 0px; + border-bottom: 1px solid transparent; + border-color: rgba(255, 255, 255, 0.1); +} +#logo span { + background-color: #000; + color: #fff; + border-radius: 10px; + display: inline-block; + padding: 4px 0; + line-height: 1.0; +} +#switcher { + line-height: 50px; + padding-top: 6px; + padding-right: 5px; + width: 30px; + text-align: center; +} +#switcher i { + font-size: 16px; + cursor: pointer; +} +#switcher i:hover { + color: #0fb264; +} +#switcher span { + border-radius: 5px; + cursor: pointer; + font-size: 18px; +} +#switcher span:hover { + color: #0fb264; +} +#searchNote { + padding: 0 10px; + line-height: 30px; + width: 100%; + margin: 0; + margin-top: 2px; +} +#searchNote input { + background-size: 18px 13px; + border-color: #ebeff2; + padding-left: 10px; + height: 30px; + line-height: 20px; + box-shadow: none; + display: block; + width: 93%; + margin: 0 auto; + outline: none; +} +#searchNote input:focus, +#searchNote input:active { + outline: none !important; + box-shadow: none; +} +#header ul { + margin: 0; + padding: 0; + list-style: none; +} +#header ul li.dropdown { + display: inline-block; + height: 60px; +} +#header ul > li > a.dropdown-toggle { + display: block; + padding: 15px 5px 0 0; + position: relative; +} +#header span.icon { + display: inline-block; + font-size: 28px; + color: #999999; +} +.dropdown-menu li > a { + color: #000000; +} +.dropdown-menu li:hover, +.dropdown-menu li:focus { + background-color: #ebeff2; +} +.dropdown-menu li > a:hover, +.dropdown-menu li > a:focus { + background-color: #ebeff2; +} +/*********************/ +#notebookSplitter { + left: 170px; +} +#noteSplitter { + left: 250px; +} +#leftNotebook { + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 170px; +} +#notebook, +#notebookMin { + position: absolute; + left: 0; + bottom: 30px; + top: 0; + right: 0; + /*border: 1px solid #ccc;*/ + background-color: #f5f6f7; + overflow-y: auto; + overflow-x: auto; + z-index: 2; +} +#notebookMin { + z-index: 1; + overflow-y: visible; + overflow-x: visible; + background-color: #eee; +} +#notebookMin div.minContainer { + border-bottom: 1px solid #ccc; + padding: 5px; + position: relative; + cursor: pointer; +} +#notebookMin div.minContainer i { + font-size: 20px; + color: #000; +} +#notebookMin div.minContainer:hover i { + color: #0fb264; +} +#notebookMin div.minContainer ul { + background-color: #fff; + opacity: 0.8; + display: none; + list-style: none; + margin: 0; + margin-left: 20px; + padding: 5px 0px; + border: 1px solid #0fb264; + position: absolute; + z-index: 1000; + top: 0; + left: 10px; + width: 150px; +} +#notebookMin div.minContainer ul li { + padding: 0 5px; + cursor: pointer; +} +#notebookMin div.minContainer ul li span { + cursor: pointer; +} +#notebookMin div.minContainer ul li a { + cursor: pointer; +} +#noteAndEditor { + position: absolute; + bottom: 0; + top: 0; + right: 0; + left: 170px; + border-left: 1px solid #ebeff2; +} +#noteList { + width: 250px; + border-right: 1px solid #ebeff2; +} +#note { + position: absolute; + bottom: 0; + left: 250px; + right: 0; + padding-left: 0; + overflow-y: hidden; + overflow-x: auto; + background-color: #ffffff; +} +.folderHeader { + min-height: 35px; + line-height: 35px; + cursor: pointer; + border-bottom: 1px solid transparent; + border-color: rgba(0, 0, 0, 0.05); + height: 36px; +} +.folderHeader span { + display: inline-block; + line-height: 35px; + color: #000; + font-size: 16px; +} +.folderHeader .fa-left, +.friend-header i.fa { + display: inline-block; + line-height: 35px; + font-size: 16px; + width: 35px; + border-right: 1px solid rgba(0, 0, 0, 0.05); + text-align: center; + color: #000; +} +.each-user div { + cursor: pointer; + border-bottom: 1px solid transparent; + border-color: rgba(0, 0, 0, 0.05); +} +.each-user div span { + display: inline-block; + line-height: 35px; + color: #000; + padding-left: 3px; + font-size: 14px; +} +.each-user div .fa { + width: 20px; + border-right: none; +} +#myNotebooks.opened .fa-left { + /* + background-color: #65bd77; + color: #e2f3e5; +*/ +} +#addNotebookPlus { + padding-right: 10px; + color: #666; +} +#addNotebookPlus .fa { + font-size: 16px; +} +.closed .folder-icon { + /* 折叠状态 */ + width: 9px; + height: 11px; + background-position: -108px -149px; +} +.closed .folderBody { + display: none; +} +.folderBody { + list-style: none; + margin: 0; + padding: 0; +} +.folderBody li { + line-height: 30px; +} +.folderBody a.active { + background-color: #ffffff; + color: #0fb264; +} +.folderBody a:hover, +.folderBody .contextmenu-hover { + background-color: #ebeff2 !important; +} +#notebookList input, +#notebookListForSearch input { + width: 90%; + border: none; + box-shadow: none; + padding-left: 3px; + background: none; +} +#notebookList input:focus, +#notebookListForSearch input:focus { + outline: none !important; + border: none; +} +#myTag .folderBody li { + position: relative; +} +#myTag .folderBody li .badge { + width: 40px; + position: absolute; + right: 3px; + top: 7px; + font-weight: normal; + background-color: #ffffff; + color: #000000; + border: 1px solid #ebeff2; +} +/* notelist */ +#search { + border: #bababa 1px solid; + background-color: #fff; + white-space: nowrap; + position: absolute; + height: 30px; + left: 3px; + right: 60px; + margin-top: 3px; +} +#search label { + display: none; +} +#searchButton { + border: 0 none; + width: 16px; + height: 16px; + overflow: hidden; + cursor: pointer; + position: absolute; + right: 3px; + top: 5px; +} +#searchInput { + border: 0 none; + overflow: hidden; + position: absolute; + right: 20px; + left: 0px; + padding-left: 10px; + height: 28px; +} +#searchInput:focus { + border: none; + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +#notesAndSort { + background-color: #ffffff; + border-bottom: 1px solid #ebeff2; +} +/* 包裹iframe */ +#editor .mce-ifr { + border: none; + overflow: hidden !important; + /*不知道哪里设置了auto*/ + /*border-radius: 5px;*/ +} +/* 最顶层 */ +#editor .mce-tinymce { + border: none; +} +/*编辑器按钮*/ +#mceToolbar, +#wmd-button-bar { + position: relative; + height: 30px; + overflow: hidden; + border-bottom: 1px solid #ccc; + background-color: #f0f0f0; +} +/* 编辑器工具 需要important, 因为mce还要有js加载css, 肯定在此之后 */ +/*加高, 之前显得拥挤*/ +.mce-btn-small button { + padding: 5px 5px !important; + line-height: 20px !important; +} +.mce-menubtn.mce-btn-small span { + line-height: 20px !important; +} +.mce-btn span { + font-family: 'Open Sans', 'Helvetica Neue', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif !important; +} +.mce-primary button, +.mce-primary button i { + text-shadow: none; +} +.mce-primary { + background-color: #47a447 !important; + border-color: #398439 !important; +} +.mce-menu-item:hover, +.mce-menu-item.mce-selected, +.mce-menu-item:focus { + background-color: #ebeff2; +} +.mce-menu-item:hover span, +.mce-menu-item.mce-selected span, +.mce-menu-item:focus span { + color: #000 !important; +} +.mce-menu-item-normal.mce-active { + background-color: #ebeff2; +} +.tool-split { + display: inline-block; + line-height: 25px; + color: #ddd; +} +/*标签与其它工具*/ +/* tag */ +#addTagInput { + line-height: 25px; + display: none; + padding: 0; + border: none; + background-color: #ffffff; +} +#addTagInput:focus { + outline: none; +} +.label-default { + background-color: #464C5E; +} +.label-red { + background-color: #d9534f; +} +.label-yellow { + background-color: #f0ad4e; +} +.label-blue { + background-color: #428bca; +} +.label-green { + background-color: #5cb85c; +} +.label { + border-radius: 3px; + font-weight: normal; +} +.label i { + width: 10px; + cursor: pointer; + font-style: normal; + /*border-left: 1px solid #ccc;*/ + display: inline-block; + padding-left: 3px; + opacity: 0; +} +.label i:hover { + opacity: 1; +} +#noteRead { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + display: none; + z-index: 100; + background-color: #fff; +} +#noteReadContainer { + position: relative; + width: 100%; + height: 100%; +} +#noteReadTop { + position: absolute; + height: 60px; + left: 0; + right: 0; + border-bottom: 1px solid #ebeff2; +} +#noteReadTitle { + margin: 3px 0; +} +#noteReadContent { + position: absolute; + top: 60px; + bottom: 0; + right: 0; + left: 0; + overflow: auto; + padding: 3px; +} +/* +::-webkit-scrollbar { + width: 5px; + height: 8px; + background-color: @sbc; +} +::-webkit-scrollbar-thumb { + background-color: @sbc; + border:1px solid #dadada; + border-radius: 5px; +} +::-webkit-scrollbar-thumb:hover { + background-color:#dadada +} +::-webkit-scrollbar-thumb:active { + background-color:#606060 +} +::-webkit-scrollbar-thumb:disabled { + background-color:#f9f9f9 +} +::-webkit-scrollbar-corner { + background-color:#f0f0f0 +} +::-webkit-scrollbar-button { + height: 0; + background-color:#f0f0f0; + background-repeat:no-repeat +} +::-webkit-scrollbar-button:vertical { + height:0px +} +::-webkit-scrollbar-button:horizontal { + width:33px +} +::-webkit-scrollbar-button:horizontal:increment { + background-position:0 -444px +} +::-webkit-scrollbar-button:horizontal:decrement { + background-position:12px -425px +} +::-webkit-scrollbar-button:vertical:increment { + background-position:-1px -391px +} +::-webkit-scrollbar-button:vertical:decrement { + background-position:-1px -358px +} +::-webkit-scrollbar-button:hover { + background-color:#dadada +} +::-webkit-scrollbar-button:horizontal:increment:hover { + background-position:0 -548px +} +::-webkit-scrollbar-button:horizontal:decrement:hover { + background-position:12px -529px +} +::-webkit-scrollbar-button:vertical:increment:hover { + background-position:-1px -495px +} +::-webkit-scrollbar-button:vertical:decrement:hover { + background-position:-1px -462px +} +::-webkit-scrollbar-button:active { + background-color:#606060 +} +::-webkit-scrollbar-button:horizontal:increment:active { + background-position:0 -652px +} +::-webkit-scrollbar-button:horizontal:decrement:active { +background-position:12px -633px +} +::-webkit-scrollbar-button:vertical:increment:active { +background-position:-1px -599px +} +::-webkit-scrollbar-button:vertical:decrement:active { +background-position:-1px -566px +} +::-webkit-scrollbar-button:disabled { +background-color:#f9f9f9 +} +::-webkit-scrollbar-button:horizontal:increment:disabled { +background-position:0 -756px +} +::-webkit-scrollbar-button:horizontal:decrement:disabled { +background-position:12px -737px +} +::-webkit-scrollbar-button:vertical:increment:disabled { +background-position:-1px -703px +} +::-webkit-scrollbar-button:vertical:decrement:disabled { +background-position:-1px -670px +} + +*/ +.fa-calendar { + color: #666; +} +.dropdown-menu .fa { + width: 15px; +} +.dropdown-menu span, +.dropdown-menu a, +.dropdown-menu li { + cursor: default; +} +#topNav a { + display: inline-block; + line-height: 60px; +} +.tab-pane { + padding: 5px 0 0 0; +} +#notebookNavForNewNote li, +#notebookNavForNewSharedNote > li { + padding-left: 0; + border-bottom: 1px solid #ebeff2; +} +#notebookNavForNewNote > li:hover, +#notebookNavForNewNote > li:focus, +#notebookNavForNewSharedNote > li:hover, +#notebookNavForNewSharedNote > li:focus { + background: none; +} +.new-note-left { + padding: 0 5px; + width: 95px; + overflow: hidden; + white-space: nowrap; + border-right: 1px dashed #ebeff2; +} +.new-note-left:hover { + background-color: #ebeff2; +} +.new-note-right:hover { + background-color: #ebeff2; +} +#historyList table { + width: 100%; +} +#historyList .btns { + border-top: 1px dashed #eee; + padding: 5px 0; +} +#loading { + display: inline-block; + width: 20px; + height: 20px; + content: url(../../images/loading-a-20-black.gif); + vertical-align: middle; + visibility: hidden; +} +#toggleEditorMode { + margin: 0 10px !important; +} +#notebookList { + border-top: 1px dashed #eee; +} diff --git a/src/public/css/theme/basic.less b/src/public/css/theme/basic.less index ba4d2b96..857acd45 100644 --- a/src/public/css/theme/basic.less +++ b/src/public/css/theme/basic.less @@ -1770,5 +1770,24 @@ img::selection { color: #ffffff; } +// dialog loading +#loadingDialog { + .modal-dialog { + width: 200px !important; + position: absolute; + top: 50%; + margin-top: -100px; + left: 50%; + margin-left: -100px; + } + .modal-body { + text-align: center; + border-radius: 5px; + } + #loadingDialogBodyMsg { + font-size: 16px; + } +} + @import '../traffic.less'; @import '../ani.less'; diff --git a/src/public/css/theme/simple.css b/src/public/css/theme/simple.css index 2395ac80..92e492eb 100644 --- a/src/public/css/theme/simple.css +++ b/src/public/css/theme/simple.css @@ -1564,6 +1564,21 @@ img::selection { background: transparent; color: #ffffff; } +#loadingDialog .modal-dialog { + width: 200px !important; + position: absolute; + top: 50%; + margin-top: -100px; + left: 50%; + margin-left: -100px; +} +#loadingDialog .modal-body { + text-align: center; + border-radius: 5px; +} +#loadingDialog #loadingDialogBodyMsg { + font-size: 16px; +} .win-tool { padding: 5px; position: absolute; diff --git a/src/public/js/app/note.js b/src/public/js/app/note.js index b07b60c5..40c36c8d 100644 --- a/src/public/js/app/note.js +++ b/src/public/js/app/note.js @@ -1391,8 +1391,75 @@ Note.deleteNote = function(target, contextmenuItem, isShared) { showMsg("删除失败!", 2000); } }); - -} +}; + +// 导出pdf +Note._initExportPdf = false; +Note.exportPdf = function(target, contextmenuItem, isShared) { + var noteId = $(target).attr("noteId"); + if(!noteId) { + return; + } + + var note = Note.getNote(noteId); + var name = note.Title ? note.Title + '.pdf' : 'Untitled.pdf'; + + window.downloadPdfPath = false; + if(!Note._initExportPdf) { + // 下载pdf输入框 + $('#exportPdf').change(function() { + var name = $(this).val(); + $(this).val(''); // 为防止重名不触发 + console.log(window.downloadPdfPath); + if(window.downloadPdfPath) { + FileService.download(window.downloadPdfPath, name, function(ok, msg) { + // console.log(ok + ' -=-'); + if(ok) { + new window.Notification('Info', { + body: 'PDF saved successful!' + }); + } else { + new window.Notification('Warning', { + body: msg || 'PDF saved failure!' + }); + } + }); + } + }); + } + + Note._initExportPdf = true; + + + Loading.show(); + + // 保存 + NoteService.exportPdf(noteId, function(curPath, filename, msg) { + Loading.hide(); + + setTimeout(function() { + if(curPath) { + window.downloadPdfPath = curPath; + $('#exportPdf').attr('nwsaveas', name); + $('#exportPdf').click(); + } else { + var m = ""; + if(msg == "noteNotExists") { + m = "Please sync your note to ther server firslty." + } + + // alert会死? + // alert('File not exists'); + // https://github.com/nwjs/nw.js/wiki/Notification + var notification = new window.Notification('Warning', { + body: 'Export PDF error! ' + m + // icon: appIcon + }); + } + }, 100); + }); +}; + // 显示共享信息 Note.listNoteShareUserInfo = function(target) { @@ -1477,13 +1544,6 @@ Note.listNoteContentHistories = function() { } }); }); -} - -// 导出成PDF -Note.exportPDF = function(target) { - var noteId = $(target).attr("noteId"); - ajaxGet("/note/exportPdf", {noteId: noteId}, function(ret) { - }); }; //-------------- @@ -2241,17 +2301,18 @@ Note.initContextmenu = function() { }); var exportsSubMenus = new gui.Menu(); this.exportHtml = new gui.MenuItem({ - label: "Html", + label: "HTML", click: function(e) { } }); this.exportPdf = new gui.MenuItem({ - label: "Pdf", - enabled: false, + label: "PDF", + enabled: true, click: function(e) { + Note.exportPdf(self.target); } }); - exportsSubMenus.append(this.exportHtml); + // exportsSubMenus.append(this.exportHtml); exportsSubMenus.append(this.exportPdf); this.exports.submenu = exportsSubMenus; @@ -2263,7 +2324,7 @@ Note.initContextmenu = function() { this.menu.append(this.del); this.menu.append(this.move); this.menu.append(this.copy); - // this.menu.append(this.exports); + this.menu.append(this.exports); // this.menu.append(ms[0]); // this.menu.append(ms[1]); diff --git a/src/public/js/common.js b/src/public/js/common.js index a0e3cb9b..793acb40 100644 --- a/src/public/js/common.js +++ b/src/public/js/common.js @@ -1473,5 +1473,16 @@ var trimTitle = function(title) { return title.replace(//g, ">"); }; +var Loading = { + show: function(msg) { + msg || (msg = "loading..."); + $('#loadingDialogBodyMsg').html(msg); + $('#loadingDialog').modal({backdrop: 'static', keyboard: false}); + }, + hide: function() { + $('#loadingDialog').modal('hide'); + } +}; + ContextTips.init(); diff --git a/src/test2.js b/src/test2.js index 5c8eb99c..251bf93a 100755 --- a/src/test2.js +++ b/src/test2.js @@ -40,4 +40,7 @@ var scanFolder = function (path) { }; // scanFolder('/Users/life/Documents/kuaipan/leanote/desktop-app/src/data/1.1'); -console.log(process.platform.toLowerCase().indexOf('window')); \ No newline at end of file +// console.log(process.platform.toLowerCase().indexOf('window')); + +var s = fs.existsSync('/Users/life/Library/Application Support/leanote/data/5368c1aa99c37b029d000001/images/1428148081216_2.pdf'); +console.log(s); \ No newline at end of file