mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-11-27 10:44:15 +00:00
Compare commits
1 Commits
renovate/c
...
5cd5a87823
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cd5a87823 |
@@ -19,9 +19,9 @@ document
|
|||||||
.forEach((highlightDiv) => createCopyButton(highlightDiv));
|
.forEach((highlightDiv) => createCopyButton(highlightDiv));
|
||||||
|
|
||||||
async function copyCodeToClipboard(button, highlightDiv) {
|
async function copyCodeToClipboard(button, highlightDiv) {
|
||||||
const codeToCopy = highlightDiv.querySelector(
|
const codeToCopy = highlightDiv
|
||||||
"pre > code"
|
.querySelector("pre > code ")
|
||||||
).innerText;
|
.innerText.replace(/\n\n/g, "\n"); // This is needed to fix the double spacing
|
||||||
try {
|
try {
|
||||||
var result = await navigator.permissions.query({ name: "clipboard-write" });
|
var result = await navigator.permissions.query({ name: "clipboard-write" });
|
||||||
if (result.state == "granted" || result.state == "prompt") {
|
if (result.state == "granted" || result.state == "prompt") {
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ document
|
|||||||
.forEach((highlightDiv) => createCopyButton(highlightDiv));
|
.forEach((highlightDiv) => createCopyButton(highlightDiv));
|
||||||
|
|
||||||
async function copyCodeToClipboard(button, highlightDiv) {
|
async function copyCodeToClipboard(button, highlightDiv) {
|
||||||
const codeToCopy = highlightDiv.querySelector(
|
const codeToCopy = highlightDiv
|
||||||
"pre > code"
|
.querySelector("pre > code ")
|
||||||
).innerText;
|
.innerText.replace(/\n\n/g, "\n"); // This is needed to fix the double spacing
|
||||||
try {
|
try {
|
||||||
var result = await navigator.permissions.query({ name: "clipboard-write" });
|
var result = await navigator.permissions.query({ name: "clipboard-write" });
|
||||||
if (result.state == "granted" || result.state == "prompt") {
|
if (result.state == "granted" || result.state == "prompt") {
|
||||||
|
|||||||
Reference in New Issue
Block a user