mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
server-ts: Convert attribute_formatter
This commit is contained in:
parent
9826fed905
commit
a183f21078
@ -12,7 +12,7 @@ const log = require('../../services/log');
|
|||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const htmlSanitizer = require('../../services/html_sanitizer.js');
|
const htmlSanitizer = require('../../services/html_sanitizer.js');
|
||||||
const {formatAttrForSearch} = require('../../services/attribute_formatter.js');
|
const {formatAttrForSearch} = require('../../services/attribute_formatter');
|
||||||
const jsdom = require("jsdom");
|
const jsdom = require("jsdom");
|
||||||
const { JSDOM } = jsdom;
|
const { JSDOM } = jsdom;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ const SearchContext = require('../../services/search/search_context.js');
|
|||||||
const searchService = require('../../services/search/services/search.js');
|
const searchService = require('../../services/search/services/search.js');
|
||||||
const bulkActionService = require('../../services/bulk_actions.js');
|
const bulkActionService = require('../../services/bulk_actions.js');
|
||||||
const cls = require('../../services/cls');
|
const cls = require('../../services/cls');
|
||||||
const {formatAttrForSearch} = require('../../services/attribute_formatter.js');
|
const {formatAttrForSearch} = require('../../services/attribute_formatter');
|
||||||
const ValidationError = require('../../errors/validation_error');
|
const ValidationError = require('../../errors/validation_error');
|
||||||
|
|
||||||
function searchFromNote(req) {
|
function searchFromNote(req) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function formatAttrForSearch(attr, searchWithValue) {
|
import BAttribute = require("../becca/entities/battribute");
|
||||||
|
|
||||||
|
function formatAttrForSearch(attr: BAttribute, searchWithValue: string) {
|
||||||
let searchStr = '';
|
let searchStr = '';
|
||||||
|
|
||||||
if (attr.type === 'label') {
|
if (attr.type === 'label') {
|
||||||
@ -27,7 +29,7 @@ function formatAttrForSearch(attr, searchWithValue) {
|
|||||||
return searchStr;
|
return searchStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(val) {
|
function formatValue(val: string) {
|
||||||
if (!/[^\w]/.test(val)) {
|
if (!/[^\w]/.test(val)) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -45,6 +47,6 @@ function formatValue(val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export = {
|
||||||
formatAttrForSearch
|
formatAttrForSearch
|
||||||
};
|
};
|
@ -4,7 +4,7 @@ const searchService = require('./search/services/search.js');
|
|||||||
const sql = require('./sql');
|
const sql = require('./sql');
|
||||||
const becca = require('../becca/becca');
|
const becca = require('../becca/becca');
|
||||||
const BAttribute = require('../becca/entities/battribute');
|
const BAttribute = require('../becca/entities/battribute');
|
||||||
const {formatAttrForSearch} = require('./attribute_formatter.js');
|
const {formatAttrForSearch} = require('./attribute_formatter');
|
||||||
const BUILTIN_ATTRIBUTES = require('./builtin_attributes');
|
const BUILTIN_ATTRIBUTES = require('./builtin_attributes');
|
||||||
|
|
||||||
const ATTRIBUTE_TYPES = ['label', 'relation'];
|
const ATTRIBUTE_TYPES = ['label', 'relation'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user