From d927099b2873a56ccb58b66209641a1663fa3293 Mon Sep 17 00:00:00 2001 From: "xiaoqi.cxq" Date: Sun, 4 Dec 2022 21:40:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=A2=84=E8=A7=88=E5=8C=BA?= =?UTF-8?q?=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome-app/manifest.json | 2 +- package-lock.json | 34 +- package.json | 2 +- server/index.js | 14 +- src/components/App.vue | 3 + src/components/EditorInPageButtons.vue | 45 ++- src/components/Layout.vue | 7 +- src/components/Preview.vue | 8 +- src/components/PreviewInPageButtons.vue | 159 ++++++++ src/components/SideBar.vue | 4 + src/components/common/DropdownMenu.vue | 17 +- src/components/menus/MainMenu.vue | 5 + src/components/menus/PreviewThemeMenu.vue | 116 ++++++ src/icons/Copy.vue | 3 + src/icons/Ellipsis.vue | 3 + src/icons/index.js | 4 + src/services/editorSvc.js | 3 +- src/services/exportSvc.js | 6 +- src/store/theme.js | 63 +++ static/themes/preview-theme-activeblue.js | 216 ++++++++++ static/themes/preview-theme-allblue.js | 426 ++++++++++++++++++++ static/themes/preview-theme-caoyuangreen.js | 382 ++++++++++++++++++ static/themes/preview-theme-jikebrack.js | 272 +++++++++++++ static/themes/preview-theme-ningyezi.js | 269 ++++++++++++ static/themes/preview-theme-simplebrack.js | 339 ++++++++++++++++ static/themes/preview-theme-yanqihu.js | 305 ++++++++++++++ 26 files changed, 2660 insertions(+), 47 deletions(-) create mode 100644 src/components/PreviewInPageButtons.vue create mode 100644 src/components/menus/PreviewThemeMenu.vue create mode 100644 src/icons/Copy.vue create mode 100644 src/icons/Ellipsis.vue create mode 100644 static/themes/preview-theme-activeblue.js create mode 100644 static/themes/preview-theme-allblue.js create mode 100644 static/themes/preview-theme-caoyuangreen.js create mode 100644 static/themes/preview-theme-jikebrack.js create mode 100644 static/themes/preview-theme-ningyezi.js create mode 100644 static/themes/preview-theme-simplebrack.js create mode 100644 static/themes/preview-theme-yanqihu.js diff --git a/chrome-app/manifest.json b/chrome-app/manifest.json index 214a316c..afce6eed 100644 --- a/chrome-app/manifest.json +++ b/chrome-app/manifest.json @@ -1,7 +1,7 @@ { "name": "StackEdit中文版", "description": "支持Gitee仓库/粘贴图片自动上传的浏览器内 Markdown 编辑器", - "version": "5.15.16", + "version": "5.15.17", "manifest_version": 2, "container" : "GITEE", "api_console_project_id" : "241271498917", diff --git a/package-lock.json b/package-lock.json index a4f86cce..8aa07282 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "stackedit", - "version": "5.15.16", + "version": "5.15.17", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3988,7 +3988,7 @@ }, "d3-collection": { "version": "1.0.7", - "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.7.tgz", + "resolved": "https://registry.npmmirror.com/d3-collection/-/d3-collection-1.0.7.tgz", "integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==" }, "d3-color": { @@ -4166,7 +4166,7 @@ }, "d3-voronoi": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/d3-voronoi/-/d3-voronoi-1.1.4.tgz", + "resolved": "https://registry.npmmirror.com/d3-voronoi/-/d3-voronoi-1.1.4.tgz", "integrity": "sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg==" }, "d3-zoom": { @@ -4183,7 +4183,7 @@ }, "dagre": { "version": "0.8.5", - "resolved": "https://registry.npmjs.org/dagre/-/dagre-0.8.5.tgz", + "resolved": "https://registry.npmmirror.com/dagre/-/dagre-0.8.5.tgz", "integrity": "sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw==", "requires": { "graphlib": "^2.1.8", @@ -4192,14 +4192,14 @@ "dependencies": { "lodash": { "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" } } }, "dagre-d3": { "version": "0.6.4", - "resolved": "https://registry.npmjs.org/dagre-d3/-/dagre-d3-0.6.4.tgz", + "resolved": "https://registry.npmmirror.com/dagre-d3/-/dagre-d3-0.6.4.tgz", "integrity": "sha512-e/6jXeCP7/ptlAM48clmX4xTZc5Ek6T6kagS7Oz2HrYSdqcLZFLqpAfh7ldbZRFfxCZVyh61NEPR08UQRVxJzQ==", "requires": { "d3": "^5.14", @@ -4210,7 +4210,7 @@ "dependencies": { "lodash": { "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" } } @@ -4746,7 +4746,7 @@ }, "entity-decode": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/entity-decode/-/entity-decode-2.0.2.tgz", + "resolved": "https://registry.npmmirror.com/entity-decode/-/entity-decode-2.0.2.tgz", "integrity": "sha512-5CCY/3ci4MC1m2jlumNjWd7VBFt4VfFnmSqSNmVcXq4gxM3Vmarxtt+SvmBnzwLS669MWdVuXboNVj1qN2esVg==", "requires": { "he": "^1.1.1" @@ -8644,7 +8644,7 @@ }, "graphlib": { "version": "2.1.8", - "resolved": "https://registry.npmjs.org/graphlib/-/graphlib-2.1.8.tgz", + "resolved": "https://registry.npmmirror.com/graphlib/-/graphlib-2.1.8.tgz", "integrity": "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==", "requires": { "lodash": "^4.17.15" @@ -8652,7 +8652,7 @@ "dependencies": { "lodash": { "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" } } @@ -12501,7 +12501,7 @@ }, "minify": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/minify/-/minify-4.1.3.tgz", + "resolved": "https://registry.npmmirror.com/minify/-/minify-4.1.3.tgz", "integrity": "sha512-ykuscavxivSmVpcCzsXmsVTukWYLUUtPhHj0w2ILvHDGqC+hsuTCihBn9+PJBd58JNvWTNg9132J9nrrI2anzA==", "requires": { "clean-css": "^4.1.6", @@ -12515,7 +12515,7 @@ "dependencies": { "commander": { "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, "debug": { @@ -12528,12 +12528,12 @@ }, "he": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "resolved": "https://registry.npmmirror.com/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" }, "html-minifier": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz", + "resolved": "https://registry.npmmirror.com/html-minifier/-/html-minifier-4.0.0.tgz", "integrity": "sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==", "requires": { "camel-case": "^3.0.0", @@ -12547,7 +12547,7 @@ }, "ms": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "uglify-js": { @@ -20413,12 +20413,12 @@ }, "try-catch": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/try-catch/-/try-catch-2.0.1.tgz", + "resolved": "https://registry.npmmirror.com/try-catch/-/try-catch-2.0.1.tgz", "integrity": "sha512-LsOrmObN/2WdM+y2xG+t16vhYrQsnV8wftXIcIOWZhQcBJvKGYuamJGwnU98A7Jxs2oZNkJztXlphEOoA0DWqg==" }, "try-to-catch": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/try-to-catch/-/try-to-catch-1.1.1.tgz", + "resolved": "https://registry.npmmirror.com/try-to-catch/-/try-to-catch-1.1.1.tgz", "integrity": "sha512-ikUlS+/BcImLhNYyIgZcEmq4byc31QpC+46/6Jm5ECWkVFhf8SM2Fp/0pMVXPX6vk45SMCwrP4Taxucne8I0VA==" }, "tryer": { diff --git a/package.json b/package.json index ffac49ba..8eed8149 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stackedit", - "version": "5.15.16", + "version": "5.15.17", "description": "免费, 开源, 功能齐全的 Markdown 编辑器", "author": "Benoit Schweblin, 豆萁", "license": "Apache-2.0", diff --git a/server/index.js b/server/index.js index 33f0cc3f..f04790a2 100644 --- a/server/index.js +++ b/server/index.js @@ -61,21 +61,19 @@ module.exports = (app) => { res.redirect(`./app#providerId=googleDrive&state=${encodeURIComponent(req.query.state)}`)); // Serve the static folder with 30 day max-age app.use('/themes', serveStatic(resolvePath('static/themes'), { - maxAge: '30d', + maxAge: '1d', + })); + + // Serve style.css with 1 day max-age + app.get('/style.css', (req, res) => res.sendFile(resolvePath('dist/style.css'), { + maxAge: '1d', })); - // Serve empty.js - app.get('/empty.js', (req, res) => res.send('')); // Serve static resources if (process.env.NODE_ENV === 'production') { // Serve index.html in /app app.get('/app', (req, res) => res.sendFile(resolvePath('dist/index.html'))); - // Serve style.css with 1 day max-age - app.get('/style.css', (req, res) => res.sendFile(resolvePath('dist/style.css'), { - maxAge: '1d', - })); - // Serve the static folder with 1 year max-age app.use('/static', serveStatic(resolvePath('dist/static'), { maxAge: '1y', diff --git a/src/components/App.vue b/src/components/App.vue index 85799112..3b7795fe 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -91,6 +91,9 @@ export default { // store 编辑主题 const editTheme = localStorage.getItem('theme/currEditTheme'); store.dispatch('theme/setEditTheme', editTheme || 'default'); + // store 预览主题 + const previewTheme = localStorage.getItem('theme/currPreviewTheme'); + store.dispatch('theme/setPreviewTheme', previewTheme || 'default'); this.ready = true; tempFileSvc.setReady(); } catch (err) { diff --git a/src/components/EditorInPageButtons.vue b/src/components/EditorInPageButtons.vue index 0363ef2b..546d6c7b 100644 --- a/src/components/EditorInPageButtons.vue +++ b/src/components/EditorInPageButtons.vue @@ -12,8 +12,8 @@ -
  • - +
  • +
  • @@ -123,10 +123,6 @@ export default { store.dispatch('data/setSideBarPanel', 'editTheme'); } }, - showHelp() { - this.toggleSideBar(true); - store.dispatch('data/setSideBarPanel', 'help'); - }, }, }; @@ -137,20 +133,44 @@ export default { .editor-in-page-buttons { position: absolute; top: 0; - right: 10px; + left: -108px; height: 34px; padding: 5px; - background-color: rgba(187, 187, 187, 0.05); + background-color: rgba(84, 96, 114, 0.4); border-radius: $border-radius-base; + transition: 0.5s; + display: flex; + + .dropdown-menu { + display: none; + + .dropdown-menu-items { + right: unset; + left: 0; + } + } + + &:active, + &:focus, + &:hover { + left: 0; + transition: 0.5s; + background-color: #546072; + + .dropdown-menu { + display: block; + } + } ul { padding: 0; margin-left: 10px; + line-height: 20px; li { - line-height: 16px; width: 16px; display: inline-block; + vertical-align: middle; list-style: none; cursor: pointer; font-size: 14px; @@ -160,7 +180,7 @@ export default { .icon { color: #dea731; - opacity: 0.3; + opacity: 0.7; &:active, &:focus, @@ -168,5 +188,10 @@ export default { opacity: 1; } } + + .after { + margin-left: 0; + margin-right: -6px; + } } diff --git a/src/components/Layout.vue b/src/components/Layout.vue index 6fc826db..5db9eb3b 100644 --- a/src/components/Layout.vue +++ b/src/components/Layout.vue @@ -9,7 +9,7 @@
    -
    +
    @@ -28,6 +28,7 @@
    +
    @@ -60,6 +61,7 @@ import Editor from './Editor'; import Preview from './Preview'; import Tour from './Tour'; import EditorInPageButtons from './EditorInPageButtons'; +import PreviewInPageButtons from './PreviewInPageButtons'; import StickyComment from './gutters/StickyComment'; import CurrentDiscussion from './gutters/CurrentDiscussion'; import FindReplace from './FindReplace'; @@ -78,6 +80,7 @@ export default { Preview, Tour, EditorInPageButtons, + PreviewInPageButtons, StickyComment, CurrentDiscussion, FindReplace, @@ -102,7 +105,7 @@ export default { ...mapGetters('theme', [ 'currEditTheme', ]), - currTheme() { + editTheme() { return `edit-theme--${this.currEditTheme || 'default'}`; }, showFindReplace() { diff --git a/src/components/Preview.vue b/src/components/Preview.vue index a30070a8..c93f357f 100644 --- a/src/components/Preview.vue +++ b/src/components/Preview.vue @@ -1,7 +1,7 @@