mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-12-22 07:58:08 +00:00
Added insert text button script
This commit is contained in:
parent
b85e0f8cf1
commit
ba0b27fbcc
2 changed files with 62 additions and 0 deletions
10
insert-text/info.json
Normal file
10
insert-text/info.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "Insert text button",
|
||||||
|
"identifier": "insert-text",
|
||||||
|
"script": "insert-text.qml",
|
||||||
|
"authors": ["@Maboroshy"],
|
||||||
|
"platforms": ["linux", "macos", "windows"],
|
||||||
|
"version": "0.0.1",
|
||||||
|
"minAppVersion": "17.05.8",
|
||||||
|
"description" : "Simple script, that creates a button and a context menu item that insert text, defined in the script settings."
|
||||||
|
}
|
52
insert-text/insert-text.qml
Normal file
52
insert-text/insert-text.qml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import QtQml 2.2
|
||||||
|
import QOwnNotesTypes 1.0
|
||||||
|
|
||||||
|
/// Simple script, that creates a button and a context menu item that insert text, defined in the script settings.
|
||||||
|
|
||||||
|
Script {
|
||||||
|
property string text
|
||||||
|
property string menuName
|
||||||
|
property string buttonName
|
||||||
|
property string buttonIcon
|
||||||
|
|
||||||
|
property variant settingsVariables: [
|
||||||
|
{
|
||||||
|
"identifier": "text",
|
||||||
|
"name": "Text to insert",
|
||||||
|
"description": "A text that would be inserted to note text when the button is pressed.",
|
||||||
|
"type": "string",
|
||||||
|
"default": "[comment]: # ()",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "menuName",
|
||||||
|
"name": "Name of the menu item",
|
||||||
|
"description": "",
|
||||||
|
"type": "string",
|
||||||
|
"default": "Insert comment",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "buttonName",
|
||||||
|
"name": "Name of the button",
|
||||||
|
"description": "",
|
||||||
|
"type": "string",
|
||||||
|
"default": "Insert comment",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "buttonIcon",
|
||||||
|
"name": "Icon of the button",
|
||||||
|
"description": "Name or full path to button icon. If empty, button name will be shown.",
|
||||||
|
"type": "string",
|
||||||
|
"default": "insert-text.svg",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
script.registerCustomAction("insertText", menuName, buttonName, buttonIcon, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
function customActionInvoked(action) {
|
||||||
|
if (action == "insertText") {
|
||||||
|
script.noteTextEditWrite(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue