From 13bdb2edb7c4ce1bec349d04e75396133045c5eb Mon Sep 17 00:00:00 2001 From: NGPixel Date: Mon, 22 May 2017 13:32:52 -0400 Subject: [PATCH] feat: anchor - copy link to clipboard --- client/js/app.js | 4 ++- client/js/components/anchor.vue | 51 ++++++++++++++++++++++++++---- client/js/store/index.js | 2 ++ client/js/store/modules/anchor.js | 23 ++++++++++++++ package.json | 1 + server/libs/markdown.js | 11 +++++-- server/views/pages/admin/users.pug | 2 +- server/views/pages/view.pug | 3 +- server/views/pages/welcome.pug | 2 -- yarn.lock | 32 +++++++++++++++++++ 10 files changed, 117 insertions(+), 14 deletions(-) create mode 100644 client/js/store/modules/anchor.js diff --git a/client/js/app.js b/client/js/app.js index eff64a1d..67312c47 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -6,6 +6,7 @@ import $ from 'jquery' import Vue from 'vue' import VueResource from 'vue-resource' +import VueClipboards from 'vue-clipboards' import store from './store' import io from 'socket.io-client' import i18next from 'i18next' @@ -36,6 +37,7 @@ import sourceComponent from './pages/source.component.js' // ==================================== Vue.use(VueResource) +Vue.use(VueClipboards) Vue.use(VueI18Next) i18next @@ -91,7 +93,7 @@ $(() => { i18n, el: '#root', mounted() { - $('a').smoothScroll({ speed: 500, offset: -50 }) + $('a:not(.toc-anchor)').smoothScroll({ speed: 500, offset: -50 }) $('#header').sticky({ topSpacing: 0 }) $('.sidebar-pagecontents').sticky({ topSpacing: 15, bottomSpacing: 75 }) } diff --git a/client/js/components/anchor.vue b/client/js/components/anchor.vue index 72250aad..63538719 100644 --- a/client/js/components/anchor.vue +++ b/client/js/components/anchor.vue @@ -1,16 +1,53 @@ -