question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I preset a default font style for newly entered text?

See original GitHub issue

Example: I expect the newly entered text to be <p><span style="font-size: 14px; font-family: Microsoft YaHei;">some text</span></p>, not <p>some text</p>.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

6reactions
dmitrybndarcommented, Jun 29, 2020

@gagan-lokesh oh, it was 4 month ago 😃 I found then some workaround (for my case). Just looked at my code and grab this part from it, maybe it helps you.

const BlockPrototype = Quill.import("blots/block");

class CustomBlock extends BlockPrototype {
  constructor(domNode, value) {
    super(domNode, value);
    this.format("size", "18px");
  }

  static tagName = "P";

  format(name, value) {
    if (name === "size") {
      this.domNode.style.fontSize = value;
    } else {
      super.format(name, value);
    }
  }
}

Quill.register(CustomBlock, true);
4reactions
udittehricommented, Aug 24, 2021

Simply change change CSS you want in this class

.ql-editor {
  padding: 12px 0;
  font-size: 18px;
}

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set a default font type for adding text - Foxit Software
To set a default font type for adding new texts in PDF file by using Add Text, choose a font type to input...
Read more >
Change the default font in Word - Microsoft Support
Change the default font in Word · Go to Home, and then select the Font Dialog Box Launcher Button image . · Select...
Read more >
Change the Default Font in Google Sheets (3 Easy Ways)
Most word processors and spreadsheet software come with their own default fonts. Most of the time it is either the 'Arial' or 'Calibri'...
Read more >
Set a default font in Pages on Mac - Apple Support
For other templates, you can set your own fonts for paragraph styles, then save the template as a custom template. The next time...
Read more >
Change preset font - Create - Prezi Community
@Simon_Noakes Yes, you can change the default to be the same every time you choose it in the future. There's that drop down...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found