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     },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM