Merge branch 'feature-rebuild' of github.com:doocs/md into feature-rebuild

This commit is contained in:
JimQing 2020-07-13 20:58:49 +08:00
commit 8233c9aba3

View File

@ -184,35 +184,26 @@ export default {
},
//
uploaded(response) {
if (response) {
if (response.success) {
//
const cursor = this.editor.getCursor();
const imageUrl = response.data;
const markdownImage = `![](${imageUrl})`;
// Markdown URL
this.editor.replaceSelection(`\n${markdownImage}\n`, cursor);
this.$message({
showClose: true,
message: '图片插入成功',
type: 'success'
});
this.onEditorRefresh();
} else {
//
this.$message({
showClose: true,
message: response.message,
type: 'error'
});
}
} else {
if (!response || !response.success) {
this.$message({
showClose: true,
message: '上传图片未知异常',
type: 'error'
});
return;
}
//
const cursor = this.editor.getCursor();
const imageUrl = response.data;
const markdownImage = `![](${imageUrl})`;
// Markdown URL
this.editor.replaceSelection(`\n${markdownImage}\n`, cursor);
this.$message({
showClose: true,
message: '图片插入成功',
type: 'success'
});
this.onEditorRefresh();
},
//
leftAndRightScroll() {
@ -274,13 +265,7 @@ export default {
const offsetWidth = this.$el.offsetWidth;
const maxLeft = offsetWidth - menuMinWidth;
const left = e.clientX - offsetLeft;
if (left > maxLeft) {
this.mouseLeft = maxLeft;
} else {
this.mouseLeft = left;
}
this.mouseLeft = Math.min(maxLeft, left);
this.mouseTop = e.clientY + 10;
this.rightClickMenuVisible = true;
},