Skip to content

Commit

Permalink
Fixed: CSS Editor scroll on input
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnuqw committed Apr 22, 2021
1 parent f1c784a commit f031660
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
11 changes: 1 addition & 10 deletions src/page.settings/components/styles-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,6 @@ export default {
async created() {
this.cssVars = await Actions.getCSSVars()
this.customCSS = await Actions.getCustomCSS(this.cssTarget)
this.$nextTick(() => {
if (this.$refs.cssEditor) {
this.$refs.cssEditor.style.height = '0px'
this.$refs.cssEditor.style.height = this.$refs.cssEditor.scrollHeight + 'px'
}
})
},
methods: {
Expand Down Expand Up @@ -647,10 +641,7 @@ export default {
/**
* Handle input
*/
onInput(e) {
e.target.style.height = '0px'
e.target.style.height = e.target.scrollHeight + 'px'
onInput() {
this.applyCssDebounced()
},
Expand Down
14 changes: 7 additions & 7 deletions src/styles/themes/default/styles-editor.styl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// -
.StylesEditor .vars
box(relative)
size(55%, 100%)
size(52%, 100%)
overflow-y: auto
flex-wrap: wrap
justify-content: flex-start
Expand Down Expand Up @@ -79,7 +79,7 @@
// -
.StylesEditor .css
box(relative, flex)
size(45%)
size(48%)
flex-flow: column
background-color: #00000016
overflow-y: auto
Expand All @@ -93,7 +93,8 @@
box(relative, flex)
justify-content: center
align-items: center
padding: 32px 0 0
padding: 16px 0
box-shadow: inset 0 -1px 0 0 var(--border-fg), 0 1px 0 0 var(--border-flare-fg)

.StylesEditor .nav-item
text(s: rem(18))
Expand All @@ -110,7 +111,6 @@
box(relative, flex)
flex-flow: column
flex: 1 0 auto
padding: 16px

.StylesEditor .editor
box(relative, border-box)
Expand All @@ -122,7 +122,7 @@
border: none
outline: none
margin: 0
padding: 0
padding: 16px
background-color: transparent
resize: none
z-index: 1
Expand All @@ -136,7 +136,7 @@
text(monospace, s: rem(11))
color: var(--true-fg)
white-space: pre-wrap
padding-right: 8px
padding: 16px
transition: opacity var(--d-fast)

&[data-hidden]
Expand All @@ -145,7 +145,7 @@
z-index: -1

.StylesEditor .editor-box > .placeholder-note
top: 50px
top: 36px
transition: opacity var(--d-fast) var(--d-fast)
color: var(--info-fg)
-moz-user-select: text
Expand Down

0 comments on commit f031660

Please sign in to comment.