1
0
Fork 0
mirror of https://github.com/marty-oehme/scripts.git synced 2024-11-14 13:58:07 +00:00
qownnotes-scripts/insert-text/insert-text.qml
2017-07-23 15:15:27 +03:00

52 lines
1.6 KiB
QML

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)
}
}
}