Link: https://support.brilliantdirectories.com/support/solutions/articles/12000100799
In this tutorial, we explore how to customize Froala editors, focusing on adding RTL and LTR options for text direction. For more details, refer to the Froala development page.
In many languages, the text flows either from left to right (LTR) or right to left (RTL), and adjusting the text direction in Froala text editors can be essential for accurately displaying content in these languages.
To customize text direction, follow the steps outlined below:
1. Create a Widget Using the Provided Code
To begin, copy the code provided below:
Then, navigate to Toolbox >> Widget Manager to create a widget using this code.
After creating the widget, copy its shortcode for future use:
2. Customizing the Form
Next, customize the preferred form under Toolbox >> Form Manager. For this example, we will customize the "Feature - Member Articles" form to incorporate the text direction functionality.
Next, add a new form field with the type set to "Custom HTML," and then paste the previously copied widget shortcode into this field.
Important Note: The Database Variable assigned to this field is not important.
Next, click on the gear icon for the Froala Text Editor field and assign a unique "Outer Element ID." Be sure to copy this ID for future use.
3. Customizing the Widget to Refer to the Outer Element ID
To ensure the widget interacts correctly with the form field, open the newly created widget under Widget Manager:
On lines 83 and 89, replace "yourcustomid" with the Outer Element ID assigned to the Froala Text Editor field.
Before:
After:
This is how the end result would look like: