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