Skip to content

Commit 1ff0484

Browse files
committed
feat: tagbook open autofocus tag searcher
1 parent af77b2b commit 1ff0484

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/content-scripts/renderer/popup/tag-book/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ export default {
6262
height: `${TAG_BOOK_HEIGHT}px`,
6363
minHeight: `${TAG_BOOK_HEIGHT}px`,
6464
});
65+
watch(() => props.noteId, () => {
66+
if (props.noteId) {
67+
mitt.emit('tag-search-focus');
68+
}
69+
})
6570
watch(
6671
() => props.coor,
6772
() => {

src/content-scripts/renderer/popup/tag-book/tag-searcher.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<div class="tag-searcher-wrapper">
33
<el-input
44
v-model="searchText"
5+
ref="taginput"
56
size="mini"
7+
autofocus
68
placeholder="create or search tag.."
79
@keydown.enter="handleEnter"
810
></el-input>
@@ -33,6 +35,10 @@ export default {
3335
});
3436
}
3537
);
38+
const taginput = ref(null);
39+
mitt.on('tag-search-focus', () => {
40+
(taginput.value as unknown as HTMLElement)?.focus();
41+
})
3642
const handleEnter = () => {
3743
if (!searchText.value) return;
3844
@@ -44,6 +50,7 @@ export default {
4450
});
4551
4652
return {
53+
taginput,
4754
searchText,
4855
handleEnter,
4956
};

todo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [x] open link brings the note-id so can jump to note also
88
- [x] delete the tag while deleting a note who is the only one that owns this tag
99
- [x] searching notes
10+
- [x] tag search auto focus
1011
- [ ] more precise rects selection rather than coor (select the real dom by text)
1112
- [ ] screenshot features
1213
- https://javascript.plainenglish.io/a-better-alternative-to-html2canvas-in-vuejs-3-e0686755d56e

0 commit comments

Comments
 (0)