Bläddra i källkod

1.add editor front
2.fix change image name error
3.change short cut

zhuzhuyule 7 år sedan
förälder
incheckning
bcafa169e7

BIN
views/fonts/Merriweather/Merriweather-Black.ttf


BIN
views/fonts/Merriweather/Merriweather-BlackItalic.ttf


BIN
views/fonts/Merriweather/Merriweather-Bold.ttf


BIN
views/fonts/Merriweather/Merriweather-BoldItalic.ttf


BIN
views/fonts/Merriweather/Merriweather-Italic.ttf


BIN
views/fonts/Merriweather/Merriweather-Light.ttf


BIN
views/fonts/Merriweather/Merriweather-LightItalic.ttf


BIN
views/fonts/Merriweather/Merriweather-Regular.ttf


BIN
views/fonts/SourceCodePro/SourceCodePro-It.otf


BIN
views/fonts/SourceCodePro/SourceCodePro-Regular.otf


BIN
views/fonts/SourceCodePro/SourceCodePro-Semibold.otf


BIN
views/fonts/SourceCodePro/SourceCodePro-SemiboldIt.otf


BIN
views/fonts/SourceCodePro/SourceSansPro-It.ttf


BIN
views/fonts/SourceCodePro/SourceSansPro-Light.ttf


BIN
views/fonts/SourceCodePro/SourceSansPro-LightIt.ttf


BIN
views/fonts/SourceCodePro/SourceSansPro-Regular.ttf


BIN
views/fonts/SourceCodePro/SourceSansPro-Semibold.ttf


BIN
views/fonts/SourceCodePro/SourceSansPro-SemiboldIt.ttf


+ 85 - 0
views/fonts/moe-fonts.css

@@ -21,3 +21,88 @@
     font-family: 'Raleway';
     src: url(Raleway-ExtraLight.ttf) format('truetype');
 }
+
+
+@font-face {
+    font-family: 'source-sans-pro';
+    font-style: normal;
+    font-weight: normal;
+    src: local('source-sans-pro'), local('SourceSansPro-Regular'), url('./SourceCodePro/SourceSansPro-Regular.ttf');
+}
+@font-face {
+    font-family: 'source-sans-pro';
+    font-style: italic;
+    font-weight: normal;
+    src: local('source-sans-pro'), local('SourceSansPro-It'), url('./SourceCodePro/SourceSansPro-It.ttf')
+}
+
+@font-face {
+    font-family: 'source-sans-pro';
+    font-style: normal;
+    font-weight: bold;
+    src: local('source-sans-pro'), local('SourceSansPro-Semibold'), url('./SourceCodePro/SourceSansPro-Semibold.ttf')
+}
+
+@font-face {
+    font-family: 'source-sans-pro';
+    font-style: italic;
+    font-weight: bold;
+    src: local('source-sans-pro'), local('SourceSansPro-SemiboldIt'), url('./SourceCodePro/SourceSansPro-SemiboldIt.ttf')
+}
+
+/* Monospace font */
+@font-face {
+    font-family: 'source-code-pro';
+    font-style: normal;
+    font-weight: normal;
+    src: local('source-code-pro'), local('SourceCodePro-Regular'), url('./SourceCodePro/SourceCodePro-Regular.otf');
+}
+@font-face {
+    font-family: 'source-code-pro';
+    font-style: italic;
+    font-weight: normal;
+    src: local('source-code-pro'), local('SourceCodePro-It'), url('./SourceCodePro/SourceCodePro-It.otf')
+}
+
+@font-face {
+    font-family: 'source-code-pro';
+    font-style: normal;
+    font-weight: bold;
+    src: local('source-code-pro'), local('SourceCodePro-Semibold'), url('./SourceCodePro/SourceCodePro-Semibold.otf')
+}
+
+@font-face {
+    font-family: 'source-code-pro';
+    font-style: italic;
+    font-weight: bold;
+    src: local('source-code-pro'), local('SourceCodePro-SemiboldIt'), url('./SourceCodePro/SourceCodePro-SemiboldIt.otf')
+}
+
+
+@font-face {
+    font-family: 'Merriweather';
+    font-style: normal;
+    font-weight: normal;
+    src: local('Merriweather Light'),url('./Merriweather/Merriweather-Light.ttf') format('truetype')
+}
+
+@font-face {
+    font-family: 'Merriweather';
+    font-style: italic;
+    font-weight: normal;
+    src: local('Merriweather Light Italic'),url('./Merriweather/Merriweather-LightItalic.ttf') format('truetype')
+}
+
+@font-face {
+    font-family: 'Merriweather';
+    font-style: normal;
+    font-weight: bold;
+    src: local('Merriweather Regular'),url('./Merriweather/Merriweather-Regular.ttf') format('truetype')
+}
+
+@font-face {
+    font-family: 'Merriweather';
+    font-style: italic;
+    font-weight: bold;
+    src: local('Merriweather Italic'),url('./Merriweather/Merriweather-Italic.ttf') format('truetype')
+}

+ 2 - 2
views/main/CodeMirror/editor.js

@@ -39,8 +39,8 @@ module.exports = (() => {
         'Ctrl-U': drawLink,
         'Ctrl-Alt-U': drawImageLink,
         'Ctrl-T': drawTable,
-        'Ctrl-V': pasteContent,
-        'Ctrl-Shift-V': pasteOriginContent,
+        'Ctrl-V': pasteOriginContent,
+        'Ctrl-Shift-V': pasteContent,
         'Alt-F': formatTables
     }
 

+ 3 - 2
views/main/hexo-image.js

@@ -204,8 +204,9 @@ class ImgManager {
         this.updateDictionary(imgName + '\\b', newImgName)
     }
 
-    renameDirPath(fileName) {
-        this.updateDictionary('/' + this.postName + '/', '/' + fileName + '/')
+    renameDirPath(fileName,notUpdateCache) {
+        if (!notUpdateCache)
+            this.updateDictionary('/' + this.postName + '/', '/' + fileName + '/')
         this.imgPathDir = path.resolve(this.imgPathDir,'..', fileName);
         this.postName = fileName;
     }

+ 1 - 1
views/main/moe-popmessage.js

@@ -77,7 +77,7 @@ document.addEventListener('DOMContentLoaded', () => {
         // TODO-ly 解决第一次图片保存地址不对的问题
         let fileName = path.basename(hexoWindow.fileName, path.extname(hexoWindow.fileName));
         if(fileName !== imgManager.postName){
-            imgManager.renameDirPath(fileName);
+            imgManager.renameDirPath(fileName,true);
         }
 
         document.querySelector('#editor textarea').innerText = hexoWindow.content;

+ 31 - 18
views/main/moe-style.css

@@ -23,6 +23,35 @@
     --spaceY: 30px;
 }
 
+html[lang="zh_CN"] body[settings-editor-font="default"] {
+    --body-font: 'Roboto Mono', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Liberation Mono', 'Dejavu Mans Mono', monospace, 'Noto Sans CJK SC', 'Source Han Sans SC', 'Microsoft Yahei';
+}
+
+body[settings-editor-font="default"] {
+    --body-font: '';
+}
+
+body[settings-editor-font="monospace"] {
+    --body-font: monospace;
+}
+
+body[settings-editor-font="serif"] {
+    --body-font: serif;
+}
+
+body[settings-editor-font="sans"] {
+    --body-font: sans-serif;
+}
+
+body[settings-editor-font="SansPro"] {
+    --body-font: 'source-sans-pro';
+}
+
+body[settings-editor-font="Merriweather"] {
+    --body-font: 'Merriweather';
+}
+
+
 .notransition, .notransition *:not(.transition):not(.CodeMirror-cursors):not(.CodeMirror-lines):not(.CodeMirror-sizer):not(.CodeMirror-vscrollbar) {
     transition: none !important;
 }
@@ -309,24 +338,8 @@ body{
     transition: all 500ms ease-in-out;
 }*/
 
-body[settings-editor-font="default"] #editor * {
-    font-family: 'Roboto Mono', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Liberation Mono', 'Dejavu Mans Mono', monospace !important;
-}
-
-html[lang="zh_CN"] body[settings-editor-font="default"] #editor * {
-    font-family: 'Roboto Mono', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Liberation Mono', 'Dejavu Mans Mono', monospace, 'Noto Sans CJK SC', 'Source Han Sans SC', 'Microsoft Yahei' !important;
-}
-
-body[settings-editor-font="monospace"] #editor * {
-    font-family: monospace !important;
-}
-
-body[settings-editor-font="serif"] #editor  * {
-    font-family: serif !important;
-}
-
-body[settings-editor-font="sans"] #editor  * {
-    font-family: sans-serif !important;
+body #editor * {
+    font-family: var(--body-font),'Roboto Mono', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Liberation Mono', 'Dejavu Mans Mono', monospace !important;
 }
 
 #preview {

+ 2 - 0
views/settings/settings.html

@@ -124,6 +124,8 @@
                                         <option value="monospace">Monospace</option>
                                         <option value="serif">Serif</option>
                                         <option value="sans">Sans</option>
+                                        <option value="SansPro">SansPro</option>
+                                        <option value="Merriweather">Merriweather</option>
                                     </select>
                                 </td>
                             </tr>