How to remove or change the default font in quill.js?

by ryan.murray , in category: Javascript , 8 months ago

How to remove or change the default font in quill.js?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by orpha , 8 months ago

@ryan.murray 

To remove or change the default font in Quill.js, you can use the following steps:

  1. Change the default font:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var quill = new Quill('#editor', {
  theme: 'snow',
  formats: ['bold', 'italic', 'underline', 'strike'],
  toolbar: {
    container: '#toolbar'
  }
});

quill.getModule('toolbar').addHandler('font', function(value) {
  this.quill.format('font', value);
});

quill.on('text-change', function(delta, oldDelta, source) {
  if (source == 'user') {
    // Save your changes here
  }
});


  1. Remove the default font:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var quill = new Quill('#editor', {
  theme: 'snow',
  formats: ['bold', 'italic', 'underline', 'strike'],
  toolbar: {
    container: '#toolbar'
  }
});

quill.getModule('toolbar').addHandler('font', function() {
  this.quill.format('font', false);
});

quill.on('text-change', function(delta, oldDelta, source) {
  if (source == 'user') {
    // Save your changes here
  }
});


By following these steps, you can change or remove the default font in Quill.js.

Related Threads:

How to remove default placeholder link from quill.js?
How to change the font family in an iframe?
How to change font size on main menu in wordpress?
How to remove default styles in storybook?
How to remove default storybook canvas styles?
How to change the default theme of phpMyAdmin?