Skip to content

Commit

Permalink
feat: tagbook open autofocus tag searcher
Browse files Browse the repository at this point in the history
  • Loading branch information
betterRunner committed Sep 12, 2021
1 parent af77b2b commit 1ff0484
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/content-scripts/renderer/popup/tag-book/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export default {
height: `${TAG_BOOK_HEIGHT}px`,
minHeight: `${TAG_BOOK_HEIGHT}px`,
});
watch(() => props.noteId, () => {
if (props.noteId) {
mitt.emit('tag-search-focus');
}
})
watch(
() => props.coor,
() => {
Expand Down
7 changes: 7 additions & 0 deletions src/content-scripts/renderer/popup/tag-book/tag-searcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<div class="tag-searcher-wrapper">
<el-input
v-model="searchText"
ref="taginput"
size="mini"
autofocus
placeholder="create or search tag.."
@keydown.enter="handleEnter"
></el-input>
Expand Down Expand Up @@ -33,6 +35,10 @@ export default {
});
}
);
const taginput = ref(null);
mitt.on('tag-search-focus', () => {
(taginput.value as unknown as HTMLElement)?.focus();
})
const handleEnter = () => {
if (!searchText.value) return;
Expand All @@ -44,6 +50,7 @@ export default {
});
return {
taginput,
searchText,
handleEnter,
};
Expand Down
1 change: 1 addition & 0 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [x] open link brings the note-id so can jump to note also
- [x] delete the tag while deleting a note who is the only one that owns this tag
- [x] searching notes
- [x] tag search auto focus
- [ ] more precise rects selection rather than coor (select the real dom by text)
- [ ] screenshot features
- https://javascript.plainenglish.io/a-better-alternative-to-html2canvas-in-vuejs-3-e0686755d56e

0 comments on commit 1ff0484

Please sign in to comment.