mirror of
https://github.com/marty-oehme/scripts.git
synced 2025-01-04 22:38:09 +00:00
New script
This commit is contained in:
parent
2b42352252
commit
76cd2131d2
2 changed files with 31 additions and 0 deletions
note-link-to-clipboard
10
note-link-to-clipboard/info.json
Normal file
10
note-link-to-clipboard/info.json
Normal file
|
@ -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"
|
||||
}
|
21
note-link-to-clipboard/note-link-to-clipboard.qml
Normal file
21
note-link-to-clipboard/note-link-to-clipboard.qml
Normal file
|
@ -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, "_")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue