• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

我的博客我做主

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

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
出处:https://www.cnblogs.com/kitty-blog/
本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。

posted on 2020-11-24 18:12  kitty20180903suzhou  阅读(2201)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3