Skip to content

Commit 44b4d8e

Browse files
fix the copy button positioning . (#34185)
1 parent 4a5abcb commit 44b4d8e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

doc/user/assets/sass/_content.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,17 @@ p+p {
908908
}
909909
}
910910

911+
.highlight {
912+
position: relative;
913+
914+
}
915+
911916
.copy_button {
912917
display: none;
913918
position: absolute;
919+
right: 10px;
920+
top: 10px;
921+
914922
font-size: rem(1.2);
915923
font-weight: 300;
916924
border: none;
@@ -921,8 +929,6 @@ p+p {
921929
cursor: pointer;
922930
border-radius: $border-radius;
923931
white-space: nowrap;
924-
top: 10px;
925-
right: 10px;
926932
line-height: 2;
927933
font-family: 'Inter', sans-serif;
928934

@@ -1149,7 +1155,7 @@ td span.copyableCode pre:hover .copy_button {
11491155
display: inline-block !important;
11501156
}
11511157

1152-
pre {
1158+
.highlight {
11531159
position: relative;
11541160

11551161
&:hover {

doc/user/assets/sass/_layout.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ table.inline-headings {
345345
flex: 1;
346346
position: sticky;
347347
top: 90px;
348-
height: 100vh;
349348
overflow-y: auto;
349+
height: 100vh;
350350

351351
@media(max-width: 1050px) {
352352
display: none;
@@ -363,10 +363,10 @@ table.inline-headings {
363363
padding: var(--x-small) rem(2);
364364
position: sticky;
365365
top: 0;
366-
height: 100vh;
367366
overflow-y: auto;
368367
font-size: var(--sm);
369368
padding-bottom: 8.5rem;
369+
height: 100vh;
370370

371371
&-top {
372372
margin-top: var(--pico);

doc/user/layouts/_default/baseof.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@
117117

118118
/* Add "Click to Copy" button to code blocks */
119119
$(document).ready(function () {
120-
$("pre.chroma").append(
120+
$(".highlight").append(
121121
'<button class="default_button copy_button" title="Copy code to clipboard">Copy</button>'
122122
);
123123

124-
$("pre.chroma button.copy_button").click(function (e) {
124+
$("pre.chroma + button.copy_button").click(function (e) {
125125
var _this = $(this),
126126
copyHex = document.createElement("textarea");
127127
copyHex.value = _this.parent().find("code").text().trim();

0 commit comments

Comments
 (0)