-
-
+
+
+
+
leftTools.style.minWidth.split('\px')[0]){
that.contentsWidth = contentsStartWidth + moveLen
that.editorWidth = document.body.clientWidth * that.dialogWidth - (contentsStartWidth + moveLen)
@@ -366,30 +377,35 @@
},
handleClose(done) {
if(this.isShowUpdateBtn){
- // this.isSaveDialogVisible = true
- this.$confirm('',
- {
- message:'是否保存修改?',
- cancelButtonText: '不保存',
- confirmButtonText: '保存'
- }
- )
- .then(_ => {
- done();
- this.saveAll()
- })
- .catch(_ => {
- done();
- });
+ this.isSaveDialogVisible = true
}else{
done()
+ this.closeAllTabs()
}
},
- closeDialog() {
+ saveTab(){
+ this.update(this.editableTabs[this.removeIndex].change,this.editableTabs[this.removeIndex].name)
+ this.isTabSaveDialogVisible = false
+ this.editableTabs.splice(this.removeIndex,1)
+ },
+ confirmUpdate(){
+ this.saveAll(true)
+ this.textPreviewVisible = false
this.$emit('update:status', this.textPreviewVisible)
this.isSaveDialogVisible = false
this.isShowUpdateBtn = false
},
+ closeTabDialog(){
+ this.isTabSaveDialogVisible = false
+ this.editableTabs.splice(this.removeIndex,1)
+ },
+ closeDialog() {
+ this.textPreviewVisible = false
+ this.$emit('update:status', this.textPreviewVisible)
+ this.isSaveDialogVisible = false
+ this.isShowUpdateBtn = false
+ this.closeAllTabs()
+ },
change(value,index) {
if(value === this.editableTabs[index].content){
if(this.editableTabs[index].copyTitle !== this.editableTabs[index].title){
@@ -409,12 +425,23 @@
}
}
},
- saveAll(){
+ saveAll(isClose){
this.editableTabs.forEach((tab,index) => {
if(tab.status === 'Modifying'){
- this.update(tab.change,tab.name,index)
+ if(isClose){
+ this.update(tab.change,tab.name)
+ }else{
+ this.update(tab.change,tab.name,index)
+ }
}
})
+ if(isClose){
+ this.closeAllTabs()
+ }
+ },
+ closeAllTabs(){
+ this.editableTabs.splice(0,this.editableTabs.length)
+ this.$emit('update:file', {})
},
save(value,index) {
if(value !== this.editableTabs[index].content && this.isShowUpdateBtn){
@@ -440,6 +467,16 @@
this.isShowUpdateBtn = false
}
}
+ }else{
+ let update = false
+ this.editableTabs.forEach((tab) => {
+ if(tab.status === 'Modifying'){
+ update = true
+ }
+ })
+ if(!update){
+ this.isShowUpdateBtn = false
+ }
}
if(!this.modifyMsg){
this.modifyMsg = this.$message({
@@ -519,15 +556,8 @@
this.editableTabsValue = activeName;
this.editableTabs = tabs.filter(tab => tab.name !== targetName);
}else{
- this.$confirm('',{message:'是否保存修改?',cancelButtonText: '不保存',confirmButtonText: '保存'}
- ).then(()=>{
- this.update(this.editableTabs[removeIndex].change,this.editableTabs[removeIndex].name,removeIndex)
- }).catch(()=>{
- console.log(this.editableTabs[removeIndex].change,this.editableTabs[removeIndex].name,removeIndex)
- }).then(()=>{
- this.editableTabsValue = activeName;
- this.editableTabs = tabs.filter(tab => tab.name !== targetName);
- })
+ this.removeIndex = removeIndex
+ this.isTabSaveDialogVisible = true
}
}
}
@@ -776,15 +806,23 @@
}
}
- /*.monaco-editor {*/
- /*padding: 3px 0 0 0;*/
-
- /*.scroll-decoration{*/
- /*box-shadow: unset!important;*/
- /*}*/
- /*}*/
-
}
}
+