diff --git a/src/renderer/assets/styles/index.css b/src/renderer/assets/styles/index.css index dbdb33fa..45428a48 100644 --- a/src/renderer/assets/styles/index.css +++ b/src/renderer/assets/styles/index.css @@ -56,12 +56,15 @@ ::-webkit-scrollbar-corner { background: var(--floatHoverColor); } + ::-webkit-scrollbar:vertical { width: 12px; } + ::-webkit-scrollbar-thumb { background: var(--editorColor10); } + ::-webkit-scrollbar-thumb:hover { background: var(--editorColor30); } diff --git a/src/renderer/components/editorWithTabs/editor.vue b/src/renderer/components/editorWithTabs/editor.vue index 95403d12..286773b4 100644 --- a/src/renderer/components/editorWithTabs/editor.vue +++ b/src/renderer/components/editorWithTabs/editor.vue @@ -273,6 +273,11 @@ codeFontFamily: value }) } + }, + currentFile: function (value, oldValue) { + if (value && value !== oldValue) { + this.scrollToCursor(0) + } } }, created () { @@ -524,11 +529,11 @@ this.$store.dispatch('SHOW_IMAGE_DELETION_URL', deletionUrl) }, - scrollToCursor () { + scrollToCursor (duration = 300) { this.$nextTick(() => { const { container } = this.editor const { y } = this.editor.getSelection().cursorCoords - animatedScrollTo(container, container.scrollTop + y - STANDAR_Y, 300) + animatedScrollTo(container, container.scrollTop + y - STANDAR_Y, duration) }) },