提交 f9bcb582 authored 作者: 王鹏飞's avatar 王鹏飞

update editor

上级 2b6b80e9
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -73,7 +73,8 @@ ...@@ -73,7 +73,8 @@
"webpack-merge": "^4.2.2" "webpack-merge": "^4.2.2"
}, },
"dependencies": { "dependencies": {
"@ckeditor/ckeditor5-build-classic": "^25.0.0", "@ckeditor/ckeditor5-build-classic": "^27.0.0",
"@ckeditor/ckeditor5-build-decoupled-document": "^27.0.0",
"@ckeditor/ckeditor5-vue2": "^1.0.5", "@ckeditor/ckeditor5-vue2": "^1.0.5",
"@ezijing/web-message-sdk": "^0.2.1", "@ezijing/web-message-sdk": "^0.2.1",
"axios": "^0.21.1", "axios": "^0.21.1",
......
...@@ -13,8 +13,13 @@ ...@@ -13,8 +13,13 @@
<script> <script>
import CKEditor from '@ckeditor/ckeditor5-vue2' import CKEditor from '@ckeditor/ckeditor5-vue2'
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
import '@ckeditor/ckeditor5-build-classic/build/translations/zh-cn' import DecoupledEditor from '@ckeditor/ckeditor5-build-decoupled-document'
import '@ckeditor/ckeditor5-build-decoupled-document/build/translations/zh-cn'
// import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
// import '@ckeditor/ckeditor5-build-classic/build/translations/zh-cn'
import MyUploadAdapter from './MyUploadAdapter' import MyUploadAdapter from './MyUploadAdapter'
export default { export default {
...@@ -27,14 +32,20 @@ export default { ...@@ -27,14 +32,20 @@ export default {
}, },
data() { data() {
return { return {
editor: ClassicEditor, editor: DecoupledEditor,
editorConfig: { editorConfig: {
language: this.$i18n.locale.toLocaleLowerCase() language: this.$i18n.locale.toLocaleLowerCase(),
fontFamily: { options: ['default', '宋体', 'Times New Roman'] },
fontSize: { options: ['12px', '14px', '16px', '18px', '20px', '24px', '36px'] }
} }
} }
}, },
methods: { methods: {
onEditorReady(editor) { onEditorReady(editor) {
editor.ui
.getEditableElement()
.parentElement.insertBefore(editor.ui.view.toolbar.element, editor.ui.getEditableElement())
const FileRepository = editor.plugins.get('FileRepository') const FileRepository = editor.plugins.get('FileRepository')
// 自定义上传图片插件 // 自定义上传图片插件
FileRepository.createUploadAdapter = loader => { FileRepository.createUploadAdapter = loader => {
...@@ -53,6 +64,8 @@ export default { ...@@ -53,6 +64,8 @@ export default {
min-height: 300px; min-height: 300px;
max-height: 500px; max-height: 500px;
word-break: break-word; word-break: break-word;
background: var(--ck-color-base-background);
border: 1px solid var(--ck-color-toolbar-border) !important;
} }
.ck-sticky-panel__content { .ck-sticky-panel__content {
position: unset !important; position: unset !important;
......
<template>
<editor v-bind="options" />
</template>
<script>
import Editor from '@tinymce/tinymce-vue'
export default {
components: {
editor: Editor
},
data() {
return {
options: {
init: {
min_height: 300,
max_height: 500,
menubar: false,
language: this.$i18n.locale.replace('-', '_'),
branding: false,
plugins: 'wordcount table autoresize charmap code fullscreen hr lists codesample',
toolbar:
'undo redo | removeformat formats | fontselect fontsizeselect lineheight bold italic underline strikethrough forecolor backcolor | link image | align indent outdent numlist bullist | charmap table blockquote hr codesample fullscreen',
fontsize_formats: '12px 14px 15px 16px 17px 18px 20px 24px',
lineheight_formats: '0.5 1 1.2 1.5 2'
}
}
}
}
}
</script>
...@@ -181,10 +181,9 @@ export default { ...@@ -181,10 +181,9 @@ export default {
}, },
// 显示作业评论 // 显示作业评论
showComment() { showComment() {
return true const currentTime = new Date().getTime()
// const currentTime = new Date().getTime() const endTime = +new Date(this.deadline)
// const endTime = +new Date(this.deadline) return this.hasComment && currentTime > endTime
// return this.hasComment && currentTime > endTime
} }
}, },
methods: { methods: {
......
...@@ -211,5 +211,6 @@ export default [ ...@@ -211,5 +211,6 @@ export default [
props: true props: true
}, },
{ path: '/403', name: '403', component: () => import('@/pages/exception/403.vue') }, { path: '/403', name: '403', component: () => import('@/pages/exception/403.vue') },
{ path: '/browser', name: 'browser', component: () => import('@/pages/exception/browser.vue') } { path: '/browser', name: 'browser', component: () => import('@/pages/exception/browser.vue') },
{ path: '/editor', name: 'editor', component: () => import('@/components/ckeditor/index.vue') }
] ]
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论