mirror of
https://github.com/marty-oehme/scripts.git
synced 2025-12-09 13:32:46 +00:00
New script
This commit is contained in:
parent
a2fed13bee
commit
84c47c3df0
2 changed files with 30 additions and 0 deletions
20
headline-depth/headline-depth.qml
Normal file
20
headline-depth/headline-depth.qml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import QtQml 2.2
|
||||||
|
import QOwnNotesTypes 1.0
|
||||||
|
|
||||||
|
// This script adds toolbar buttons to increase and decrease the depth of all the headlines in selected text
|
||||||
|
|
||||||
|
Script {
|
||||||
|
function init() {
|
||||||
|
script.registerCustomAction("#+", "Increase headline depth", "#+")
|
||||||
|
script.registerCustomAction("#-", "Decrease headline depth", "#-")
|
||||||
|
}
|
||||||
|
|
||||||
|
function customActionInvoked(action) {
|
||||||
|
if (action == "#+")
|
||||||
|
script.noteTextEditWrite(script.noteTextEditSelectedText().replace(/^\#/gm, "##"))
|
||||||
|
if (action == "#-")
|
||||||
|
script.noteTextEditWrite(script.noteTextEditSelectedText().replace(/^\#\#/gm, "#"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
10
headline-depth/info.json
Normal file
10
headline-depth/info.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "Headline depth buttons",
|
||||||
|
"identifier": "headline-depth",
|
||||||
|
"script": "headline-depth.qml",
|
||||||
|
"authors": ["@Maboroshy"],
|
||||||
|
"platforms": ["linux", "macos", "windows"],
|
||||||
|
"version": "0.0.1",
|
||||||
|
"minAppVersion": "17.07.8",
|
||||||
|
"description" : "This script adds toolbar buttons to increase and decrease the depth of all the headlines in selected text"
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue