提交修改

This commit is contained in:
daihh
2022-06-07 16:30:28 +08:00
parent 6f015d61e1
commit 870bc1309a
4 changed files with 86 additions and 116 deletions

View File

@@ -24,6 +24,19 @@ const lineHeightStyle = new lineHeightAttributor("lineHeight", "line-height", {
scope: Parchment.Scope.INLINE,
whitelist: ["1", "1.5", "2", "3", "4"]
});
const toolbarOptions = [
["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
["blockquote", "code-block"], // 引用 代码块
[{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
[{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ size: [false,"18px"] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
[{ align: [] }], // 对齐方式
[{ lineheight: ['initial', '1', '1.5', '2', '3', '4'] }],
["clean"], // 清除文本格式
["link", "image"]
]
Quill.register({ 'formats/lineHeight': lineHeightStyle }, true)
export default {
name: "Editor",
@@ -33,6 +46,10 @@ export default {
type: String,
default: "",
},
toobar:{
type: Boolean,
default: true
},
placeholder: {
type: String,
default: "请输入长度大于100个字符的内容",
@@ -68,19 +85,7 @@ export default {
},
// 工具栏配置
toolbar: {
container:[
["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
["blockquote", "code-block"], // 引用 代码块
[{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
[{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ size: [false,"18px"] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
[{ align: [] }], // 对齐方式
[{ lineheight: ['initial', '1', '1.5', '2', '3', '4'] }],
["clean"], // 清除文本格式
["link", "image"] // 链接、图片、视频, "video"
],
container:this.toobar? toolbarOptions:[],
handlers: {
image: function(value) {
if (value) {