blocknotes/activeadmin_quill_editor

Unable to Add New Fonts in Quill Editor

dilip49 opened this issue · 2 comments

Description:
I've been attempting to add new fonts to the Quill editor, but I'm facing a persistent issue where only the "sans-serif" font is displayed by default. Even when I try to add other fonts, it merely duplicates "sans-serif" in the dropdown menu. I've explored various solutions, including re-configuring the gem, but I haven't been able to resolve the problem.

Code snippet:

f.input :description, as: :quill_editor, input_html: {
        value: strip_tags(f.object.description),
        class: 'quill_text',
        data: {
          options: {
            modules: {
              toolbar: [
                ['bold', 'italic', 'underline'],
                ['link'],
                [{ 'font': ['Source Sans Pro', 'sans-serif'] }]
              }
            },
            formats: ['bold', 'italic', 'underline', 'link', 'font']
          }
        }
      }

Screenshot:
Screenshot 2023-09-07 at 12 13 36 AM

Additional Information:
Gem Version: activeadmin_quill_editor (1.0.0)

This appears to be a potential issue, and I'd greatly appreciate any assistance in resolving it. Thank you in advance for your help.

Hi @dilip49,
thank you for your issue.

After some checks, it doesn't look like an issue related to activeadmin_quill_editor gem.

If you try with: [{ 'font': [] }] - you should get:

image

If you try with: [{ 'font': %w[sans-serif arial serif] }] - you should get:

image

I think that you need to register the custom fonts as proposed in the Quill docs (they aren't very clear perhaps, but there are some examples in Stackoverflow):
https://quilljs.com/guides/how-to-customize-quill/#customizing-attributors

I'm closing the issue