From 76cd2131d23420b44f4a734764099c02c45296d8 Mon Sep 17 00:00:00 2001 From: Maboroshy Date: Fri, 13 Oct 2017 22:59:21 +0400 Subject: [PATCH] New script --- note-link-to-clipboard/info.json | 10 +++++++++ .../note-link-to-clipboard.qml | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 note-link-to-clipboard/info.json create mode 100644 note-link-to-clipboard/note-link-to-clipboard.qml diff --git a/note-link-to-clipboard/info.json b/note-link-to-clipboard/info.json new file mode 100644 index 0000000..a98edb9 --- /dev/null +++ b/note-link-to-clipboard/info.json @@ -0,0 +1,10 @@ +{ + "name": "Note link to clipboard", + "identifier": "note-link-to-clipboard", + "script": "note-link-to-clipboard.qml", + "authors": ["@Maboroshy"], + "platforms": ["linux", "macos", "windows"], + "version": "0.0.1", + "minAppVersion": "17.02.4", + "description" : "This script adds a toolbar button and a context menu item to copy the link of selected note to clipboard" +} diff --git a/note-link-to-clipboard/note-link-to-clipboard.qml b/note-link-to-clipboard/note-link-to-clipboard.qml new file mode 100644 index 0000000..8bcb5d7 --- /dev/null +++ b/note-link-to-clipboard/note-link-to-clipboard.qml @@ -0,0 +1,21 @@ +import QtQml 2.2 +import QOwnNotesTypes 1.0 + +// This script adds a toolbar button and a context menu item to copy the link of selected note to clipboard + +Script { + function init() { + script.registerCustomAction("noteLinkToClipboard", "Copy link to the note to clipboard", + "Note link to cb", "link" , false, false, true) + } + + function customActionInvoked(action) { + if (action == "noteLinkToClipboard") { + var note = script.currentNote() + script.setClipboardText("[%1](note://%2)".arg(note.name).arg(note.name.replace(/[^\d\w]/g, "_"))) + } + } +} + + +