Skip to content

Commit

Permalink
Merge pull request #108 from jamebal/save-content
Browse files Browse the repository at this point in the history
fix: 修复文本内容无法保存的问题
  • Loading branch information
jamebal committed May 20, 2024
2 parents d7758e8 + 56bfd19 commit fda29df
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/components/preview/SimTextPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
>
</history-popover>

<el-button v-if="isShowUpdateBtn" @click="saveAll(false)" :class="lightTheme?'':'dark-button'" size="small" :loading="updating">保存所有</el-button>
<el-button v-if="isShowUpdateBtn" @click="saveAll(false)" :class="lightTheme?'':'dark-button'" size="small" :loading="updating">{{saveTitle}}</el-button>

<el-button
v-if="editableTabsValue.endsWith('.md') && editableTabs.length > 0"
Expand Down Expand Up @@ -205,6 +205,7 @@
moblie: false,
panelReadOnly: true,
mountFileId: undefined,
saveTitle: '',
options: {
fontSize: 14,
contextmenu: true,
Expand Down Expand Up @@ -894,11 +895,24 @@
}else{
if(editableTabValue.copyTitle === editableTabValue.title){
editableTabValue.title += '*'
editableTabValue.status = 'Modifying'
this.isShowUpdateBtn = true
editableTabValue.change = value
}
editableTabValue.status = 'Modifying'
this.isShowUpdateBtn = true
editableTabValue.change = value
}
this.updateSaveTitle()
},
updateSaveTitle(){
// 判断this.editableTabs中的status是否有Modifying的数量
const modifyingTags = this.editableTabs.filter(editable => editable.status === 'Modifying')
if (modifyingTags) {
let modifyingLength = modifyingTags.length
if(modifyingLength > 1) {
this.saveTitle = '保存全部'
return
}
}
this.saveTitle = '保存'
},
saveAll(isClose){
this.editableTabs.forEach((tab,index) => {
Expand Down Expand Up @@ -957,6 +971,7 @@
this.isShowUpdateBtn = false
}
}
this.updateSaveTitle()
if(!this.modifyMsg){
this.$refs.historyPopover.loadHistoryPathList(this.editableTabsValue)
this.modifyMsg = this.$message({
Expand Down

0 comments on commit fda29df

Please sign in to comment.