fix:Remove duplicates in character class

This commit is contained in:
soulsands 2023-04-08 21:07:48 +08:00
parent 181ddce887
commit a0ac603260
3 changed files with 11 additions and 11 deletions

View File

@ -45,7 +45,7 @@ function formatDateTime(date) {
} }
function localNowDateTime() { function localNowDateTime() {
return dayjs().format('YYYY-MM-DD HH:mm:ss.SSSZZ') return dayjs().format('YYYY-MM-DD HH:mm:ss.SSSZZ');
} }
function now() { function now() {
@ -101,7 +101,7 @@ async function stopWatch(what, func) {
} }
function formatValueWithWhitespace(val) { function formatValueWithWhitespace(val) {
return /[^\w_-]/.test(val) ? `"${val}"` : val; return /[^\w-]/.test(val) ? `"${val}"` : val;
} }
function formatLabel(label) { function formatLabel(label) {
@ -318,7 +318,7 @@ function initHelpDropdown($el) {
initHelpButtons($dropdownMenu); initHelpButtons($dropdownMenu);
} }
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/" const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/";
function openHelp(e) { function openHelp(e) {
window.open(wikiBaseUrl + $(e.target).attr("data-help-page"), '_blank'); window.open(wikiBaseUrl + $(e.target).attr("data-help-page"), '_blank');
@ -329,7 +329,7 @@ function initHelpButtons($el) {
// so we do it manually // so we do it manually
$el.on("click", e => { $el.on("click", e => {
if ($(e.target).attr("data-help-page")) { if ($(e.target).attr("data-help-page")) {
openHelp(e) openHelp(e);
} }
}); });
} }

View File

@ -1,4 +1,4 @@
"use strict" "use strict";
function formatAttrForSearch(attr, searchWithValue) { function formatAttrForSearch(attr, searchWithValue) {
let searchStr = ''; let searchStr = '';
@ -28,7 +28,7 @@ function formatAttrForSearch(attr, searchWithValue) {
} }
function formatValue(val) { function formatValue(val) {
if (!/[^\w_]/.test(val)) { if (!/[^\w]/.test(val)) {
return val; return val;
} }
else if (!val.includes('"')) { else if (!val.includes('"')) {
@ -47,4 +47,4 @@ function formatValue(val) {
module.exports = { module.exports = {
formatAttrForSearch formatAttrForSearch
} };

View File

@ -288,7 +288,7 @@ function searchNotesForAutocomplete(query) {
noteTitle: beccaService.getNoteTitle(result.noteId), noteTitle: beccaService.getNoteTitle(result.noteId),
notePathTitle: result.notePathTitle, notePathTitle: result.notePathTitle,
highlightedNotePathTitle: result.highlightedNotePathTitle highlightedNotePathTitle: result.highlightedNotePathTitle
} };
}); });
} }
@ -370,7 +370,7 @@ function formatAttribute(attr) {
let label = `#${utils.escapeHtml(attr.name)}`; let label = `#${utils.escapeHtml(attr.name)}`;
if (attr.value) { if (attr.value) {
const val = /[^\w_-]/.test(attr.value) ? `"${attr.value}"` : attr.value; const val = /[^\w-]/.test(attr.value) ? `"${attr.value}"` : attr.value;
label += `=${utils.escapeHtml(val)}`; label += `=${utils.escapeHtml(val)}`;
} }