提交 a3767831 authored 作者: wangjiahao's avatar wangjiahao

refactor: 丰富富文本插件

上级 9f01bc4e
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* For commercial licenses see https://www.tiny.cloud/ * For commercial licenses see https://www.tiny.cloud/
*/ */
table { table {
border-collapse: collapse; border-collapse: collapse;
} }
......
<template> <template>
<div v-if="editStatus" class="rich-main-class"> <div class="rich-main-class" @dblclick="setEdit">
<Editor <Editor
v-show="canEdit" v-if="editShow"
:id="tinymceId" :id="tinymceId"
v-model="myValue" v-model="myValue"
style="width: 100%;height: 100%" style="width: 100%;height: 100%"
:init="init" :init="init"
:disabled="disabled" :disabled="!canEdit"
@onClick="onClick" @onClick="onClick"
/> />
<div v-show="!canEdit" style="width: 100%;height: 100%" @dblclick="setEdit" v-html="myValue" /> <!-- <div v-show="!canEdit" style="width: 100%;height: 100%" @dblclick="setEdit" v-html="myValue" />-->
</div>
<div v-else class="rich-main-class">
<div v-html="myValue" />
</div> </div>
<!-- <div v-else class="rich-main-class">-->
<!-- <Editor :id="tinymceId"/>-->
<!-- <div v-html="myValue" />-->
<!-- </div>-->
</template> </template>
...@@ -32,6 +33,10 @@ import 'tinymce/plugins/charmap' // 特殊字符 ...@@ -32,6 +33,10 @@ import 'tinymce/plugins/charmap' // 特殊字符
import 'tinymce/plugins/media' // 插入编辑媒体 import 'tinymce/plugins/media' // 插入编辑媒体
import 'tinymce/plugins/wordcount'// 字数统计 import 'tinymce/plugins/wordcount'// 字数统计
import 'tinymce/plugins/table'// 表格 import 'tinymce/plugins/table'// 表格
import 'tinymce/plugins/contextmenu'// contextmenu
import 'tinymce/plugins/directionality'
import 'tinymce/plugins/nonbreaking'
import 'tinymce/plugins/pagebreak'
import { mapState } from 'vuex' import { mapState } from 'vuex'
// const fonts = [ // const fonts = [
...@@ -93,6 +98,7 @@ export default { ...@@ -93,6 +98,7 @@ export default {
}, },
data() { data() {
return { return {
editShow: true,
canEdit: false, canEdit: false,
// 初始化配置 // 初始化配置
tinymceId: 'tinymce', tinymceId: 'tinymce',
...@@ -104,9 +110,13 @@ export default { ...@@ -104,9 +110,13 @@ export default {
language: 'zh_CN', language: 'zh_CN',
skin_url: '/tinymce/skins/ui/oxide', // 皮肤 skin_url: '/tinymce/skins/ui/oxide', // 皮肤
content_css: '/tinymce/skins/content/default/content.css', content_css: '/tinymce/skins/content/default/content.css',
plugins: 'advlist autolink link image lists charmap media wordcount table', // 插件 plugins: 'advlist autolink link image lists charmap media wordcount table contextmenu directionality pagebreak', // 插件
// 工具栏 // 工具栏
toolbar: 'undo redo | fontsizeselect | bold italic forecolor backcolor| alignleft aligncenter alignright | lists image media table link', // toolbar: 'undo redo | fontsizeselect fontselect | bold italic forecolor backcolor underline strikethrough | alignleft aligncenter alignright | lists image media table link | bullist numlist ',
toolbar: 'undo redo |fontsizeselect forecolor backcolor bold italic underline strikethrough link | ' +
'alignleft aligncenter alignright | bullist numlist |' +
' blockquote subscript superscript removeformat | table image media | fullscreen ' +
'| bdmap indent2em lineheight formatpainter axupimgs',
toolbar_location: '/', toolbar_location: '/',
fontsize_formats: '12px 14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px', // 字体大小 fontsize_formats: '12px 14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px', // 字体大小
menubar: false, menubar: false,
...@@ -128,7 +138,11 @@ export default { ...@@ -128,7 +138,11 @@ export default {
// 监听内容变化 // 监听内容变化
active(val) { active(val) {
if (!val) { if (!val) {
this.editShow = false
this.canEdit = false this.canEdit = false
this.$nextTick(() => {
this.editShow = true
})
} }
}, },
// 监听内容变化 // 监听内容变化
...@@ -148,10 +162,12 @@ export default { ...@@ -148,10 +162,12 @@ export default {
this.$emit('onClick', e, tinymce) this.$emit('onClick', e, tinymce)
}, },
setEdit() { setEdit() {
if (this.editStatus) {
this.canEdit = true this.canEdit = true
this.element.editing = true this.element.editing = true
} }
} }
}
} }
</script> </script>
...@@ -165,5 +181,27 @@ export default { ...@@ -165,5 +181,27 @@ export default {
width: 0px!important; width: 0px!important;
height: 0px!important; height: 0px!important;
} }
::v-deep ol {
display: block!important;
list-style-type: decimal;
margin-block-start: 1em!important;
margin-block-end: 1em!important;
margin-inline-start: 0px!important;
margin-inline-end: 0px!important;
padding-inline-start: 40px!important;
}
::v-deep ul {
display: block!important;
list-style-type: disc;
margin-block-start: 1em!important;
margin-block-end: 1em!important;
margin-inline-start: 0px!important;
margin-inline-end: 0px!important;
padding-inline-start: 40px!important;
}
::v-deep li {
display: list-item!important;
text-align: -webkit-match-parent!important;
}
</style> </style>
...@@ -266,14 +266,7 @@ const list = [ ...@@ -266,14 +266,7 @@ const list = [
hyperlinks: HYPERLINKS, hyperlinks: HYPERLINKS,
style: { style: {
width: 400, width: 400,
height: 100, height: 100
fontSize: 22,
fontWeight: 400,
lineHeight: '',
letterSpacing: 0,
textAlign: 'center',
color: '#000000',
verticalAlign: 'middle'
}, },
x: 1, x: 1,
y: 1, y: 1,
......
...@@ -690,7 +690,13 @@ export default { ...@@ -690,7 +690,13 @@ export default {
this.$store.commit('refreshSnapshot') this.$store.commit('refreshSnapshot')
this.$store.commit('setComponentData', []) this.$store.commit('setComponentData', [])
this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE_STRING) this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE_STRING)
this.$store.dispatch('panel/setPanelInfo', data) this.$store.dispatch('panel/setPanelInfo', {
id: data.id,
name: data.name,
privileges: data.privileges,
sourcePanelName: data.sourcePanelName,
status: data.status
})
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' }) bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
}, },
link(data) { link(data) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论