From a37e9d87cfc55288fe2583861709ad745f4d8419 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sun, 18 Oct 2015 16:46:52 -0400 Subject: [PATCH] Add "Copy to clipboard" icon inside each code block Closes #253. --- assets/images/icons.png | Bin 33649 -> 33826 bytes assets/images/icons@2x.png | Bin 89145 -> 89511 bytes assets/javascripts/lib/util.coffee | 15 ++++++++++ assets/javascripts/news.json | 3 ++ .../views/content/entry_page.coffee | 15 +++++++++- assets/stylesheets/components/_content.scss | 28 ++++++++++++++++++ assets/stylesheets/global/_base.scss | 3 +- assets/stylesheets/global/_icons.scss | 2 ++ public/icons/ui/clipboard-white/16.png | Bin 0 -> 151 bytes public/icons/ui/clipboard-white/16@2x.png | Bin 0 -> 229 bytes public/icons/ui/clipboard-white/SOURCE | 1 + public/icons/ui/clipboard/16.png | Bin 0 -> 151 bytes public/icons/ui/clipboard/16@2x.png | Bin 0 -> 230 bytes public/icons/ui/clipboard/SOURCE | 1 + 14 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 public/icons/ui/clipboard-white/16.png create mode 100644 public/icons/ui/clipboard-white/16@2x.png create mode 100644 public/icons/ui/clipboard-white/SOURCE create mode 100644 public/icons/ui/clipboard/16.png create mode 100644 public/icons/ui/clipboard/16@2x.png create mode 100644 public/icons/ui/clipboard/SOURCE diff --git a/assets/images/icons.png b/assets/images/icons.png index 939c9c0e72af47d2cf342ed1e7eb4b1290e2c93e..4622399ccd7b1b4fd3ad955d9331be241fcb3212 100644 GIT binary patch delta 4035 zcmV;!4?OVkh61990+1vD>9Hkfbbk`4D35GiGntdPL{Z~1=u6ajzR5C4=0)jl5s;lm za0v>E;)sgFrhu#h0n;q9jKmh2MLWKgf@Cj`5Lm`a9>I|Nggbb$j%)ZrxkeRSv*k<2Z8eh0H0lCKh!ntO1#bxM z>I}erT{s%2PYIzvlZ+3hN`KM}D@oMB=;H^lh>IjPP-h;BWKoi4SV^J|)Ya$@EaKi) zl9~1WI}+yXued%GfBpt62(L$?j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T+$| zw(OS|WgE)^&Ng43sDHoH_|ieO>J9gGtF0Fj2jWV}HsrA*5J|B8XymCZzO; zZD4LLp7@~D7lI%LEP$A@f@0UDoQYNYJ%BMWF@RuMCqHb9DKq^NK#@rF97~~jy0^Ds z+2+X@2j_)Z+oR=BV9-GY6T#A})ev_w1=cI&5TZ$f(DLLPAzIaf*=A;Mus%o9dLTg% z1HBIrkH2+W=YQ(z+A#%YNbdt=cl^D1TIPmtwp%8NIAU62UcrdkM(Reyj)EP?q87l2Q+>{h5w72~ld z@DCIL5(F_I0bH?S1t1;I?&8faLaL0XrzdX+mSJ7Tv&9JZ@u&ib(__5i-rjpjs(V~; zHWR>WK1by1KF?41eqGjX__j_1Cv=72xX6hYK^xoo|6);KNQf?ZG)E8wF%SWK@4ffn z^5x6?27gCLNC=-3h}6{70GpNye)!FoA?PEM$*>(7_AwYYLJwnWj8@XA(ifcNfzN)r z`}6U^g-VMp`3X0D(<5M4aWa1zWOGO$Fh8)ASnk#kjpx+>1?xO-S?0{=*j(FrE}jXY<2j)9KY}277r;Zmq5vM^`p+=2Sp3(y z^M7oT)+fr(vkMW#_-|8 zUmY=GM9VKNemEwM&HW5mp5Rkbsnl`#H=BkBl_ri`lc}&>kr??ji~juZtzh(F_2V7Z zdpx%!E|8AJ5d_gc5yWWhmzWOY7&sO$emg&(VVDq&9}bCuPqORsp9O%&%CFabkPGbe k2V=s73H0nGK@k1ozbP(D>;%K el.classList.add(options.className) setTimeout (-> el.classList.remove(options.className)), options.delay return + +$.copyToClipboard = (string) -> + textarea = document.createElement('textarea') + textarea.style.position = 'fixed' + textarea.style.opacity = 0 + textarea.value = string + document.body.appendChild(textarea) + try + textarea.select() + result = !!document.execCommand('copy') + catch + result = false + finally + document.body.removeChild(textarea) + result diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 42944337..c2959755 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2015-10-18", + "Added a \"Copy to clipboard\" button inside each code block." + ], [ "2015-09-13", "New documentation: Phalcon" ], [ diff --git a/assets/javascripts/views/content/entry_page.coffee b/assets/javascripts/views/content/entry_page.coffee index 8c21c16d..957dddd5 100644 --- a/assets/javascripts/views/content/entry_page.coffee +++ b/assets/javascripts/views/content/entry_page.coffee @@ -35,6 +35,14 @@ class app.views.EntryPage extends app.View @hiddenView = new app.views.HiddenPage @el, @entry @trigger 'loaded' + @delay @addClipboardLinks + return + + CLIPBOARD_LINK = '' + + addClipboardLinks: => + for el in @findAllByTag('pre') + el.insertAdjacentHTML('afterbegin', CLIPBOARD_LINK) return LINKS = @@ -118,7 +126,12 @@ class app.views.EntryPage extends app.View true onClick: (event) => - if event.target.hasAttribute 'data-retry' + target = event.target + if target.hasAttribute 'data-retry' $.stopEvent(event) @load() + else if target.classList.contains '_pre-clip' + $.stopEvent(event) + target.classList.add if $.copyToClipboard(target.parentNode.textContent) then '_pre-clip-success' else '_pre-clip-error' + setTimeout (-> target.className = '_pre-clip'), 2000 return diff --git a/assets/stylesheets/components/_content.scss b/assets/stylesheets/components/_content.scss index 48728fc0..7f652cc0 100644 --- a/assets/stylesheets/components/_content.scss +++ b/assets/stylesheets/components/_content.scss @@ -396,6 +396,34 @@ ._label { @extend %label; } ._highlight { background: $highlightBackground !important; } +._pre-clip { + display: none; + position: absolute; + top: 0; + right: 0; + opacity: .5; + padding: .375rem; + cursor: pointer; + + pre:hover > & { display: block; } + &:hover { opacity: 1; } + + @if $style == 'dark' { + &:before { @extend %icon, %icon-clipboard-white; } + } @else { + &:before { @extend %icon, %icon-clipboard; } + } + + &._pre-clip-success, &._pre-clip-error { + &:before { display: none; } + &:after { + content: 'Copied'; + padding-right: .25rem; + } + } + &._pre-clip-error:after { content: 'Error'; } +} + ._github-btn { display: inline-block; vertical-align: text-top; diff --git a/assets/stylesheets/global/_base.scss b/assets/stylesheets/global/_base.scss index 3a20b844..3988c374 100644 --- a/assets/stylesheets/global/_base.scss +++ b/assets/stylesheets/global/_base.scss @@ -99,8 +99,9 @@ pre, code, samp, %pre, %code { } pre, %pre { + position: relative; margin: 1.5em 0; - padding: .375rem .75rem; + padding: .375rem .625rem; line-height: 1.5; overflow: auto; @extend %box; diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 77fb1c93..113a4e3a 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -113,3 +113,5 @@ %icon-contract-white { background-position: -9rem -8rem; } ._icon-react_native:before { background-position: 0 -9rem; } ._icon-phalcon:before { background-position: -1rem -9rem; } +%icon-clipboard { background-position: -2rem -9rem; } +%icon-clipboard-white { background-position: -3rem -9rem; } diff --git a/public/icons/ui/clipboard-white/16.png b/public/icons/ui/clipboard-white/16.png new file mode 100644 index 0000000000000000000000000000000000000000..f61a28eb6d13b6adccac906badb0b9c5476eb3e2 GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6;yhg(Ln;`1&mCnvpuod=fhWLn z6Q6V1>R&GVm+tty!$IVe!iO670N%1Q_iuh?aen+}sbi#OgQ)y}9d7Ow3YsT=O9?Av z3or3wzM5+#drB>Yd&@B{iL3t44l%iLUY;SY^P))00022NklOQE@!C>z@Swk>LnIR f)w_lO`Ar-FcZbvPho`RA00000NkvXXu0mjfB}!z} literal 0 HcmV?d00001 diff --git a/public/icons/ui/clipboard-white/SOURCE b/public/icons/ui/clipboard-white/SOURCE new file mode 100644 index 00000000..57116488 --- /dev/null +++ b/public/icons/ui/clipboard-white/SOURCE @@ -0,0 +1 @@ +https://github.com/github/octicons/blob/master/svg/clippy.svg diff --git a/public/icons/ui/clipboard/16.png b/public/icons/ui/clipboard/16.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d7f8ddccd45a835968b367e039e4c3123f0fa3 GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6;yhg(Ln;`P9he^Rh&KkzVN|y` ze1N+p-9UAj!5{X+ni)0{48=bKw|r1EYhCT7Tu+a}6?6 yI?|Z(SOXf4bIssuQTF6&*Sv8^P{T`xfkC-C_*~wldxAil7(8A5T-G@yGywn%2`w1_ literal 0 HcmV?d00001 diff --git a/public/icons/ui/clipboard/16@2x.png b/public/icons/ui/clipboard/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1b24a228475d153f731dc0aee9b7dc15f14ce774 GIT binary patch literal 230 zcmV)00023Nkl