Quill 自定义行高功能

2,324 阅读1分钟
const Parchment = Quill.import('parchment') 
const lineHeightWhiteList = ['1', '1.5', '2', '2.5', '3'] 
 
class LineHeightAttributor extends Parchment.Attributor.Style {} 
 
const lineHeightStyle = new LineHeightAttributor( 
 'lineheight', 
 'line-height', 
 { 
 scope: Parchment.Scope.BLOCK, 
 whitelist: lineHeightWhiteList 
 } 
) 
 
Quill.register({'formats/lineHeight': lineHeightStyle}, true)