Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(client): bring back toast for read-only notes
Elian Doran0ea60fa9d7bb
diff --git a/apps/client/src/services/syntax_highlight.ts b/apps/client/src/services/syntax_highlight.tsindex 6e08af760a..02089e09c8 100644--- a/apps/client/src/services/syntax_highlight.ts+++ b/apps/client/src/services/syntax_highlight.ts@@ -2,7 +2,7 @@ import { ensureMimeTypes, highlight, highlightAuto, loadTheme, Themes, type Autoimport mime_types from "./mime_types.js";import options from "./options.js";import { t } from "./i18n.js";-import { copyText } from "./clipboard_ext.js";+import { copyText, copyTextWithToast } from "./clipboard_ext.js";import { isShare } from "./utils.js";import { MimeType } from "@triliumnext/commons";@@ -36,7 +36,13 @@ export function applyCopyToClipboardButton($codeBlock: JQuery<HTMLElement>) {const $copyButton = $("<button>").addClass("bx component icon-action tn-tool-button bx-copy copy-button").attr("title", t("code_block.copy_title"))- .on("click", () => copyText($codeBlock.text()));+ .on("click", () => {+ if (!isShare) {+ copyTextWithToast($codeBlock.text());+ } else {+ copyText($codeBlock.text());+ }+ });$codeBlock.parent().append($copyButton);}