Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions text2tag/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Text2tag",
"identifier": "text2tag",
"script": "text2tag.qml",
"authors": [
"@Glin76"
],
"platforms": [
"linux",
"macos",
"windows"
],
"version": "0.0.1",
"minAppVersion": "25.05.3",
"description": "This script creates a menu item and a button that adds a tag with the selected text to the current note."
}
29 changes: 29 additions & 0 deletions text2tag/text2tag.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import QtQml 2.0

/**
* This script creates a menu item and a button that adds a tag with the selected text to the current note
*/
QtObject {

function init() {
// create the menu entry
script.registerCustomAction("Text2tag", "Create tag with selected text", "Text 2 tag", "bookmark-new", true, false, true);
}

function customActionInvoked(identifier) {
switch (identifier) {
case "Text2tag":
var tag = script.getTagByNameBreadcrumbList(script.noteTextEditSelectedText());
var AlreadyTagged = false;
for (var idx in tag.notes) {
if (tag.notes[idx].id == script.currentNote().id) {
AlreadyTagged = true;
}
}
if (!AlreadyTagged) {
script.tagCurrentNote(script.noteTextEditSelectedText());
}
break;
}
}
}