mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
fix: update date path
This commit is contained in:
parent
ec2ae4aa51
commit
624a0d3307
@ -16,12 +16,12 @@ const fileUploadConfig = {
|
||||
}
|
||||
|
||||
|
||||
function fileUpload(content, fileName) {
|
||||
function fileUpload(content, filename) {
|
||||
const date = new Date();
|
||||
const dir = date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate();
|
||||
const dir = date.getFullYear() + '/' + (date.getMonth() + 1).toString().padStart(2, '0') + '/' + date.getDate().toString().padStart(2, '0');
|
||||
const uuid = uuidv4();
|
||||
const token = fileUploadConfig.accessToken[Math.floor(Math.random() * fileUploadConfig.accessToken.length)].replace('doocsmd', '');
|
||||
const dateFilename = new Date().getTime() + '-' + uuid + '.' + fileName.split('.')[1];
|
||||
const dateFilename = new Date().getTime() + '-' + uuid + '.' + filename.split('.')[1];
|
||||
const url = `https://api.github.com/repos/${fileUploadConfig.username}/${fileUploadConfig.repo}/contents/${dir}/${dateFilename}`;
|
||||
|
||||
return fetch({
|
||||
|
@ -200,7 +200,7 @@ export function fixCodeWhiteSpace(value = 'pre') {
|
||||
const preDomList = document.getElementsByClassName('code__pre');
|
||||
|
||||
if (preDomList.length > 0) {
|
||||
preDomList.forEach(pre=> {
|
||||
preDomList.forEach(pre => {
|
||||
pre.style.whiteSpace = value;
|
||||
})
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ export default {
|
||||
return !this.nightMode ? 'success' : 'default';
|
||||
},
|
||||
...mapState({
|
||||
output: state=> state.output,
|
||||
editor: state=> state.editor,
|
||||
cssEditor: state=> state.cssEditor,
|
||||
currentFont: state=> state.currentFont,
|
||||
currentSize: state=> state.currentSize,
|
||||
currentColor: state=> state.currentColor,
|
||||
codeTheme: state=> state.codeTheme,
|
||||
nightMode: state=> state.nightMode
|
||||
output: state => state.output,
|
||||
editor: state => state.editor,
|
||||
cssEditor: state => state.cssEditor,
|
||||
currentFont: state => state.currentFont,
|
||||
currentSize: state => state.currentSize,
|
||||
currentColor: state => state.currentColor,
|
||||
codeTheme: state => state.codeTheme,
|
||||
nightMode: state => state.nightMode
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
@ -156,9 +156,9 @@ export default {
|
||||
},
|
||||
// 图片上传前的处理
|
||||
beforeUpload(file) {
|
||||
uploadImgFile(file).then(res=> {
|
||||
uploadImgFile(file).then(res => {
|
||||
this.$emit('uploaded', res)
|
||||
}).catch(err=> {
|
||||
}).catch(err => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: err,
|
||||
@ -201,7 +201,7 @@ export default {
|
||||
e.target.blur();
|
||||
},
|
||||
// 自定义CSS样式
|
||||
async customStyle () {
|
||||
async customStyle() {
|
||||
this.$emit('showCssEditor');
|
||||
this.$nextTick(() => {
|
||||
if(!this.cssEditor) {
|
||||
|
@ -21,10 +21,10 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
btnType() {
|
||||
return !this.nightMode ? 'success' : 'default';
|
||||
return this.nightMode ? 'default' : 'success';
|
||||
},
|
||||
...mapState({
|
||||
nightMode: state=> state.nightMode
|
||||
nightMode: state => state.nightMode
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ export default {
|
||||
// 空函数,阻断el-upload上传
|
||||
// 图片上传前的处理
|
||||
beforeUpload(file) {
|
||||
uploadImgFile(file).then(res=> {
|
||||
uploadImgFile(file).then(res => {
|
||||
this.$emit('menuTick', 'insertPic', res)
|
||||
}).catch(err=> {
|
||||
}).catch(err => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: err,
|
||||
|
@ -93,14 +93,14 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
wxRenderer: state=> state.wxRenderer,
|
||||
output: state=> state.output,
|
||||
editor: state=> state.editor,
|
||||
cssEditor: state=> state.cssEditor,
|
||||
currentSize: state=> state.currentSize,
|
||||
currentColor: state=> state.currentColor,
|
||||
nightMode: state=> state.nightMode,
|
||||
rightClickMenuVisible: state=> state.rightClickMenuVisible
|
||||
wxRenderer: state => state.wxRenderer,
|
||||
output: state => state.output,
|
||||
editor: state => state.editor,
|
||||
cssEditor: state => state.cssEditor,
|
||||
currentSize: state => state.currentSize,
|
||||
currentColor: state => state.currentColor,
|
||||
nightMode: state => state.nightMode,
|
||||
rightClickMenuVisible: state => state.rightClickMenuVisible
|
||||
})
|
||||
},
|
||||
created() {
|
||||
@ -132,9 +132,9 @@ export default {
|
||||
if (item.kind === 'file') {
|
||||
this.isImgLoading = true;
|
||||
const pasteFile = item.getAsFile()
|
||||
uploadImgFile(pasteFile).then(res=> {
|
||||
uploadImgFile(pasteFile).then(res => {
|
||||
this.uploaded(res)
|
||||
}).catch(err=> {
|
||||
}).catch(err => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: err,
|
||||
@ -206,7 +206,7 @@ export default {
|
||||
},
|
||||
// 左右滚动
|
||||
leftAndRightScroll() {
|
||||
const scrollCB = text=> {
|
||||
const scrollCB = text => {
|
||||
let source, target;
|
||||
|
||||
clearTimeout(this.timeout);
|
||||
@ -214,14 +214,14 @@ export default {
|
||||
source = this.$refs.preview.$el;
|
||||
target = document.getElementsByClassName('CodeMirror-scroll')[0];
|
||||
this.editor.off('scroll', editorScrollCB);
|
||||
this.timeout = setTimeout(()=> {
|
||||
this.timeout = setTimeout(() => {
|
||||
this.editor.on('scroll', editorScrollCB);
|
||||
}, 300);
|
||||
} else if (text === 'editor') {
|
||||
source = document.getElementsByClassName('CodeMirror-scroll')[0];
|
||||
target = this.$refs.preview.$el;
|
||||
target.removeEventListener("scroll", previewScrollCB, false);
|
||||
this.timeout = setTimeout(()=> {
|
||||
this.timeout = setTimeout(() => {
|
||||
target.addEventListener("scroll", previewScrollCB, false);
|
||||
}, 300);
|
||||
}
|
||||
@ -231,10 +231,10 @@ export default {
|
||||
|
||||
target.scrollTo(0, height);
|
||||
};
|
||||
const editorScrollCB = ()=> {
|
||||
const editorScrollCB = () => {
|
||||
scrollCB('editor');
|
||||
};
|
||||
const previewScrollCB = ()=> {
|
||||
const previewScrollCB = () => {
|
||||
scrollCB('preview');
|
||||
};
|
||||
|
||||
@ -244,12 +244,12 @@ export default {
|
||||
// 更新编辑器
|
||||
onEditorRefresh() {
|
||||
this.editorRefresh();
|
||||
setTimeout(()=> PR.prettyPrint(), 0);
|
||||
setTimeout(() => PR.prettyPrint(), 0);
|
||||
},
|
||||
// 复制结束
|
||||
endCopy() {
|
||||
this.backLight = false;
|
||||
setTimeout(()=> {
|
||||
setTimeout(() => {
|
||||
this.isCoping = false;
|
||||
}, 800);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user