mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-14 18:58:13 +00:00
fix: 文件md、text互转时文件格式没有变的问题
This commit is contained in:
parent
0035789951
commit
b4c1d05d2e
@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span slot="reference">[{{$L('未保存')}}*]</span>
|
<span slot="reference">[{{$L('未保存')}}*]</span>
|
||||||
</EPopover>
|
</EPopover>
|
||||||
{{$A.getFileName(file)}}
|
{{fileName}}
|
||||||
</div>
|
</div>
|
||||||
<div class="header-user">
|
<div class="header-user">
|
||||||
<ul>
|
<ul>
|
||||||
@ -37,8 +37,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="file.type=='document' && contentDetail" class="header-hint">
|
<div v-if="file.type=='document' && contentDetail" class="header-hint">
|
||||||
<ButtonGroup size="small" shape="circle">
|
<ButtonGroup size="small" shape="circle">
|
||||||
<Button :type="`${contentDetail.type=='md'?'primary':'default'}`" @click="$set(contentDetail, 'type', 'md')">{{$L('MD编辑器')}}</Button>
|
<Button :type="`${contentDetail.type=='md'?'primary':'default'}`" @click="setTextType('md')">{{$L('MD编辑器')}}</Button>
|
||||||
<Button :type="`${contentDetail.type!='md'?'primary':'default'}`" @click="$set(contentDetail, 'type', 'text')">{{$L('文本编辑器')}}</Button>
|
<Button :type="`${contentDetail.type!='md'?'primary':'default'}`" @click="setTextType('text')">{{$L('文本编辑器')}}</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="file.type=='mind'" class="header-hint">
|
<div v-if="file.type=='mind'" class="header-hint">
|
||||||
@ -150,6 +150,7 @@ export default {
|
|||||||
|
|
||||||
unsaveTip: false,
|
unsaveTip: false,
|
||||||
|
|
||||||
|
fileExt: null,
|
||||||
contentDetail: null,
|
contentDetail: null,
|
||||||
contentBak: {},
|
contentBak: {},
|
||||||
|
|
||||||
@ -203,6 +204,7 @@ export default {
|
|||||||
this.linkShow = false;
|
this.linkShow = false;
|
||||||
this.historyShow = false;
|
this.historyShow = false;
|
||||||
this.officeReady = false;
|
this.officeReady = false;
|
||||||
|
this.fileExt = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true,
|
||||||
@ -250,6 +252,15 @@ export default {
|
|||||||
return this.file.id || 0
|
return this.file.id || 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fileName() {
|
||||||
|
if (this.fileExt) {
|
||||||
|
return $A.getFileName(Object.assign(this.file, {
|
||||||
|
ext: this.fileExt
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
return $A.getFileName(this.file)
|
||||||
|
},
|
||||||
|
|
||||||
equalContent() {
|
equalContent() {
|
||||||
return this.contentBak == $A.jsonStringify(this.contentDetail);
|
return this.contentBak == $A.jsonStringify(this.contentDetail);
|
||||||
},
|
},
|
||||||
@ -360,10 +371,15 @@ export default {
|
|||||||
},
|
},
|
||||||
}).then(({data, msg}) => {
|
}).then(({data, msg}) => {
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.$store.dispatch("saveFile", {
|
const newData = {
|
||||||
id: this.fileId,
|
id: this.fileId,
|
||||||
size: data.size,
|
size: data.size,
|
||||||
});
|
};
|
||||||
|
if (this.fileExt) {
|
||||||
|
newData.ext = this.fileExt;
|
||||||
|
this.fileExt = null;
|
||||||
|
}
|
||||||
|
this.$store.dispatch("saveFile", newData);
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
this.getContent();
|
this.getContent();
|
||||||
@ -459,6 +475,11 @@ export default {
|
|||||||
this.unsaveTip = false;
|
this.unsaveTip = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setTextType(type) {
|
||||||
|
this.fileExt = type
|
||||||
|
this.$set(this.contentDetail, 'type', type)
|
||||||
|
},
|
||||||
|
|
||||||
documentKey() {
|
documentKey() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user