Skip to content

Commit 2eaa042

Browse files
author
vyleung
committed
RELEASE: v.1.1.0
- feat: copy inline code (addresses #4) - fix: copy code button doesn't show up on refresh
1 parent 6f16f66 commit 2eaa042

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const main = async () => {
9696
path: `#block-content-${code_block_uuid} > .block-body > .cp__fenced-code-block > div > #${code_block_parent.id}`,
9797
template:
9898
`
99-
<a class="button copy-button" id="${code_block_parent.id}-button" data-on-click="copy_code" style="display:flex; position:absolute;">
99+
<a class="button copy-button" id="${code_block_parent.id}-button" data-on-click="copy_code_CodeBlock" style="display:flex; position:absolute;">
100100
${copy_icon}
101101
</a>
102102
`
@@ -133,9 +133,6 @@ const main = async () => {
133133
else if (inline_code.parentElement.offsetParent.classList.contains("ls-block") && inline_code.parentElement.classList.contains("inline")) {
134134
inline_code_uuid = inline_code.parentElement.offsetParent.classList[1];
135135
}
136-
else {
137-
console.log("logseq-copy-code-plugin: ERROR - Cannot find inline code's parent uuid");
138-
}
139136

140137
// add an ID to differentiate multiple inline code within one block
141138
inline_code.id = `${prefix}-${inline_code_uuid}`;
@@ -146,7 +143,7 @@ const main = async () => {
146143
path: `#${inline_code.id}`,
147144
template:
148145
`
149-
<a class="button copy-button" id="${inline_code.id}-button" data-on-click="copy_code_inlineBlock" style="display: none; padding: 0; margin-left: 0.25em;">
146+
<a class="button copy-button" id="${inline_code.id}-button" data-on-click="copy_code_inlineBlock" style="display: none; padding: 0; margin-left: 0.25em; border-bottom-color: transparent !important;">
150147
${copy_icon}
151148
</a>
152149
`
@@ -186,7 +183,7 @@ const main = async () => {
186183
insertCopyCodeButton_InlineCode();
187184

188185
logseq.provideModel({
189-
copy_code(e) {
186+
copy_code_codeBlock(e) {
190187
// necessary to have the window focused in order to copy the content of the code block to the clipboard
191188
window.focus();
192189

0 commit comments

Comments
 (0)