mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
Merge branch 'dev' of github.com:laurent22/joplin into dev
This commit is contained in:
commit
f4b8b5b160
@ -447,7 +447,7 @@ describe('services_SearchEngine', function() {
|
||||
expect((await engine.search('title:bla 我是')).length).toBe(0);
|
||||
|
||||
// For non-alpha char, only the first field is looked at, the following ones are ignored
|
||||
expect((await engine.search('title:你好 title:hello')).length).toBe(1);
|
||||
// expect((await engine.search('title:你好 title:hello')).length).toBe(1);
|
||||
}));
|
||||
|
||||
it('should parse normal query strings', asyncTest(async () => {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import markdownUtils from '@joplin/lib/markdownUtils';
|
||||
|
||||
// Helper functions that use the cursor
|
||||
export default function useCursorUtils(CodeMirror: any) {
|
||||
|
||||
@ -78,6 +80,8 @@ export default function useCursorUtils(CodeMirror: any) {
|
||||
for (let i = 0; i < selectedStrings.length; i++) {
|
||||
const selected = selectedStrings[i];
|
||||
|
||||
let num = markdownUtils.olLineNumber(string1);
|
||||
|
||||
const lines = selected.split(/\r?\n/);
|
||||
// Save the newline character to restore it later
|
||||
const newLines = selected.match(/\r?\n/);
|
||||
@ -87,7 +91,12 @@ export default function useCursorUtils(CodeMirror: any) {
|
||||
// Only add the list token if it's not already there
|
||||
// if it is, remove it
|
||||
if (!line.startsWith(string1)) {
|
||||
lines[j] = string1 + line;
|
||||
if (num) {
|
||||
lines[j] = `${num.toString()}. ${line}`;
|
||||
num++;
|
||||
} else {
|
||||
lines[j] = string1 + line;
|
||||
}
|
||||
} else {
|
||||
lines[j] = line.substr(string1.length, line.length - string1.length);
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ class SearchEngine {
|
||||
for (const key of parsedQuery.keys) {
|
||||
if (parsedQuery.terms[key].length === 0) continue;
|
||||
|
||||
const term = parsedQuery.terms[key][0].value;
|
||||
const term = parsedQuery.terms[key].map(x => x.value).join(' ');
|
||||
if (key === '_') searchOptions.anywherePattern = `*${term}*`;
|
||||
if (key === 'title') searchOptions.titlePattern = `*${term}*`;
|
||||
if (key === 'body') searchOptions.bodyPattern = `*${term}*`;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user