}
return false;
}
- const clipboard = new window.ClipboardJS('.code-copy-button', {
- text: function(trigger) {
- const codeEl = trigger.previousElementSibling.cloneNode(true);
- for (const childEl of codeEl.children) {
- if (isCodeAnnotation(childEl)) {
- childEl.remove();
- }
- }
- return codeEl.innerText;
- }
- });
- clipboard.on('success', function(e) {
+ const onCopySuccess = function(e) {
// button target
const button = e.trigger;
// don't keep focus
@@ -596,7 +585,29 @@
}, 1000);
// clear code selection
e.clearSelection();
+ }
+ const getTextToCopy = function(trigger) {
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
+ for (const childEl of codeEl.children) {
+ if (isCodeAnnotation(childEl)) {
+ childEl.remove();
+ }
+ }
+ return codeEl.innerText;
+ }
+ const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
+ text: getTextToCopy
});
+ clipboard.on('success', onCopySuccess);
+ if (window.document.getElementById('quarto-embedded-source-code-modal')) {
+ // For code content inside modals, clipBoardJS needs to be initialized with a container option
+ // TODO: Check when it could be a function (https://github.com/zenorocha/clipboard.js/issues/860)
+ const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
+ text: getTextToCopy,
+ container: window.document.getElementById('quarto-embedded-source-code-modal')
+ });
+ clipboardModal.on('success', onCopySuccess);
+ }
const viewSource = window.document.getElementById('quarto-view-source') ||
window.document.getElementById('quarto-code-tools-source');
if (viewSource) {
diff --git a/_site/index.html b/_site/index.html
index 4c5d2910..a97ed732 100644
--- a/_site/index.html
+++ b/_site/index.html
@@ -2,7 +2,7 @@
-
+
@@ -268,18 +268,7 @@ Interests
}
return false;
}
- const clipboard = new window.ClipboardJS('.code-copy-button', {
- text: function(trigger) {
- const codeEl = trigger.previousElementSibling.cloneNode(true);
- for (const childEl of codeEl.children) {
- if (isCodeAnnotation(childEl)) {
- childEl.remove();
- }
- }
- return codeEl.innerText;
- }
- });
- clipboard.on('success', function(e) {
+ const onCopySuccess = function(e) {
// button target
const button = e.trigger;
// don't keep focus
@@ -311,7 +300,29 @@ Interests
}, 1000);
// clear code selection
e.clearSelection();
+ }
+ const getTextToCopy = function(trigger) {
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
+ for (const childEl of codeEl.children) {
+ if (isCodeAnnotation(childEl)) {
+ childEl.remove();
+ }
+ }
+ return codeEl.innerText;
+ }
+ const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
+ text: getTextToCopy
});
+ clipboard.on('success', onCopySuccess);
+ if (window.document.getElementById('quarto-embedded-source-code-modal')) {
+ // For code content inside modals, clipBoardJS needs to be initialized with a container option
+ // TODO: Check when it could be a function (https://github.com/zenorocha/clipboard.js/issues/860)
+ const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
+ text: getTextToCopy,
+ container: window.document.getElementById('quarto-embedded-source-code-modal')
+ });
+ clipboardModal.on('success', onCopySuccess);
+ }
const viewSource = window.document.getElementById('quarto-view-source') ||
window.document.getElementById('quarto-code-tools-source');
if (viewSource) {
diff --git a/_site/listings.json b/_site/listings.json
index 48302e40..92be52cb 100644
--- a/_site/listings.json
+++ b/_site/listings.json
@@ -1,11 +1,14 @@
[
{
- "listing": "/projects.html",
- "items": []
- },
- {
- "listing": "/publications.html",
- "items": []
+ "listing": "/blog.html",
+ "items": [
+ "/posts/2023-05-30-quarto-light-dark/index.html",
+ "/posts/2023-05-07-quarto-docker/index.html",
+ "/posts/2023-03-12-quarto-mathjax-packages/index.html",
+ "/posts/2023-03-05-quarto-auto-table-crossref/index.html",
+ "/posts/2021-05-06-floating-toc-in-blogdown/index.html",
+ "/posts/2020-05-06-ggpacman/index.html"
+ ]
},
{
"listing": "/talks.html",
@@ -20,14 +23,11 @@
]
},
{
- "listing": "/blog.html",
- "items": [
- "/posts/2023-05-30-quarto-light-dark/index.html",
- "/posts/2023-05-07-quarto-docker/index.html",
- "/posts/2023-03-12-quarto-mathjax-packages/index.html",
- "/posts/2023-03-05-quarto-auto-table-crossref/index.html",
- "/posts/2021-05-06-floating-toc-in-blogdown/index.html",
- "/posts/2020-05-06-ggpacman/index.html"
- ]
+ "listing": "/publications.html",
+ "items": []
+ },
+ {
+ "listing": "/projects.html",
+ "items": []
}
]
\ No newline at end of file
diff --git a/_site/posts/2020-05-06-ggpacman/index.html b/_site/posts/2020-05-06-ggpacman/index.html
index 1068aa48..931abb9e 100644
--- a/_site/posts/2020-05-06-ggpacman/index.html
+++ b/_site/posts/2020-05-06-ggpacman/index.html
@@ -2,7 +2,7 @@
-
+
@@ -1581,18 +1581,7 @@ A ggplot2
and gganimate
Version of P
}
return false;
}
- const clipboard = new window.ClipboardJS('.code-copy-button', {
- text: function(trigger) {
- const codeEl = trigger.previousElementSibling.cloneNode(true);
- for (const childEl of codeEl.children) {
- if (isCodeAnnotation(childEl)) {
- childEl.remove();
- }
- }
- return codeEl.innerText;
- }
- });
- clipboard.on('success', function(e) {
+ const onCopySuccess = function(e) {
// button target
const button = e.trigger;
// don't keep focus
@@ -1624,7 +1613,29 @@ A ggplot2
and gganimate
Version of P
}, 1000);
// clear code selection
e.clearSelection();
+ }
+ const getTextToCopy = function(trigger) {
+ const codeEl = trigger.previousElementSibling.cloneNode(true);
+ for (const childEl of codeEl.children) {
+ if (isCodeAnnotation(childEl)) {
+ childEl.remove();
+ }
+ }
+ return codeEl.innerText;
+ }
+ const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
+ text: getTextToCopy
});
+ clipboard.on('success', onCopySuccess);
+ if (window.document.getElementById('quarto-embedded-source-code-modal')) {
+ // For code content inside modals, clipBoardJS needs to be initialized with a container option
+ // TODO: Check when it could be a function (https://github.com/zenorocha/clipboard.js/issues/860)
+ const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
+ text: getTextToCopy,
+ container: window.document.getElementById('quarto-embedded-source-code-modal')
+ });
+ clipboardModal.on('success', onCopySuccess);
+ }
const viewSource = window.document.getElementById('quarto-view-source') ||
window.document.getElementById('quarto-code-tools-source');
if (viewSource) {
@@ -2032,7 +2043,7 @@ A ggplot2
and gganimate
Version of P
"$1$2"
);
});
-
-
-