diff --git a/src/index.js b/src/index.js index 12b1827..47736a6 100644 --- a/src/index.js +++ b/src/index.js @@ -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); @@ -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(`