font.js 452 B

123456789101112131415161718
  1. import { ClassAttributor, Scope, StyleAttributor } from 'parchment';
  2. const config = {
  3. scope: Scope.INLINE,
  4. whitelist: ['serif', 'monospace'],
  5. };
  6. const FontClass = new ClassAttributor('font', 'ql-font', config);
  7. class FontStyleAttributor extends StyleAttributor {
  8. value(node) {
  9. return super.value(node).replace(/["']/g, '');
  10. }
  11. }
  12. const FontStyle = new FontStyleAttributor('font', 'font-family', config);
  13. export { FontStyle, FontClass };