vue-quill-editor 注册行高样式
lineHeight.js:
1 import Quill from "quill"; 2 let Parchment = Quill.import("parchment"); 3 console.log(Parchment); 4 class lineHeightAttributor extends Parchment.Attributor.Style {} 5 const lineHeightStyle = new lineHeightAttributor("lineHeight", "line-height", { 6 scope: Parchment.Scope.INLINE, 7 whitelist: ["initial", "1", "1.5", "1.75", "2", "3", "4"] 8 }); 9 10 export { lineHeightStyle };
使用时引入
import { lineHeightStyle } from "@/utils/lineheight";
quillEditor 组件 ready 事件中调用:(更详细的在上一节)
1 <quill-editor 2 @ready="ready($event)" 3 > 4 </quill-editor>
ready:
1 ready() { 2 Quill.register({ "formats/lineHeight": lineHeightStyle }, true); 3 },
作者:胡倩倩0903
本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。
posted on 2020-11-24 18:12 kitty20180903suzhou 阅读(2201) 评论(0) 收藏 举报