fix: improve the code regex

Signed-off-by: Braian A. Diez <bdiez19@gmail.com>
This commit is contained in:
Braian A. Diez
2026-02-28 13:11:56 -03:00
parent a913e95d0a
commit 67ffbb6f27
2 changed files with 32 additions and 10 deletions
@@ -39,28 +39,44 @@ Item {
}
// Date Filtering
property bool hasDateFilter: true
property bool hasDateFilter: Settings.data.appLauncher.enableClipboardDateHeaders
property string dateFilter: "all"
property var availableDateFilters: [
{
get label() { return I18n.tr("launcher.date-filter-all-time"); },
get label() {
return I18n.tr("launcher.date-filter-all-time");
},
"action": "all",
get icon() { return iconMode === "tabler" ? "calendar" : "x-office-calendar"; }
get icon() {
return iconMode === "tabler" ? "calendar" : "x-office-calendar";
}
},
{
get label() { return I18n.tr("launcher.date-filter-today"); },
get label() {
return I18n.tr("launcher.date-filter-today");
},
"action": "today",
get icon() { return iconMode === "tabler" ? "calendar-event" : "view-calendar-timeline"; }
get icon() {
return iconMode === "tabler" ? "calendar-event" : "view-calendar-timeline";
}
},
{
get label() { return I18n.tr("launcher.date-filter-yesterday"); },
get label() {
return I18n.tr("launcher.date-filter-yesterday");
},
"action": "yesterday",
get icon() { return iconMode === "tabler" ? "calendar-time" : "view-calendar"; }
get icon() {
return iconMode === "tabler" ? "calendar-time" : "view-calendar";
}
},
{
get label() { return I18n.tr("launcher.date-filter-previous-7-days"); },
get label() {
return I18n.tr("launcher.date-filter-previous-7-days");
},
"action": "week",
get icon() { return iconMode === "tabler" ? "calendar-week" : "view-calendar-week"; }
get icon() {
return iconMode === "tabler" ? "calendar-week" : "view-calendar-week";
}
}
]
+7 -1
View File
@@ -160,7 +160,13 @@ Singleton {
contentType = "link";
} else if (/^(\/|~\/|file:\/\/)/i.test(t) && !t.startsWith('//') && !t.includes('\n')) {
contentType = "file";
} else if ((t.includes('{') && t.includes('}') && (t.includes(';') || t.includes('='))) || t.includes('</') || t.includes('/>') || t.includes('function') || t.includes('import ') || t.includes('export ')) {
} else if (
(t.includes('{') && t.includes('}') && (t.includes(';') || t.includes('='))) ||
t.includes('</') || t.includes('/>') || t.includes('=>') || t.includes('===') || t.includes('!==') || t.includes('::') || t.includes('->') ||
/^(?:const|let|var|function|class|struct|interface|type|enum|import|export|func|fn|pub|def|using|namespace|property|public|private|protected)\b/i.test(t) ||
/^(?:#include|#define|#\[|@|\/\/|\/\*|<\?|<html|<body|<!DOCTYPE)/i.test(t) ||
/\b(?:require\(|module\.exports)\b/i.test(t)
) {
contentType = "code";
}
}