Skip to content
Open
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
54 changes: 54 additions & 0 deletions QuickCallouts/QuickCallouts.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import QtQml 2.0
import QOwnNotesTypes 1.0

Script {
/**
* Initializes the custom buttons and menu items in QOwnNotes
*/
function init() {
script.registerCustomAction("insertInfoCallout", "Insert Info Callout", "Info Callout", "dialog-information");
script.registerCustomAction("insertWarningCallout", "Insert Warning Callout", "Warning Callout", "dialog-warning");
script.registerCustomAction("insertNoteCallout", "Insert Note Callout", "Note Callout", "dialog-warning");
}

/**
* Triggers when you click the menu action or custom toolbar button
*/
function customActionInvoked(identifier) {
var selectedText = script.noteTextEditSelectedText();
if (!selectedText) {
selectedText = "Type your note content here...";
}

var resultHtml = "";

switch (identifier) {
case "insertNoteCallout":
resultHtml = '<div style="background-color: #0C0640; padding: 15px; border-left: 5px solid #1300D6; border-radius: 4px;">' +
'<h2>📝 Note</h2>' +
'<strong>Items of Interest</strong>' +
'<p>' + selectedText + '</p>' +
'</div>';
break;

case "insertInfoCallout":
resultHtml = '<div style="background-color: #579644; padding: 15px; border-left: 5px solid #1E6907; border-radius: 4px;">' +
'<h2>💡 Tip</h2>' +
'<p>' + selectedText + '</p>' +
'</div>';
break;

case "insertWarningCallout":
resultHtml = '<div style="background-color: #A30741; padding: 15px; border-left: 5px solid #700327; border-radius: 4px;">' +
'<h2>⚠️ Caution</h2>' +
'<strong>Potential Pitfalls</strong>' +
'<p>' + selectedText + '</p>' +
'</div>';
break;
}

if (resultHtml !== "") {
script.noteTextEditWrite(resultHtml);
}
}
}
10 changes: 10 additions & 0 deletions QuickCallouts/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "QuickCallouts",
"identifier": "quickcallouts",
"script": "QuickCallouts.qml",
"authors": ["@CIN-DEV-netizen"],
"platforms": ["linux", "macos", "windows"],
"version": "0.0.1",
"minAppVersion": "26.06.7",
"description": "QuickCallouts is a plugin for the QOwnNotes markdown editor designed to streamline the insertion of callout blocks. Instead of manually typing complex syntax, users can instantly add Note, Info, and Warning blocks directly from the script menu. This tool helps organize and highlight critical information, tips, and alerts within your notes with a single click, making your documentation clearer and more structured.",
}
Loading