mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-11-16 14:58:08 +00:00
21 lines
659 B
QML
21 lines
659 B
QML
|
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, "#"))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|