]> BookStack Code Mirror - bookstack/commitdiff
Only show codeblock copy icon on hover
authorDan Brown <redacted>
Sat, 22 Sep 2018 13:55:33 +0000 (14:55 +0100)
committerDan Brown <redacted>
Sat, 22 Sep 2018 13:55:33 +0000 (14:55 +0100)
Fixes #980

resources/assets/js/services/code.js
resources/assets/sass/_codemirror.scss

index de863e09fee8ae692895e6f34a0990d161b76285..7e43ab0c66e55b75178a442c99a95fc889a55b92 100644 (file)
@@ -113,7 +113,7 @@ function addCopyIcon(cmInstance) {
         copyButton.classList.add('success');
         setTimeout(() => {
             copyButton.classList.remove('success');
-        }, 360);
+        }, 240);
     });
 }
 
index 8fe4058cbc52f57c085861ea613c9db600e7638b..e3f7028eb349c1566019aff588df91656310d8b5 100644 (file)
@@ -419,11 +419,12 @@ span.CodeMirror-selectedtext { background: none; }
   cursor: pointer;
   fill: #444;
   z-index: 5;
-  transition: all ease-in 180ms;
+  transition: all ease-in 240ms;
   user-select: none;
-  opacity: 0.7;
+  opacity: 0;
+  pointer-events: none;
   svg {
-    transition: transform ease-in 180ms;
+    transition: transform ease-in 240ms;
     transform: translateY(0);
   }
   &.success {
@@ -437,4 +438,5 @@ span.CodeMirror-selectedtext { background: none; }
 .CodeMirror:hover .CodeMirror-copy {
   user-select: all;
   opacity: 1;
+  pointer-events: all;
 }
\ No newline at end of file