From f4cddb0e76cf519930b089cb48c51775cf63bf3e Mon Sep 17 00:00:00 2001 From: Bonnie Simon Date: Tue, 7 Jan 2025 17:03:21 +0530 Subject: [PATCH] Add DisableInlineCopyButton setting --- src/index.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index 12b1827..ce954ab 100644 --- a/src/index.js +++ b/src/index.js @@ -16,11 +16,20 @@ const settings = [ type: "string", default: "0em" }, + { + key: "DisableInlineCopyButton", + title: "Don't show inline copy code cutton", + description: + "Check this box if you don't want copy code button next to inline code.", + default: false, + type: "boolean", + enumPicker: "checkbox", + }, { 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, + defaul "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. Note: This option is obsolete when DisableInlineCopyButton is checked.", +t: false, type: "boolean", enumPicker: "checkbox" } @@ -61,10 +70,15 @@ const main = async () => { for (const code of code_mirror) { insertCopyCodeButton_CodeBlock(); } - // after exiting edit mode, insert the copy copy button next to inline code - const inline_code_text = added_node.querySelectorAll(".content :not(pre) > code"); - for (const text of inline_code_text) { - insertCopyCodeButton_InlineCode(); + + if (!logseq.settings.DisableInlineCopyButton) { + // after exiting edit mode, insert the copy copy button next to inline code + const inline_code_text = added_node.querySelectorAll( + ".content :not(pre) > code", + ); + for (const text of inline_code_text) { + insertCopyCodeButton_InlineCode(); + } } } }