[update 89966] 富文本组件:去掉不能用的功能、解决火狐浏览器格式刷异常、解决显示错位
This commit is contained in:
@@ -1566,8 +1566,8 @@ div.edui-box {
|
||||
float: right;
|
||||
margin-right: 1px;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
height: 14px;
|
||||
line-height: 12px;
|
||||
height: 20px;
|
||||
border: 1px solid #333;
|
||||
padding: 3px 5px;
|
||||
cursor: pointer;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -43,6 +43,7 @@
|
||||
}
|
||||
|
||||
.CodeMirror-wrap pre {
|
||||
overflow: hidden;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
@@ -146,31 +146,31 @@
|
||||
|
||||
//insertorderedlist
|
||||
//有序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
|
||||
//,'insertorderedlist':{
|
||||
// //自定的样式
|
||||
// 'num':'1,2,3...',
|
||||
// 'num1':'1),2),3)...',
|
||||
// 'num2':'(1),(2),(3)...',
|
||||
// 'cn':'一,二,三....',
|
||||
// 'cn1':'一),二),三)....',
|
||||
// 'cn2':'(一),(二),(三)....',
|
||||
// //系统自带
|
||||
// 'decimal' : '' , //'1,2,3...'
|
||||
// 'lower-alpha' : '' , // 'a,b,c...'
|
||||
// 'lower-roman' : '' , //'i,ii,iii...'
|
||||
// 'upper-alpha' : '' , lang //'A,B,C'
|
||||
// 'upper-roman' : '' //'I,II,III...'
|
||||
//}
|
||||
,'insertorderedlist':{
|
||||
//自定的样式
|
||||
// 'num':'1,2,3...',
|
||||
// 'num1':'1),2),3)...',
|
||||
// 'num2':'(1),(2),(3)...',
|
||||
// 'cn':'一,二,三....',
|
||||
// 'cn1':'一),二),三)....',
|
||||
// 'cn2':'(一),(二),(三)....',
|
||||
//系统自带
|
||||
'decimal' : '' , //'1,2,3...'
|
||||
'lower-alpha' : '' , // 'a,b,c...'
|
||||
'lower-roman' : '' , //'i,ii,iii...'
|
||||
'upper-alpha' : '' , //'A,B,C'
|
||||
'upper-roman' : '' //'I,II,III...'
|
||||
}
|
||||
|
||||
//insertunorderedlist
|
||||
//无序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
|
||||
//,insertunorderedlist : { //自定的样式
|
||||
// 'dash' :'— 破折号', //-破折号
|
||||
// 'dot':' 。 小圆圈', //系统自带
|
||||
// 'circle' : '', // '○ 小圆圈'
|
||||
// 'disc' : '', // '● 小圆点'
|
||||
// 'square' : '' //'■ 小方块'
|
||||
//}
|
||||
,insertunorderedlist : { //自定的样式
|
||||
// 'dash' :'— 破折号', //-破折号
|
||||
// 'dot':' 。 小圆圈', //系统自带
|
||||
'circle' : '', // '○ 小圆圈'
|
||||
'disc' : '', // '● 小圆点'
|
||||
'square' : '' //'■ 小方块'
|
||||
}
|
||||
//,listDefaultPaddingLeft : '30'//默认的左边缩进的基数倍
|
||||
//,listiconpath : 'http://bs.baidu.com/listicon/'//自定义标号的路径
|
||||
//,maxListLevel : 3 //限制可以tab的级数, 设置-1为不限制
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<script id="editor" type="text/plain" ></script>
|
||||
<div ref="editorBoxRef">
|
||||
<script :id="id" type="text/plain" ></script>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -35,11 +35,22 @@ export default {
|
||||
},
|
||||
getContentLength () {
|
||||
return this.editor.getContentLength()
|
||||
},
|
||||
// 解决火狐浏览器失去焦点后,下次获取焦点,会保留上次光标位置导致格式刷异常
|
||||
editorBlur (e) {
|
||||
// e.preventDefault()
|
||||
e.target.blur()
|
||||
this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.blur()
|
||||
setTimeout(() => {
|
||||
this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.blur()
|
||||
this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.focus()
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: String
|
||||
type: String,
|
||||
default: 'editor'
|
||||
},
|
||||
config: {
|
||||
type: Object
|
||||
@@ -74,27 +85,33 @@ export default {
|
||||
}
|
||||
UEDITOR_CONFIG.UEDITOR_HOME_URL = '../../../public/ueditor/'
|
||||
// 初始化UE
|
||||
this.editor = UE.delEditor('editor')
|
||||
this.editor = UE.getEditor('editor', this.config)
|
||||
this.editor = UE.delEditor(this.id)
|
||||
this.editor = UE.getEditor(this.id, this.config)
|
||||
const _this = this
|
||||
UE.getEditor('editor').addListener('blur', function (editor) {
|
||||
UE.getEditor(this.id).addListener('blur', function (editor) {
|
||||
_this.$emit('editor-onChange', _this.getUEContent())
|
||||
})
|
||||
UE.getEditor('editor').ready(function () {
|
||||
UE.getEditor(this.id).ready(() => {
|
||||
console.log('aaa', UE.getEditor(this.id))
|
||||
// 火狐浏览器格式刷会有问题,让页面失去焦点解决该问题
|
||||
UE.getEditor(this.id).body.addEventListener('blur', this.editorBlur)
|
||||
if (_this.fontfamily !== '') {
|
||||
UE.getEditor('editor').execCommand('fontfamily', _this.fontfamily)
|
||||
UE.getEditor(this.id).execCommand('fontfamily', _this.fontfamily)
|
||||
}
|
||||
if (_this.content !== '') {
|
||||
UE.getEditor('editor').setContent(_this.content)
|
||||
UE.getEditor(this.id).setContent(_this.content)
|
||||
}
|
||||
if (_this.fontsize !== '') {
|
||||
UE.getEditor('editor').execCommand('fontsize', _this.fontsize)
|
||||
UE.getEditor(this.id).execCommand('fontsize', _this.fontsize)
|
||||
}
|
||||
if (_this.bold) {
|
||||
UE.getEditor('editor').execCommand('bold')
|
||||
UE.getEditor(this.id).execCommand('bold')
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeDestroy () {
|
||||
UE.getEditor(this.id).removeEventListener('blur', this.editorBlur)
|
||||
},
|
||||
destoryed () {
|
||||
this.editor.destory()
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@ export default {
|
||||
'unlink', // 取消链接
|
||||
// 'background', // 背景
|
||||
// 'simpleupload', // 单图上传
|
||||
'imagenone', // 默认
|
||||
'imageleft', // 左浮动
|
||||
'imageright', // 右浮动
|
||||
'imagecenter', // 居中
|
||||
// 'imagenone', // 默认
|
||||
// 'imageleft', // 左浮动
|
||||
// 'imageright', // 右浮动
|
||||
// 'imagecenter', // 居中
|
||||
'touppercase', // 字母大写
|
||||
'tolowercase', // 字母小写
|
||||
'emotion', // 表情
|
||||
@@ -81,8 +81,8 @@ export default {
|
||||
'insertunorderedlist', // 无序列表
|
||||
'insertorderedlist', // 有序列表
|
||||
'pagebreak', // 分页
|
||||
'insertframe', // 插入Iframe
|
||||
'charts', // 图表
|
||||
// 'insertframe', // 插入Iframe
|
||||
// 'charts', // 图表
|
||||
'edittip ', // 编辑提示
|
||||
'autotypeset', // 自动排版
|
||||
'drafts', // 从草稿箱加载
|
||||
|
||||
@@ -166,10 +166,10 @@ export default {
|
||||
'unlink', // 取消链接
|
||||
// 'background', // 背景
|
||||
// 'simpleupload', // 单图上传
|
||||
'imagenone', // 默认
|
||||
'imageleft', // 左浮动
|
||||
'imageright', // 右浮动
|
||||
'imagecenter', // 居中
|
||||
// 'imagenone', // 默认
|
||||
// 'imageleft', // 左浮动
|
||||
// 'imageright', // 右浮动
|
||||
// 'imagecenter', // 居中
|
||||
'touppercase', // 字母大写
|
||||
'tolowercase', // 字母小写
|
||||
'emotion', // 表情
|
||||
@@ -178,8 +178,8 @@ export default {
|
||||
'insertunorderedlist', // 无序列表
|
||||
'insertorderedlist', // 有序列表
|
||||
'pagebreak', // 分页
|
||||
'insertframe', // 插入Iframe
|
||||
'charts', // 图表
|
||||
// 'insertframe', // 插入Iframe
|
||||
// 'charts', // 图表
|
||||
'edittip ', // 编辑提示
|
||||
'autotypeset', // 自动排版
|
||||
'drafts', // 从草稿箱加载
|
||||
|
||||
Reference in New Issue
Block a user