Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/text2tag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Text2tag",
"identifier": "Text2tag",
"script": "Text2tag.qml",
Comment thread
Glin76 marked this conversation as resolved.
Outdated
"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"
Comment thread
Glin76 marked this conversation as resolved.
Outdated
}
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");
Comment thread
Glin76 marked this conversation as resolved.
Outdated
}

function customActionInvoked(identifier) {
switch (identifier) {
case "Text2tag":
var tag = script.getTagByNameBreadcrumbList(script.noteTextEditSelectedText());
Comment thread
Glin76 marked this conversation as resolved.
Outdated
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;
}
}
}
Loading