Skip to content

Commit

Permalink
完善并发布v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TCOTC committed Mar 26, 2024
1 parent 74de9b6 commit e3b9913
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
10 changes: 6 additions & 4 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

变化:

- 适配其他主题和插件,不再被覆盖
- 高亮结果文本滚动到页面中央
- 提高显示层级,不再被其他主题和插件覆盖
- 高亮结果文本滚动到页面中央,兼容数据库文本高亮
- 搜索结果索引计数可以循环
- 文本框在 1 秒内无编辑则自动搜索

修复:

- 自动重置搜索结果索引计数为 0
- 只搜索在文档区域内的文本(不包含界面和文档标题)
- 每次搜索自动重置搜索结果索引计数为 0
- 只搜索在文档区域内的文本(不包含界面和文档标题)
- 不再搜索到不可视的文本
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "siyuan-plugin-hsr-mdzz2048-fork",
"author": "TCOTC",
"url": "https://github.com/TCOTC/siyuan-plugin-hsr-mdzz2048-fork",
"version": "0.0.14",
"version": "0.1.0",
"minAppVersion": "2.9.8",
"backends": ["windows", "linux", "darwin"],
"frontends": ["desktop", "browser-desktop"],
Expand Down
Binary file modified preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions src/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ const props = defineProps<{
element: Element,
}>()
// 当文本框内容变动后超过2秒没有再次变动时,会触发 highlightHitResult 函数
// const searchText = ref(''); // v-model 绑定的变量
// 当文本框内容变动后超过1秒没有再次变动时,会触发 highlightHitResult 函数
let typingTimer: number | undefined; // 更新这里,初始化为 undefined
const doneTypingInterval = 2000; // 2秒
const doneTypingInterval = 1000; // 1秒
function handleInput() {
clearTimeout(typingTimer); // 清除之前的定时器
Expand Down Expand Up @@ -136,7 +135,7 @@ function highlightHitResult(value: string) {
const searchResultsHighlight = new Highlight(...ranges.flat())
resultCount.value = ranges.flat().length
resultRange.value = ranges.flat()
console.log(ranges.flat())
// console.log(ranges.flat())
// 注册高亮
CSS.highlights.set("search-results", searchResultsHighlight)
Expand Down

0 comments on commit e3b9913

Please sign in to comment.