Skip to content

Commit

Permalink
fix: scoll to center when create the note
Browse files Browse the repository at this point in the history
  • Loading branch information
betterRunner committed Sep 12, 2021
1 parent 14d0751 commit e54ee80
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 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 @@ -38,7 +38,7 @@
</template>

<script lang="ts">
import { defineComponent, onBeforeUpdate, inject, ref, computed } from "vue";
import { defineComponent, onBeforeUpdate, inject, ref, computed, nextTick } from "vue";
import dayjs from "dayjs";
import { Delta } from "@vueup/vue-quill";
Expand Down Expand Up @@ -140,11 +140,14 @@ export default defineComponent({
$el: HTMLElement;
})?.$el;
if (divNote) {
divNote.scrollIntoView();
divNote.scrollIntoView({ block: 'center' });
}
// 3. focus the content editor of this note
mitt.emit("focus-editor", note.id);
// make sure above `scrollIntoView` is finished
setTimeout(() => {
mitt.emit("focus-editor", note.id);
})
});
// 4. send back the cb event
Expand Down

0 comments on commit e54ee80

Please sign in to comment.