@@ -298,11 +324,13 @@ function log(o) {
+
loading...
+
The notebook is empty, why not...
diff --git a/package.json b/package.json
index d589a59a..9629f248 100755
--- a/package.json
+++ b/package.json
@@ -2,19 +2,18 @@
"name": "Leanote",
"description": "Leanote",
"version": "0.1",
- "main": "index.html",
+ "main": "note.html",
"window": {
"toolbar": true,
- "frame": true,
- "transparent": false,
+ "frame": false,
+ "transparent": true,
"min_width": 400,
"min_height": 200,
// "width": 400, // 1100,
// "height": 300 // 600
- "width": 1100,
- "height": 600
+ "width": 400,
+ "height": 300
}
-}
-
+}
\ No newline at end of file
diff --git a/public/css/ani.less b/public/css/ani.less
new file mode 100644
index 00000000..4b22f66e
--- /dev/null
+++ b/public/css/ani.less
@@ -0,0 +1,26 @@
+@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%;
+ img {
+ width: 100px;
+ padding: 20px;
+ }
+ &.loading {
+ animation: rond 2s infinite;
+ -webkit-animation: rond 2s infinite;
+ }
+}
\ No newline at end of file
diff --git a/public/css/css/presentation.css b/public/css/css/presentation.css
new file mode 100644
index 00000000..fa3d4834
--- /dev/null
+++ b/public/css/css/presentation.css
@@ -0,0 +1,3 @@
+/**
+ * 演示
+ */
diff --git a/public/css/index.css b/public/css/index.css
index 6e7e1cc1..14a4e89d 100644
--- a/public/css/index.css
+++ b/public/css/index.css
@@ -1,3 +1,35 @@
+@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;
+}
@font-face {
font-family: 'Open Sans';
font-style: normal;
@@ -295,12 +327,9 @@ input,
#box h1 {
margin: auto;
margin-bottom: 30px;
- width: 316px;
+ width: 248px;
color: #eee;
}
-#logo {
- text-align: center;
-}
#boxHeader {
border-color: #e8e8e8;
color: #333;
@@ -313,7 +342,7 @@ input,
font-size: 16px;
}
#boxForm {
- width: 316px;
+ width: 248px;
margin: auto;
border-radius: 2px;
width: 200px;
@@ -335,7 +364,7 @@ input,
color: #eee;
}
#quickLinks {
- width: 316px;
+ width: 248px;
margin: auto;
text-align: right;
}
@@ -466,7 +495,7 @@ input,
margin-left: 10px;
}
#errorBox {
- width: 316px;
+ width: 248px;
margin: auto;
padding: 20px 30px;
padding-bottom: 30px;
@@ -694,15 +723,6 @@ body #container {
-webkit-user-select: none;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
}
-#box h1 {
- width: 248px;
-}
-#box h1 img {
- width: 100px;
- border: 1px solid #4092C5;
- border-radius: 50%;
- padding: 20px;
-}
.win-tool {
padding: 5px;
position: absolute;
diff --git a/public/css/index.less b/public/css/index.less
index c8b8a8b6..91a97387 100644
--- a/public/css/index.less
+++ b/public/css/index.less
@@ -13,6 +13,8 @@
@containerWidth: 945px;
@titleColor: #5AD4A0;
+@import "ani.less";
+
// font
@font-face {
font-family: 'Open Sans';
@@ -330,12 +332,11 @@ input, .form-control {
//-------------
-@boxWidth: 316px;
+@boxWidth: 248px;
#box {
margin: 0;
color: #000;
padding-top: 40px;
-
h1 {
width: @boxWidth;;
margin: auto;
@@ -344,9 +345,9 @@ input, .form-control {
color: #eee;
}
}
-#logo {
- text-align: center;
-}
+
+
+
#boxHeader {
border-color: #e8e8e8;
color: #333;
@@ -800,14 +801,7 @@ body {
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
}
}
-#box h1 {
- width: 248px;
- img {
- width: 100px;
- border: 1px solid #4092C5;
- border-radius: 50%;
- padding: 20px;
- }
-}
+
@import "traffic.less";
+
diff --git a/public/css/theme/basic.less b/public/css/theme/basic.less
index 2ada338b..1cd1ded2 100644
--- a/public/css/theme/basic.less
+++ b/public/css/theme/basic.less
@@ -1575,8 +1575,7 @@ html,body, #page, #pageInner {
background-color: #fff;
}
body {
- display: none;
-// #notesAndSort {
+ // display: none;
-webkit-user-select: none; // input, textarea还是可以选择的
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1587,6 +1586,23 @@ body {
// box-shadow: 0 0 50px #eee;
// box-shadow: 0px 0px 5px #666;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
+ &.no-drag {
+ -webkit-app-region: no-drag;
+ }
+ // 刚开始载入时, 只有loading
+ &.init {
+ #winTool {
+ display: none;
+ }
+ // border: none;
+ // box-shadow: none;
+ #allProcess, #syncProcess, .loading-footer {
+ display: none;
+ }
+ #pageInner {
+ display: none;
+ }
+ }
}
#page {
#pageInner {
@@ -1631,4 +1647,41 @@ body {
-webkit-app-region: no-drag;
}
+#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;
+ table, td {
+ width: 100%;
+ height: 100%;
+ border: none;
+ vertical-align: middle;
+ }
+ #syncProcess {
+ margin-top: 20px;
+ }
+ .loading-footer {
+ text-align: center;
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 10px;
+ a {
+ color: #ccc;
+ }
+ }
+}
+
+#presentation {
+ display: none;
+}
+
+
@import '../traffic.less';
+@import '../ani.less';
diff --git a/public/css/theme/default.css b/public/css/theme/default.css
index 68426708..70333051 100644
--- a/public/css/theme/default.css
+++ b/public/css/theme/default.css
@@ -1428,7 +1428,6 @@ body,
background-color: #fff;
}
body {
- display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
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;
+}
#leftNotebook {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-webkit-app-region: no-drag;
}
+#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;
+}
.win-tool {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.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;
+}
::selection {
background: #000000;
color: #ffffff;
diff --git a/public/css/theme/presentation.css b/public/css/theme/presentation.css
new file mode 100644
index 00000000..1671f62e
--- /dev/null
+++ b/public/css/theme/presentation.css
@@ -0,0 +1,111 @@
+/**
+ * 演示
+ */
+body {
+ box-shadow: none;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ border-radius: 0;
+ border: none;
+}
+#mainMask,
+#winTool,
+.navbar.navbar-default {
+ display: none;
+}
+#presentation {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ top: 0;
+ background-color: #fff;
+ display: block;
+ -webkit-user-select: text;
+ overflow-y: scroll;
+}
+.pren-title {
+ font-size: 32px;
+ margin: 100px 0;
+ text-align: center;
+ padding: 0 150px;
+}
+.pren-content {
+ padding: 0 150px;
+}
+.pren-content * {
+ font-size: 18px;
+ line-height: 1.2;
+}
+.pren-content p {
+ margin: 10px 0;
+}
+.pren-content h1 {
+ font-size: 30px;
+}
+.pren-content h2 {
+ font-size: 24px;
+}
+.pren-content h3 {
+ font-size: 18px;
+}
+.pren-content h4 {
+ font-size: 14px;
+}
+/*
+ body.init #pageInner {
+ display: block;
+ }
+ #noteAndEditor {
+ left: 0 !important;
+ }
+ #note {
+ left: 0 !important;
+ // left: 100px !important;
+ // right: 100px !important;
+
+ // padding: 0 100px;
+
+ #tool {
+ border: none;
+ }
+ #noteTitleDiv {
+ right: 0;
+ margin: 20px 0;
+ }
+ #noteTitle {
+ text-align: center;
+ font-size: 24px;
+ }
+
+ * {
+ font-size: 18px;
+ }
+ h1 {
+ font-size: 30px;
+ }
+ h2 {
+ font-size: 24px;
+ }
+ h3 {
+ font-size: 18px;
+ }
+ h4 {
+ font-size: 14px;
+ }
+ }
+
+ #editor, #mdEditor {
+ bottom: 0;
+ top: 100px !important;
+ }
+
+#mdEditor .layout-wrapper-l3, #editorContent {
+ top: 0 !important;
+}
+
+#editorContent {
+ padding: 0 100px;
+}
+*/
diff --git a/public/css/theme/presentation.less b/public/css/theme/presentation.less
new file mode 100644
index 00000000..c84b8a73
--- /dev/null
+++ b/public/css/theme/presentation.less
@@ -0,0 +1,117 @@
+/**
+ * 演示
+ */
+body {
+ box-shadow: none;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ border-radius: 0;
+ border: none;
+}
+
+#mainMask,
+#winTool,
+.navbar.navbar-default
+{
+ display: none;
+}
+
+#presentation {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ top: 0;
+ background-color: #fff;
+ // display: none;
+ display: block;
+ -webkit-user-select: text;
+ overflow-y: scroll;
+}
+.pren-title {
+ font-size: 32px;
+ margin: 100px 0;
+ // margin-top: 100px;
+ text-align: center;
+ padding: 0 150px;
+}
+.pren-content {
+ padding: 0 150px;
+ * {
+ font-size: 18px;
+ line-height: 1.2;
+ }
+ p {
+ margin: 10px 0;
+ }
+ h1 {
+ font-size: 30px;
+ }
+ h2 {
+ font-size: 24px;
+ }
+ h3 {
+ font-size: 18px;
+ }
+ h4 {
+ font-size: 14px;
+ }
+}
+
+ /*
+ body.init #pageInner {
+ display: block;
+ }
+ #noteAndEditor {
+ left: 0 !important;
+ }
+ #note {
+ left: 0 !important;
+ // left: 100px !important;
+ // right: 100px !important;
+
+ // padding: 0 100px;
+
+ #tool {
+ border: none;
+ }
+ #noteTitleDiv {
+ right: 0;
+ margin: 20px 0;
+ }
+ #noteTitle {
+ text-align: center;
+ font-size: 24px;
+ }
+
+ * {
+ font-size: 18px;
+ }
+ h1 {
+ font-size: 30px;
+ }
+ h2 {
+ font-size: 24px;
+ }
+ h3 {
+ font-size: 18px;
+ }
+ h4 {
+ font-size: 14px;
+ }
+ }
+
+ #editor, #mdEditor {
+ bottom: 0;
+ top: 100px !important;
+ }
+
+#mdEditor .layout-wrapper-l3, #editorContent {
+ top: 0 !important;
+}
+
+#editorContent {
+ padding: 0 100px;
+}
+*/
diff --git a/public/css/theme/simple.css b/public/css/theme/simple.css
index 53499712..9f9d64ba 100644
--- a/public/css/theme/simple.css
+++ b/public/css/theme/simple.css
@@ -1428,7 +1428,6 @@ body,
background-color: #fff;
}
body {
- display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
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;
+}
#leftNotebook {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-webkit-app-region: no-drag;
}
+#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;
+}
.win-tool {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.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;
+}
::selection {
background: #000000;
color: #ffffff;
@@ -1665,17 +1744,6 @@ a.raw:hover {
background-color: #ebeff2;
}
/*********************/
-#mainMask {
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- top: 0;
- background-color: #fff;
- text-align: center;
- padding-top: 100px;
- z-index: 1000;
-}
#notebookSplitter {
left: 170px;
}
diff --git a/public/css/theme/simple.less b/public/css/theme/simple.less
index f68285ff..30464a51 100644
--- a/public/css/theme/simple.less
+++ b/public/css/theme/simple.less
@@ -169,17 +169,7 @@ a.raw:hover {
/*********************/
-#mainMask {
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- top: 0;
- background-color: #fff;
- text-align: center;
- padding-top: 100px;
- z-index: 1000;
-}
+
#notebookSplitter {
left: @leftNotebookWidth;
diff --git a/public/css/theme/writting-overwrite.css b/public/css/theme/writting-overwrite.css
index 55759420..c344fa10 100644
--- a/public/css/theme/writting-overwrite.css
+++ b/public/css/theme/writting-overwrite.css
@@ -1428,7 +1428,6 @@ body,
background-color: #fff;
}
body {
- display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
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;
+}
#leftNotebook {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-webkit-app-region: no-drag;
}
+#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;
+}
.win-tool {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.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;
+}
@font-face {
font-family: 'Open Sans';
font-style: normal;
diff --git a/public/css/theme/writting.css b/public/css/theme/writting.css
index 83b1b1fa..5aeb4d70 100644
--- a/public/css/theme/writting.css
+++ b/public/css/theme/writting.css
@@ -1428,7 +1428,6 @@ body,
background-color: #fff;
}
body {
- display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
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;
+}
#leftNotebook {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-webkit-app-region: no-drag;
}
+#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;
+}
.win-tool {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.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;
+}
@font-face {
font-family: 'Open Sans';
font-style: normal;
diff --git a/public/js/app/note.js b/public/js/app/note.js
index b722d909..7029c21f 100644
--- a/public/js/app/note.js
+++ b/public/js/app/note.js
@@ -1155,9 +1155,9 @@ Note.fixNetOrAuthError = function() {
// 同步进度显示
Note.syncProcess = function(msg) {
- $('body').show();
$('#allProcess').hide();
- $('#syncProcess').html(msg);
+ $('#syncProcess').show().html(msg);
+ $('.loading-footer').show();
};
// 保存note ctrl + s
@@ -1726,6 +1726,14 @@ Note.selectStar = function(noteId) {
Note.renderStarNote = function(target) {
var me = this;
var noteId = target.data('id');
+ // 如果没有target, 则选第一个
+ if(!noteId) {
+ target = me.starNotesO.find('li').eq(0);
+ }
+ var noteId = target.data('id');
+ if(!noteId) {
+ return;
+ }
me.starNotesO.find('li').removeClass('selected');
target.addClass('selected');
diff --git a/public/js/app/notebook.js b/public/js/app/notebook.js
index 6a2bbe0b..57682347 100644
--- a/public/js/app/notebook.js
+++ b/public/js/app/notebook.js
@@ -640,10 +640,16 @@ Notebook.curActiveNotebookIsAll = function() {
Notebook.changeNotebookSeq = 1;
Notebook.changeNotebook = function(notebookId, callback, needRendNoteId) {
var me = this;
+
+ // 如果找不到
+ if(!Notebook.cache[notebookId]) {
+ return;
+ }
+
Notebook.changeNotebookNav(notebookId);
Notebook.curNotebookId = notebookId;
-
+
// 1
Note.curChangedSaveIt();
@@ -673,6 +679,9 @@ Notebook.changeNotebook = function(notebookId, callback, needRendNoteId) {
} else {
cacheNotes = Note.getNotesByNotebookId(notebookId);
var notebook = Notebook.cache[notebookId];
+ if(!notebook) {
+ return;
+ }
var len = cacheNotes ? cacheNotes.length : 0;
// 如果为0, 从服务器上拿
diff --git a/public/js/app/page.js b/public/js/app/page.js
index ada98fa4..e864fa4f 100644
--- a/public/js/app/page.js
+++ b/public/js/app/page.js
@@ -531,7 +531,7 @@ function initEditor() {
// 刷新时保存 参考autosave插件
window.onbeforeunload = function(e) {
Note.curChangedSaveIt();
- }
+ };
// 全局ctrl + s
$("body").on('keydown', Note.saveNote);
@@ -942,6 +942,8 @@ LeaAce = {
tinymce.activeEditor.undoManager.setCanAdd(true);
},
canAce: function() {
+ return true;
+ /*
if(this._isInit) {
return this._canAce;
}
@@ -952,6 +954,7 @@ LeaAce = {
}
this._isInit = true;
return this._canAce;
+ */
},
canAndIsAce: function() {
return this.canAce() && this.isAce;
@@ -1361,13 +1364,32 @@ var State = {
CurTag: CurTag,
CurSearchKey: CurSearchKey
};
- console.log(state);
+ // console.log(state);
UserService.saveCurState(state, callback);
},
+ recoverAfter: function() {
+ // 先隐藏, 再resize, 再显示
+ $('body').hide();
+ win.resizeTo(1100, 600);
+ win.setPosition('center');
+ setTimeout(function() {
+ $('body').show();
+ $('body').removeClass('init');
+ $("#mainMask").html("");
+ $("#mainMask").hide(0);
+ }, 100);
+ // $('body').show();
+ },
+
// 恢复状态
- recoverState: function(state) {
- console.log(state);
+ recoverState: function(userInfo) {
+ var state = userInfo.State || {};
+ // 表明没有state
+ if(state.NotebookOpened === undefined) {
+ this.recoverAfter();
+ return;
+ }
// 1. 左侧哪个open
if(!state.NotebookOpened) {
$('.folderNote.opened').removeClass('opened').addClass('closed');
@@ -1392,11 +1414,12 @@ var State = {
Note.searchNoteSys(state.CurSearchKey, state.CurNoteId);
}
// 笔记本了
- else {
+ else if(notebookId) {
Notebook.expandNotebookTo(notebookId);
Notebook.changeNotebook(notebookId, false, state.CurNoteId);
}
+ this.recoverAfter();
}
};
@@ -1471,9 +1494,7 @@ function initPage() {
// end
// 开始时显示loading......
// 隐藏mask
- $("#mainMask").html("");
- $("#mainMask").hide(0);
- $('body').show();
+
});
};
@@ -1542,6 +1563,25 @@ function changeTheme(themeName) {
}
}
+var _isPren = false;
+function togglePren() {
+ if(!_isPren) {
+ $('.pren-title').html($('#noteTitle').val());
+ $('.pren-content').html(getEditorContent());
+
+ $('#themePresentation').attr('disabled', false);
+
+ $('body').addClass('no-drag');
+ $('#page').hide();
+ _isPren = true;
+ } else {
+ $('#themePresentation').attr('disabled', true);
+ _isPren = false;
+ $('body').removeClass('no-drag');
+ $('#page').show();
+ }
+}
+
// user
function userMenu() {
//-------------------
@@ -1618,10 +1658,75 @@ function userMenu() {
userMenuSys.popup(e);
});
+ // 全局菜单
+ var isSlide = false;
+ var isFullscreen = false;
+ var slide;
+ function toggleFullscreen() {
+ win.toggleFullscreen();
+ isFullscreen = !isFullscreen;
+ if(isFullscreen) {
+ slide.enabled = false;
+ } else {
+ slide.enabled = true;
+ }
+ }
+ var fullScreen = new gui.MenuItem({ label: 'Toggle Fullscreen', click: toggleFullscreen});
+
+ function toggleSlide() {
+ win.toggleKioskMode();
+ isSlide = !isSlide;
+ togglePren();
+ if(isSlide) {
+ fullScreen.enabled = false;
+ } else {
+ fullScreen.enabled = true;
+ }
+ }
+ slide = new gui.MenuItem({ label: 'Toggle Presentation', click: toggleSlide});
+ $("body").on('keydown', function(e) {
+ if(e.keyCode == 27) {
+ if(isSlide) {
+ toggleSlide();
+ } else if(isFullscreen) {
+ toggleFullscreen();
+ }
+ }
+ });
+ var mode = new gui.Menu();
+ mode.append(slide);
+ var modes = new gui.MenuItem({ label: 'Mode', submenu: mode});
+ mode.append(fullScreen);
+ if(process.platform === "darwin") {
+ var nativeMenuBar = new gui.Menu({ type: "menubar" });
+ nativeMenuBar.createMacBuiltin("Leanote");
+ win.menu = nativeMenuBar;
+ win.menu.append(modes);
+ }
+ // windows
+ else {
+ win.menu.append(modes);
+ }
+
+ win.on('move', function(e) {
+ // e.preventDefault();
+ // return false;
+ });
+
+ // disable drag & drop
+ document.body.addEventListener('dragover', function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ }, false);
+ document.body.addEventListener('drop', function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ }, false);
+
+ // 修改主题
changeTheme(UserInfo.Theme);
}
-
$(function() {
initUploadImage();
userMenu();
diff --git a/public/js/app/service.js b/public/js/app/service.js
index 0f56cb2e..6e8ad447 100644
--- a/public/js/app/service.js
+++ b/public/js/app/service.js
@@ -1,5 +1,9 @@
var Common = require('common');
+// 启动服务器, 图片
+var Server = require('server');
+Server.start();
+
var Evt = require('evt');
var basePath = require('nw.gui').App.dataPath;
Evt.setDataBasePath(basePath);
@@ -59,8 +63,7 @@ function openExternal(url) {
// 窗口大小设置
var win = gui.Window.get();
-win.resizeTo(1100, 600);
-win.setPosition('center');
+
$(function() {
$('.tool-close, .tool-close-blur').click(function() {
win.close();
diff --git a/public/js/common.js b/public/js/common.js
index 11113e27..2e70f77d 100644
--- a/public/js/common.js
+++ b/public/js/common.js
@@ -1383,6 +1383,11 @@ var ContextTips = {
}
};
+function switchAccount() {
+ SyncService.stop();
+ location.href = 'login.html';
+}
+
function commonCmd(e) {
var num = e.which ? e.which : e.keyCode;
// copy, paste