paint-brush
Take these Steps To Change Font In WordPress Text Editorby@froalalabs
526 reads
526 reads

Take these Steps To Change Font In WordPress Text Editor

by Froala LabsJune 8th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

As the World Wide Web has progressed from Web 1.0 to Web 2.0 and is now on its way to Web 3.0, it is more critical than ever to establish an impactful, functional website, a vital tool for personal branding. If you start with that base, you won’t need a complex HTML code editor to help you create HTML code that will power your websites and make them seem professional and appealing.
featured image - Take these Steps To Change Font In WordPress Text Editor
Froala Labs HackerNoon profile picture

As the World Wide Web has progressed from Web 1.0 to Web 2.0 and is now on its way to Web 3.0, it is more critical than ever to establish an impactful, functional website, a vital tool for personal branding.

If you start with that base, you won’t need a complex HTML code editor to help you create HTML code that will power your websites and make them seem professional and appealing.

Most professional web developers utilize WordPress text editors to create and update their websites, including visuals and interactive content. It’s a dream come true to do all of this without writing a single line of code. However, it is practical to employ a Rich-text editor JS to beautify your website. 

The majority of people doubt how to change the font in a WordPress text editor.

If you are one of those people, you don’t need to worry because, in this article, we will discuss the applications and features of the perfect WordPress text editor and the directions to change its font.

Read on to learn more about the best React WYSIWYG HTML editor and how to get started with it.

Why are Custom Fonts Crucial for a Website HTML Editor?

Fonts are integral to your success. Your website is the front page of your services; therefore, it must be interactive and eye-catching.

The font and styling should be so that your services stand apart and are distinct from others. 

As a result, clients and potential buyers are more likely to flock to your shop. Suppose you are looking to style your website and make it look more professional. In that case, your search for the best WYSIWYG JavaScript editor ends here. 

Froala’s Angular WYSIWYG HTML editor is one of the best in business. It offers basic styling options and advanced styling through the integration of plugins.

In addition, Froala enables you to define your style class and therefore customize how the editor's output looks like.

Contrary to popular belief and practice, Froala’s rich text editor angular does not use the

<font>
tag. As a result, you have the ability and control to change font size with pixel precision.

Therefore, you can tailor the size without selecting a size that is too large or too small. 

In addition to this, users can also choose to form the diverse family of fonts available and apply their custom fonts. Above all, users can change the aesthetics according to their liking. They can completely change the text or background color to suit their preference.

How to Change Font in WordPress Text Editor?

It is frustrating to be stuck with the same old and boring font for styling your website. Nobody wants to look at monotonous and evenly spaced out letters anymore; the current dynamic demands that the website is visually appealing through colorful and bold fonts.

To set up a custom font with Froala, you need the font_family.min.js plugin. You must first add the typeface on your website. We’re using four Google fonts in this example: Roboto, Oswald, Montserrat, and Open Sans Condensed.

The fontFamily option is then used to specify which fonts should display in the Font Family menu. This option is an Object with a key that indicates the font name (precisely as the font-family CSS rule, e.g., font-family: ‘Roboto,’ sans-serif;) and a value that reflects the font name in the dropdown list, e.g., Roboto:

<script>
new FroalaEditor('div#froala-editor', {
fontFamily: {
"Roboto,sans-serif": 'Roboto',
"Oswald,sans-serif": 'Oswald',
"Montserrat,sans-serif": 'Montserrat',
"'Open Sans Condensed',sans-serif": 'Open Sans Condensed'
},
fontFamilySelection: true
})
</script>

How to Get Started with Froala Editor?

It is pretty simple to get started with Froala since it offers extensive documentation. Therefore, users can quickly get the editor running in no time.  You begin by installing :

angular-froala-wysiwyg from npm:

npm install angular-froala-wysiwyg

  • After installation, integrate this code inside your HTML file:

<!-- index.html --><link href="node_modules/froala-editor/css/froala_editor.pkgd.min.css" rel="stylesheet">

  • The Froala Editor is quite flexible, and it may be set to ‘attach’ to any standard HTML DOM element, such as a DIV or TEXTAREA. We propose utilizing a DIV element, which you may achieve by following these steps.

<div id="example"></div>

  • The “example” id links the div element to the Froala Editor instance that will be created in the next step.
  • The final step now consists of launching the Froala Editor on our previously created element:

var editor = new FroalaEditor('#example');

  • Congrats, you are done with initializing Froala, the complete code should resemble this:

npm install angular-froala-wysiwyg

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0" />
<link href="node_modules/froala-editor/css/froala_editor.pkgd.min.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="example"></div>

<script type="text/javascript" src="node_modules/froala-editor/js/froala_editor.pkgd.min.js"></script>
<script>
var editor = new FroalaEditor('#example');
</script>
</body>

Also published here.