Skip to content

Commit 59bd5db

Browse files
authored
Merge pull request #1950 from yoyomo/issue-1949
#1949 update for hidden only on clipboard
2 parents 36e1f01 + cf1557e commit 59bd5db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/theme/book.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
window.onunload = function () { };
55

66
// Global variable, shared between modules
7-
function playground_text(playground) {
7+
function playground_text(playground, hidden = true) {
88
let code_block = playground.querySelector("code");
99

1010
if (window.ace && code_block.classList.contains("editable")) {
1111
let editor = window.ace.edit(code_block);
1212
return editor.getValue();
13+
} else if (hidden) {
14+
return code_block.textContent;
1315
} else {
1416
return code_block.innerText;
1517
}
@@ -599,7 +601,7 @@ function playground_text(playground) {
599601
text: function (trigger) {
600602
hideTooltip(trigger);
601603
let playground = trigger.closest("pre");
602-
return playground_text(playground);
604+
return playground_text(playground, false);
603605
}
604606
});
605607

0 commit comments

Comments
 (0)