Skip to content

Commit

Permalink
fix: click note then select the note
Browse files Browse the repository at this point in the history
  • Loading branch information
betterRunner committed Sep 12, 2021
1 parent 1823777 commit 774f7c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/content-scripts/renderer/popup/note-book/note-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
@onChange="handle"
placeholder="search your notes.."
class="note-list-search"
size="mini"
></el-input>
>
<template #prefix>
<i class="el-input__icon el-icon-search"></i>
</template>
</el-input>
<Note
v-for="(note, i) in searchedNotes"
:ref="
Expand Down Expand Up @@ -37,6 +40,7 @@
import { defineComponent, onBeforeUpdate, inject, ref, computed } from "vue";
import dayjs from "dayjs";
import { Delta } from "@vueup/vue-quill";
import { Rect } from "@/types/common";
import { Note as TNote } from "@/types/note";
import { Storage } from "@/types/storage";
Expand Down Expand Up @@ -209,7 +213,7 @@ export default defineComponent({
const curNoteId = ref("");
const handleSelectNote = (id: string, scrollIntoView: boolean) => {
curNoteId.value = id;
mitt.emit("bold-note", {
id && mitt.emit("bold-note", {
id,
scrollIntoView,
});
Expand Down
7 changes: 6 additions & 1 deletion src/content-scripts/renderer/popup/note-book/note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class="note-wrapper"
:class="{ 'note-wrapper__notselected': notSelected }"
:style="colorBarStyle"
@click="handleClickNote"
>
<!-- website link -->
<el-tooltip placement="left">
Expand Down Expand Up @@ -201,9 +202,12 @@ export default {
nextTick(() => ctx.emit("focus", id));
});
const handleClickNote = () => {
// make sure the select event is trigger after `handleClickOutsideEditor`
nextTick(() => ctx.emit("select", props.note.id));
}
const handleClickEditor = () => {
enableEditor.value = true;
nextTick(() => ctx.emit("select", props.note.id));
};
const handleClickOutsideEditor = () => {
enableEditor.value = false;
Expand Down Expand Up @@ -242,6 +246,7 @@ export default {
editorToolbar,
editorContent,
editorDom,
handleClickNote,
handleClickEditor,
handleClickOutsideEditor,
};
Expand Down

0 comments on commit 774f7c5

Please sign in to comment.