Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
43cc851b
提交
43cc851b
authored
2月 15, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 富文本编辑器合并
上级
6a32d9ef
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
61 行增加
和
13 行删除
+61
-13
imageUpload.js
src/components/tinymce/imageUpload.js
+12
-0
index.vue
src/components/tinymce/index.vue
+49
-13
没有找到文件。
src/components/tinymce/imageUpload.js
0 → 100644
浏览文件 @
43cc851b
import
{
uploadFile
}
from
'@/api/common'
export
default
function
(
blobInfo
,
succFun
,
failFun
)
{
const
file
=
blobInfo
.
blob
()
uploadFile
({
file
})
.
then
(
response
=>
{
response
.
success
?
succFun
(
response
.
url
)
:
failFun
(
response
.
message
)
})
.
catch
(
response
=>
{
failFun
(
response
.
message
)
})
}
src/components/tinymce/index.vue
浏览文件 @
43cc851b
<
template
>
<
template
>
<editor
v-bind=
"options
"
/>
<editor
:init=
"init"
v-bind=
"$attrs"
v-on=
"$listeners"
@
onChange=
"onChange"
@
onBlur=
"onBlur
"
/>
</
template
>
</
template
>
<
script
>
<
script
>
import
Editor
from
'@tinymce/tinymce-vue'
import
Editor
from
'@tinymce/tinymce-vue'
import
ImageUpload
from
'./imageUpload'
export
default
{
export
default
{
components
:
{
components
:
{
editor
:
Editor
editor
:
Editor
},
},
data
()
{
data
()
{
return
{
return
{
options
:
{
init
:
{
init
:
{
min_height
:
300
,
min_height
:
300
,
max_height
:
500
,
max_height
:
500
,
menubar
:
false
,
menubar
:
false
,
language
:
this
.
$i18n
.
locale
.
replace
(
'-'
,
'_'
),
language
:
this
.
$i18n
.
locale
.
replace
(
'-'
,
'_'
),
branding
:
false
,
branding
:
false
,
plugins
:
'wordcount table autoresize charmap fullscreen hr lists link code preview quickbars indent2em paste'
,
plugins
:
'wordcount table autoresize charmap code fullscreen hr lists codesample'
,
paste_data_images
:
true
,
toolbar
:
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'
,
'removeformat | undo redo | styleselect fontselect fontsizeselect lineheight bold italic underline strikethrough forecolor backcolor | link quickimage image media table | align hangingindent indent2em indent outdent numlist bullist | charmap blockquote hr fullscreen | code preview'
,
fontsize_formats
:
'12px 14px 15px 16px 17px 18px 20px 24px'
,
font_formats
:
lineheight_formats
:
'0.5 1 1.2 1.5 2'
'微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Times New Roman'
,
fontsize_formats
:
'8pt 10pt 12pt 14pt 15pt 16pt 17pt 18pt 20pt 24pt'
,
lineheight_formats
:
'0.5 1 1.2 1.5 2'
,
images_upload_handler
:
ImageUpload
,
automatic_uploads
:
true
,
quickbars_insert_toolbar
:
false
,
style_formats
:
[{
title
:
'悬挂缩进'
,
block
:
'p'
,
styles
:
{
textIndent
:
'-2em'
,
paddingLeft
:
'2em'
}
}],
content_style
:
'img {max-width:100%;}'
}
}
},
methods
:
{
onChange
(
event
,
editor
)
{
this
.
dispatch
(
'ElFormItem'
,
'el.form.change'
,
editor
.
getContent
())
},
onBlur
(
event
,
editor
)
{
this
.
dispatch
(
'ElFormItem'
,
'el.form.blur'
,
editor
.
getContent
())
},
dispatch
(
componentName
,
eventName
,
params
)
{
var
parent
=
this
.
$parent
||
this
.
$root
var
name
=
parent
.
$options
.
componentName
while
(
parent
&&
(
!
name
||
name
!==
componentName
))
{
parent
=
parent
.
$parent
if
(
parent
)
{
name
=
parent
.
$options
.
componentName
}
}
}
}
if
(
parent
)
{
parent
.
$emit
.
apply
(
parent
,
[
eventName
].
concat
(
params
))
}
}
}
}
}
}
}
</
script
>
</
script
>
<
style
>
.tox
.tox-tbtn--bespoke
.tox-tbtn__select-label
{
width
:
4em
!important
;
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论