mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
Merge branch 'chore/all-my-stuffs' of https://github.com/sharevb/it-tools into chore/all-my-stuffs
This commit is contained in:
commit
f811b996dd
4 files changed
+22
-6
No files matched your search
Vendored
+2
-1
@@ -5,7 +5,7 @@
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
import '@vue/runtime-core'
|
||||
|
||||
export {}
|
||||
export { }
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
@@ -357,6 +357,7 @@ declare module '@vue/runtime-core' {
|
||||
MttdlCalculator: typeof import('./src/tools/mttdl-calculator/mttdl-calculator.vue')['default']
|
||||
MultiLinkDownloader: typeof import('./src/tools/multi-link-downloader/multi-link-downloader.vue')['default']
|
||||
MyIp: typeof import('./src/tools/my-ip/my-ip.vue')['default']
|
||||
NA: typeof import('naive-ui')['NA']
|
||||
NanoidGenerator: typeof import('./src/tools/nanoid-generator/nanoid-generator.vue')['default']
|
||||
NanoMemo: typeof import('./src/tools/nano-memo/nano-memo.vue')['default']
|
||||
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
|
||||
|
||||
+1
-1
@@ -3236,7 +3236,7 @@ tools:
|
||||
tag-category: Category
|
||||
tag-html: Html
|
||||
tag-name: Name
|
||||
tag-gt-more-info: '> More info'
|
||||
tag-gt-more-info: 'More info about this character'
|
||||
url-cleaner:
|
||||
title: Url Cleaner
|
||||
description: >-
|
||||
|
||||
+1
-1
@@ -3075,7 +3075,7 @@ tools:
|
||||
tag-category: 类别
|
||||
tag-html: HTML
|
||||
tag-name: 名称
|
||||
tag-gt-more-info: "> 更多信息"
|
||||
tag-gt-more-info: '关于这个角色的更多信息'
|
||||
url-cleaner:
|
||||
title: URL清理器
|
||||
description: |
|
||||
|
||||
@@ -21,6 +21,21 @@ function toUTF8(codePoint: number) {
|
||||
|
||||
const searchQuery = useDebouncedRef('', 250);
|
||||
const parsedSearchQuery = computed(() => {
|
||||
const trimmedQuery = searchQuery.value.trim();
|
||||
|
||||
// Check if input is a single character (or a multi-byte Unicode character)
|
||||
if (trimmedQuery.length > 0) {
|
||||
const firstCodePoint = trimmedQuery.codePointAt(0);
|
||||
if (firstCodePoint != null) {
|
||||
// If it's a single character, convert to hex for exact search
|
||||
const charLength = firstCodePoint > 0xFFFF ? 2 : 1;
|
||||
if (trimmedQuery.length === charLength) {
|
||||
return `=${toPaddedHex(firstCodePoint)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for various Unicode notation formats
|
||||
const parsedRegex = /^\s*(?:\&#x(?<hex1>[\da-f]+);|\&#(?<dec>\d+);|(?:U\+|\\u)?\s*(?<hex2>[\da-f]+))\s*$/gi; // NOSONAR
|
||||
const parsedQuery = parsedRegex.exec(searchQuery.value);
|
||||
if (parsedQuery) {
|
||||
@@ -31,6 +46,7 @@ const parsedSearchQuery = computed(() => {
|
||||
return `=${toPaddedHex(Number.parseInt(parsedQuery.groups.dec, 10))}`;
|
||||
}
|
||||
}
|
||||
|
||||
return searchQuery.value;
|
||||
});
|
||||
|
||||
@@ -38,13 +54,12 @@ const unicodeSearchData = [...unicodeNames].map(([codePoint, characterName]) =>
|
||||
const hex = toPaddedHex(codePoint);
|
||||
return {
|
||||
codePoint,
|
||||
characterName: `${characterName} (U+${hex})`,
|
||||
characterName,
|
||||
hex,
|
||||
};
|
||||
});
|
||||
|
||||
const limit = ref(40);
|
||||
// Using FlexSearch instead of FuzzySearch for better performance
|
||||
const { searchResult } = useFlexSearch({
|
||||
search: parsedSearchQuery,
|
||||
data: unicodeSearchData,
|
||||
@@ -119,7 +134,7 @@ const { searchResult } = useFlexSearch({
|
||||
<input-copyable :value="`\&\#x${toPaddedHex(result.codePoint)};`" :readonly="true" mb-1 />
|
||||
<input-copyable :value="`\&\#${result.codePoint};`" :readonly="true" />
|
||||
</td>
|
||||
<td><input-copyable :value="result.characterName" :readonly="true" /></td>
|
||||
<td><input-copyable :value="`${result.characterName} (U+${result.hex})`" :readonly="true" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</n-table>
|
||||
|
||||
Reference in new issue
Block a user