fix: task input height on devices with smaller font size
This commit is contained in:
parent
b5b56a6e4a
commit
c30c2e00cb
1 changed files with 9 additions and 5 deletions
|
@ -41,7 +41,7 @@ import TaskService from '../../services/task'
|
||||||
import createTask from '@/components/tasks/mixins/createTask'
|
import createTask from '@/components/tasks/mixins/createTask'
|
||||||
import QuickAddMagic from '@/components/tasks/partials/quick-add-magic.vue'
|
import QuickAddMagic from '@/components/tasks/partials/quick-add-magic.vue'
|
||||||
|
|
||||||
const INITIAL_SCROLL_HEIGHT = 40
|
const INPUT_BORDER_PX = 2
|
||||||
|
|
||||||
const cleanupTitle = title => {
|
const cleanupTitle = title => {
|
||||||
return title.replace(/^((\* |\+ |- )(\[ \] )?)/g, '')
|
return title.replace(/^((\* |\+ |- )(\[ \] )?)/g, '')
|
||||||
|
@ -54,7 +54,8 @@ export default {
|
||||||
newTaskTitle: '',
|
newTaskTitle: '',
|
||||||
taskService: new TaskService(),
|
taskService: new TaskService(),
|
||||||
errorMessage: '',
|
errorMessage: '',
|
||||||
textAreaHeight: INITIAL_SCROLL_HEIGHT,
|
textAreaHeight: null,
|
||||||
|
initialTextAreaHeight: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [
|
mixins: [
|
||||||
|
@ -71,14 +72,17 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
newTaskTitle(newVal) {
|
newTaskTitle(newVal) {
|
||||||
let scrollHeight = this.$refs.newTaskInput.scrollHeight
|
let scrollHeight = this.$refs.newTaskInput.scrollHeight + INPUT_BORDER_PX
|
||||||
if (scrollHeight < INITIAL_SCROLL_HEIGHT || newVal === '') {
|
if (scrollHeight < this.initialTextAreaHeight || newVal === '') {
|
||||||
scrollHeight = INITIAL_SCROLL_HEIGHT
|
scrollHeight = this.initialTextAreaHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
this.textAreaHeight = scrollHeight
|
this.textAreaHeight = scrollHeight
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.initialTextAreaHeight = this.$refs.newTaskInput.scrollHeight + INPUT_BORDER_PX
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addTask() {
|
addTask() {
|
||||||
if (this.newTaskTitle === '') {
|
if (this.newTaskTitle === '') {
|
||||||
|
|
Loading…
Reference in a new issue