修改问题知识库的富文本粘贴图片

This commit is contained in:
sunFlower
2022-09-16 09:31:13 +08:00
parent ea74da2a7f
commit 72c1726824
@@ -227,10 +227,9 @@
data() { data() {
return { return {
formInline: {}, formInline: {},
loading: false,
headers: '', headers: '',
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload', uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
loading: false,
problemTypeList: [],
editorOption: { // 富文本框配置 editorOption: { // 富文本框配置
placeholder: '', placeholder: '',
theme: 'snow', // or 'bubble' theme: 'snow', // or 'bubble'
@@ -253,6 +252,7 @@
} }
} }
}, },
problemTypeList: [],
rules: { rules: {
showPermissions: [ showPermissions: [
{ {
@@ -308,6 +308,7 @@
}, },
isDisplay: false, isDisplay: false,
disabled: false, disabled: false,
content: '<h2>I am Example</h2>'
projectNameList: [ projectNameList: [
{ {
value: 'Open', value: 'Open',
@@ -318,26 +319,19 @@
name: this.$t('Privacy') name: this.$t('Privacy')
} }
], ],
content: '<h2>I am Example</h2>'
} }
}, },
created() {
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token }
},
computed: { computed: {
editor() { editor() {
return this.$refs.myQuillEditor.quill return this.$refs.myQuillEditor.quill
} }
}, },
created() {
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token }
},
mounted() { mounted() {
this.getBase() this.getBase()
if (this.$route.query.id) {
this.queryById()
document.title = this.$t('problemKnowledgeBase') + this.$t('edit')
} else {
document.title = this.$t('problemKnowledgeBase') + this.$t('newlyAdded')
}
let quill = this.$refs.myQuillEditor.quill let quill = this.$refs.myQuillEditor.quill
this.$forceUpdate() this.$forceUpdate()
quill.root.addEventListener( quill.root.addEventListener(
@@ -381,11 +375,14 @@
}, },
false false
) )
if (this.$route.query.id) {
this.queryById()
document.title = this.$t('problemKnowledgeBase') + this.$t('edit')
} else {
document.title = this.$t('problemKnowledgeBase') + this.$t('newlyAdded')
}
}, },
methods: { methods: {
quilleditorBlur() {
this.$refs.ruleForm.validateField('content')
},
handleCustomMatcher(node, Delta) { handleCustomMatcher(node, Delta) {
let ops = [] let ops = []
Delta.ops.forEach(op => { Delta.ops.forEach(op => {
@@ -398,6 +395,9 @@
Delta.ops = ops Delta.ops = ops
return Delta return Delta
}, },
quilleditorBlur() {
this.$refs.ruleForm.validateField('content')
},
getBase() { getBase() {
getAction('/problemKnowledgeBase/problemKnowledgeBaseClassifyEO/list', {}).then((res) => { getAction('/problemKnowledgeBase/problemKnowledgeBaseClassifyEO/list', {}).then((res) => {
if (res.success) { if (res.success) {
@@ -460,39 +460,28 @@
, ,
onEditorFocus(quill) { onEditorFocus(quill) {
console.log('editor focus!', quill) console.log('editor focus!', quill)
} },
,
onEditorReady(quill) { onEditorReady(quill) {
console.log('editor ready!', quill) console.log('editor ready!', quill)
} },
, PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
},
onEditorChange({ quill, html, text }) { onEditorChange({ quill, html, text }) {
console.log(html) console.log(html)
console.log(quill) console.log(quill)
console.log(text) console.log(text)
this.formInline.content = html this.formInline.content = html
} },
,
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
}
,
handleInput(value) { handleInput(value) {
this.$nextTick(() => { this.$nextTick(() => {
this.formInline = { ...this.formInline } this.formInline = { ...this.formInline }
this.$refs.ruleForm.validateField([value]) this.$refs.ruleForm.validateField([value])
}) })
} },
,
bringInDocumentInformationClick() { bringInDocumentInformationClick() {
this.$refs.listAddModelRef.addModel(this.formInline) this.$refs.listAddModelRef.addModel(this.formInline)
}
,
listAddModelForm(id, number) {
this.formInline.standNumber = number
this.formInline.bussDocumentLibraryId = id
this.formInline = { ...this.formInline }
}, },
handleChange(info) { handleChange(info) {
let { file } = info let { file } = info
@@ -512,6 +501,11 @@
} }
}, },
listAddModelForm(id, number) {
this.formInline.standNumber = number
this.formInline.bussDocumentLibraryId = id
this.formInline = { ...this.formInline }
},
clickButtonToUpload(item) { clickButtonToUpload(item) {
this.$refs.uploadFile.perentHandleFunc() this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true this.$refs.uploadFile.visible = true