Skip to content

Commit

Permalink
Merge pull request #176 from TankNee/rebuild/fix
Browse files Browse the repository at this point in the history
[fix]: fix splitter width
  • Loading branch information
TankNee authored Jan 3, 2022
2 parents 311a9a4 + f8a2f0a commit 461b494
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cn.memocast.app",
"version": "2.2.1",
"version": "2.2.2",
"description": "An Awesome WizNote Desktop Application",
"productName": "Memocast",
"author": "tanknee <[email protected]>",
Expand Down
25 changes: 15 additions & 10 deletions src/pages/Index.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<q-page class='flex'>
<q-splitter
v-model='splitterModel'
:limits='splitterLimit'
v-model='splitterWidthValue'
:limits='[10, 60]'
class='full-width'
unit='px'
unit='%'
separator-class='bg-transparent'
before-class='overflow-hidden'
after-class='hide-scrollbar'
Expand Down Expand Up @@ -187,20 +187,16 @@ export default {
contentsListLoaded: function () {
return this.contentsList && !!this.contentsList.length
},
splitterLimit: function () {
if (this.noteListVisible) return [150, 600]
return [0, 0]
},
...mapServerGetters(['currentNote', 'currentNoteInfo']),
...mapServerState(['contentsList', 'isCurrentNoteLoading', 'noteState']),
...mapClientState(['noteListVisible', 'enablePreviewEditor'])
...mapClientState(['noteListVisible', 'enablePreviewEditor', 'splitterWidth'])
},
data () {
return {
splitterModel: 300,
isOutlineShow: false,
isSourceMode: false,
isMindmapMode: false,
splitterWidthValue: 200,
tempNoteData: {},
wordCount: {
word: '0',
Expand Down Expand Up @@ -254,14 +250,15 @@ export default {
message: this.enablePreviewEditor ? this.$t('lockModeOff') : this.$t('lockModeOn')
})
},
...mapClientActions(['toggleChanged'])
...mapClientActions(['toggleChanged', 'updateStateAndStore'])
},
mounted () {
bus.$on(events.VIEW_SHORTCUT_CALL.lockMode, this.lockModeHandler)
bus.$on(events.VIEW_SHORTCUT_CALL.sourceMode, this.sourceModeHandler)
bus.$on(events.GENERATE_MINDMAP, this.generateMindmapHandler)
bus.$on(events.UPDATE_WORD_COUNT, this.wordCountUpdateHandler)
this.$nextTick(this.hideInitLoadingPage)
this.splitterWidthValue = this.splitterWidth
},
watch: {
isSourceMode: function (val) {
Expand All @@ -284,6 +281,14 @@ export default {
this.saveButtonIcon = 'save'
}, 3000)
}
},
noteListVisible: function (val) {
if (!val) {
this.updateStateAndStore({ splitterWidth: this.splitterWidthValue })
this.splitterWidthValue = 0
} else {
this.splitterWidthValue = this.splitterWidth
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/store/client/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function () {
rightClickCategoryItem: '',
theme: 'Default-Light',
themes: [],
autoSaveGap: 0
autoSaveGap: 0,
splitterWidth: 15
}
}

0 comments on commit 461b494

Please sign in to comment.