add: 讨论
This commit is contained in:
parent
ee4be3a0b9
commit
221cd42fb3
@ -101,7 +101,7 @@ export default {
|
|||||||
// 创建编辑器
|
// 创建编辑器
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
if (!window.editorObj && window.Vditor) {
|
if (!window.editorObj && window.Vditor) {
|
||||||
const editorConfig = {
|
window.editorObj = new window.Vditor('editor', {
|
||||||
toolbar: [
|
toolbar: [
|
||||||
'emoji',
|
'emoji',
|
||||||
'headings',
|
'headings',
|
||||||
@ -143,13 +143,59 @@ export default {
|
|||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
pin: true
|
pin: true
|
||||||
},
|
},
|
||||||
|
cache: {
|
||||||
|
enable: true
|
||||||
|
},
|
||||||
|
placeholder: '我们书写的不是代码,而是人生'
|
||||||
|
})
|
||||||
|
|
||||||
|
window.editorReplyObj = new window.Vditor('editor-reply', {
|
||||||
|
toolbar: [
|
||||||
|
'emoji',
|
||||||
|
'headings',
|
||||||
|
'bold',
|
||||||
|
'italic',
|
||||||
|
'strike',
|
||||||
|
'link',
|
||||||
|
'list',
|
||||||
|
'ordered-list',
|
||||||
|
'outdent',
|
||||||
|
'indent',
|
||||||
|
'quote',
|
||||||
|
'line',
|
||||||
|
'code',
|
||||||
|
'inline-code',
|
||||||
|
'upload',
|
||||||
|
'insert-before',
|
||||||
|
'insert-after',
|
||||||
|
'undo',
|
||||||
|
'redo',
|
||||||
|
{
|
||||||
|
name: 'more',
|
||||||
|
toolbar: [
|
||||||
|
'table',
|
||||||
|
'fullscreen',
|
||||||
|
'edit-mode',
|
||||||
|
'check',
|
||||||
|
'both',
|
||||||
|
'code-theme',
|
||||||
|
'content-theme',
|
||||||
|
'export',
|
||||||
|
'outline',
|
||||||
|
'preview',
|
||||||
|
'format',
|
||||||
|
'devtools'
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
height: 220,
|
||||||
|
toolbarConfig: {
|
||||||
|
pin: true
|
||||||
|
},
|
||||||
cache: {
|
cache: {
|
||||||
enable: false
|
enable: false
|
||||||
},
|
},
|
||||||
placeholder: '我们书写的不是代码,而是人生'
|
placeholder: '我们书写的不是代码,而是人生'
|
||||||
}
|
})
|
||||||
window.editorObj = new window.Vditor('editor', editorConfig)
|
|
||||||
window.editorReplyObj = new window.Vditor('editor-reply', editorConfig)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const comments = this.comments
|
const comments = this.comments
|
||||||
@ -343,19 +389,22 @@ export default {
|
|||||||
if (cancel) {
|
if (cancel) {
|
||||||
this.replyID = null
|
this.replyID = null
|
||||||
this.replyLastID = null
|
this.replyLastID = null
|
||||||
document.getElementById('comment').appendChild(editorReplyObject)
|
window.location.hash = '_'
|
||||||
} else {
|
} else {
|
||||||
this.replyID = id
|
this.replyID = id
|
||||||
this.replyLastID = replyLastID
|
this.replyLastID = replyLastID
|
||||||
document.getElementById('comment_ID_' + id).appendChild(editorReplyObject)
|
document.getElementById('comment_ID_' + id).appendChild(editorReplyObject)
|
||||||
const comment = this.commentsMap.get(replyLastID)
|
const comment = this.commentsMap.get(replyLastID)
|
||||||
window.editorReplyObj.setValue('', true)
|
window.editorReplyObj.setValue('', true)
|
||||||
window.editorReplyObj.focus()
|
this.$nextTick(() => {
|
||||||
if (replyLastID !== null) {
|
window.editorReplyObj.focus()
|
||||||
window.editorReplyObj.insertValue('> ' + comment.comment_content + ' \n\n\n', true)
|
if (replyLastID !== null) {
|
||||||
// window.editorReplyObj.getCursorPosition()
|
window.editorReplyObj.insertValue('> ' + comment.comment_content + ' \n\n\n', true)
|
||||||
// window.editorReplyObj.setSelectionRange(pos, pos)
|
} else {
|
||||||
}
|
window.editorReplyObj.insertValue('', true)
|
||||||
|
}
|
||||||
|
window.location.hash = '#comment_ID_' + id
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user