From e079359c15695ecf7134bbb4df27956663cdb627 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 4 Dec 2021 12:50:02 +0100 Subject: [PATCH] copied links from tree should be reference links --- package.json | 2 +- src/public/app/services/clipboard.js | 3 ++- src/public/app/services/link.js | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2f3a79f6b..c701e12e0 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ }, "devDependencies": { "cross-env": "7.0.3", - "electron": "16.0.3", + "electron": "16.0.4", "@electron/remote": "2.0.1", "electron-builder": "22.14.5", "electron-packager": "15.4.0", diff --git a/src/public/app/services/clipboard.js b/src/public/app/services/clipboard.js index 0e0a9c9e4..63d0d29cb 100644 --- a/src/public/app/services/clipboard.js +++ b/src/public/app/services/clipboard.js @@ -66,11 +66,12 @@ async function copy(branchIds) { clipboardMode = 'copy'; if (utils.isElectron()) { + // https://github.com/zadam/trilium/issues/2401 const {clipboard} = require('electron'); const links = []; for (const branch of froca.getBranches(clipboardBranchIds)) { - const $link = await linkService.createNoteLink(branch.parentNoteId + '/' + branch.noteId); + const $link = await linkService.createNoteLink(branch.parentNoteId + '/' + branch.noteId, { referenceLink: true }); links.push($link[0].outerHTML); } diff --git a/src/public/app/services/link.js b/src/public/app/services/link.js index 78f3d39f9..1f1719955 100644 --- a/src/public/app/services/link.js +++ b/src/public/app/services/link.js @@ -21,6 +21,7 @@ async function createNoteLink(notePath, options = {}) { const showTooltip = options.showTooltip === undefined ? true : options.showTooltip; const showNotePath = options.showNotePath === undefined ? false : options.showNotePath; const showNoteIcon = options.showNoteIcon === undefined ? false : options.showNoteIcon; + const referenceLink = options.referenceLink === undefined ? false : options.referenceLink; const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath); @@ -48,6 +49,10 @@ async function createNoteLink(notePath, options = {}) { $noteLink.addClass("no-tooltip-preview"); } + if (referenceLink) { + $noteLink.addClass("reference-link"); + } + $container.append($noteLink); if (showNotePath) {