提交 e1703994 authored 作者: GOD_ZYX's avatar GOD_ZYX

修复 ckeditor

上级 c897b64b
...@@ -294,11 +294,12 @@ export default { ...@@ -294,11 +294,12 @@ export default {
}, },
initckeditor () { initckeditor () {
if (!this.exam.shortAnswerList) { return } if (!this.exam.shortAnswerList) { return }
/* 删除所有 ckeditor 实例 */
let instances = CKEDITOR.instances
for (let name in instances) { instances[name].destroy() }
for (let i = 0; i < this.exam.shortAnswerList.length; i++) { for (let i = 0; i < this.exam.shortAnswerList.length; i++) {
let instances = CKEDITOR.instances
let tmpEditor = null
if (!instances['editor-exam' + i]) { if (!instances['editor-exam' + i]) {
tmpEditor = CKEDITOR.replace('editor-exam' + i, { CKEDITOR.replace('editor-exam' + i, {
height: 300, height: 300,
uiColor: '#eeeeee', uiColor: '#eeeeee',
filebrowserImageUploadUrl: '/api/ckeditor/img/upload', filebrowserImageUploadUrl: '/api/ckeditor/img/upload',
...@@ -319,7 +320,7 @@ export default { ...@@ -319,7 +320,7 @@ export default {
] ]
}) })
} }
this.exam.shortAnswerList[i].ckeditor = tmpEditor || instances['editor-exam' + i] this.exam.shortAnswerList[i].ckeditor = instances['editor-exam' + i]
} }
}, },
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论