Skip to content
Open
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
27 changes: 20 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ const settings = [
default: "0em"
},
{
key: "AlwaysShowInlineCopyButton",
title: "Always show inline copy code button?",
description: "Check the box if you would like the copy code button to always show next to inline code. If unchecked, the copy code button will only appear when hovering over the inline code.",
default: false,
type: "boolean",
enumPicker: "checkbox"
key: "InlineCopyButtonStyle",
title: "Inline copy code button style",
description: "Choose how you would like the copy code button to appear next to inline code.",
type: "enum",
default: "Show on hover",
enumChoices: [
"Always show",
"Show on hover",
"Never show"
],
enumPicker: "select"
}
]
logseq.useSettingsSchema(settings);
Expand Down Expand Up @@ -177,13 +182,21 @@ const main = async () => {
`)

// always show the copy button for inline code
if (logseq.settings.AlwaysShowInlineCopyButton) {
if (logseq.settings.InlineCopyButtonStyle == "Always show") {
logseq.provideStyle(`
#${inline_code.id}-button {
display: inline-flex;
}
`)
}
// don't show copy button for inline code when UI inserted before setting changed
else if (logseq.settings.InlineCopyButtonStyle == "Never show") {
logseq.provideStyle(`
#${inline_code.id}-button {
display: none;
}
`)
}
// show copy button for inline code on hover
else {
logseq.provideStyle(`
Expand Down