Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: refactor copy to clipboard button #2894

Merged
merged 5 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions site/assets/css/inline.css
Original file line number Diff line number Diff line change
Expand Up @@ -261,38 +261,33 @@ table.includecode {
max-width: 100%;
width: 100%;
table-layout: fixed;
background: #f3f4f4;
border: .15em solid black;
border: 1px solid rgba(0,0,0,.125);
border-spacing: 0;
}

table.includecode thead {
background: #333;
color: white;
}

table.includecode thead th a {
color: white;
}

table.includecode thead th {
border-bottom: .1em solid black;
border-bottom: 1px solid rgba(0,0,0,.125);
font-weight: normal;
font-size: .9em;
font-size: 85%;
}

table.includecode thead th {
text-align: right;
}

table.includecode thead th a {
font-family: monospace;
}

table.includecode thead th button {
background: #326be5;
border: .25em solid white;
color: white;
font-weight: bold;
margin: .25em;
vertical-align: middle;
background: transparent;
border: 0;
cursor: pointer;
padding: .1em .5em;
}

table.includecode tbody {
background: #f3f4f4;
}

table.includecode pre {
Expand Down
10 changes: 7 additions & 3 deletions site/layouts/shortcodes/codeFromFile.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
<table class="includecode" id="code-{{ $virtualPath }}">
<thead>
<tr>
<th><a href="/{{ $virtualPath }}">{{ $virtualPath }}</a> <button
onclick='copyText("code-{{ $virtualPath }}-hidden-copy-text");'>COPY</button></th>
<th>
<a href="/{{ $virtualPath }}">{{ $virtualPath }}</a>
<button onclick='copyText("code-{{ $virtualPath }}-hidden-copy-text");' title="Copy to clipboard">
<img src="{{ "copycode.svg" | relURL }}" alt="Copy">
</button>
</th>
</tr>
</thead>
<tbody>
Expand All @@ -19,4 +23,4 @@
</tr>
</tbody>
<textarea class="hidden-copy-text" id="code-{{ $virtualPath }}-hidden-copy-text">{{ ($file | readFile) }}</textarea>
</table>
</table>
7 changes: 5 additions & 2 deletions site/layouts/shortcodes/codeFromInline.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
<table class="includecode" id="inline-code-{{ $hash }}">
<thead>
<tr>
<th> <button
onclick='copyText("inline-code-{{ $hash }}-hidden-copy-text");'>COPY</button></th>
<th>
<button onclick='copyText("inline-code-{{ $hash }}-hidden-copy-text");' title="Copy to clipboard">
<img src="{{ "copycode.svg" | relURL }}" alt="Copy">
</button>
</th>
</tr>
</thead>
<tbody>
Expand Down
3 changes: 3 additions & 0 deletions site/static/copycode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.