|
1 | 1 | --- |
2 | 2 | sidebar_label: Initialization |
3 | 3 | title: Initialization |
4 | | -description: This guide offers an explanation for initializing DHTMLX Rich Text Editor in three simple steps. |
| 4 | +description: You can learn about the initialization in the documentation of the DHTMLX JavaScript RichText library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX RichText. |
5 | 5 | --- |
6 | 6 |
|
7 | 7 | # Initialization |
8 | 8 |
|
9 | | -The current article will guide you through simple steps you need to take in order to insert a compact text editor into your application. All in all, you should complete just three steps: |
| 9 | +This guide will give you detailed instructions on how to create RichText on a page to enrich your application with features of the RichText editor. Take the following steps to get a ready-to-use component: |
10 | 10 |
|
11 | 11 | 1. [Include the RichText source files on a page](#including-source-files). |
12 | 12 | 2. [Create a container for RichText](#creating-container). |
13 | 13 | 3. [Initialize RichText with the object constructor](#initializing-richtext). |
14 | 14 |
|
15 | | -~~~html |
16 | | -<!DOCTYPE html> |
17 | | -<html> |
18 | | - <head> |
19 | | - <title>How to Start with DHTMLX RichText</title> |
20 | | - <script type="text/javascript" src="./codebase/richtext.js"></script> |
21 | | - <link rel="stylesheet" href="./codebase/richtext.css"> |
22 | | - </head> |
23 | | - <body> |
24 | | - <div id="root"></div> |
25 | | - <script> |
26 | | - // creating DHTMLX RichText |
27 | | - const editor = new richtext.Richtext("#root"); |
28 | | - </script> |
29 | | - </body> |
30 | | -</html> |
31 | | -~~~ |
32 | | - |
33 | 15 | ## Including source files |
34 | 16 |
|
35 | 17 | [Download the package](https://dhtmlx.com/docs/products/dhtmlxRichText/download.shtml) and unpack it into a folder of your project. |
36 | 18 |
|
37 | | -To create dhtmlxRichText, you need to include 2 source files on your page: |
| 19 | +To create RichText, you need to include 2 source files on your page: |
38 | 20 |
|
39 | 21 | - *richtext.js* |
40 | 22 | - *richtext.css* |
41 | 23 |
|
42 | | -Make sure that you set correct relative paths to these files: |
| 24 | +Make sure that you set correct relative paths to the source files: |
43 | 25 |
|
44 | 26 | ~~~html title="index.html" |
45 | 27 | <script type="text/javascript" src="./codebase/richtext.js"></script> |
46 | 28 | <link rel="stylesheet" href="./codebase/richtext.css"> |
47 | 29 | ~~~ |
48 | 30 |
|
49 | | -The structure of the RichText package is the following: |
50 | | - |
51 | | -- **sources** - the source code files of the library; they are easy-to-read and are mostly intended for debugging; |
52 | | -- **codebase** - the obfuscated code files of the library; they are much smaller and intended for use in production. **Include these files in your apps when they are ready**; |
53 | | -- **samples** - the code samples. |
54 | | - |
55 | 31 | ## Creating container |
56 | 32 |
|
57 | | -Add a container for RichText and give it an id, for example "root": |
| 33 | +Add a container for RichText and give it an ID, for example *"root"*: |
58 | 34 |
|
59 | | -~~~html title="index.html" |
| 35 | +~~~jsx title="index.html" |
60 | 36 | <div id="root"></div> |
61 | 37 | ~~~ |
62 | 38 |
|
63 | 39 | ## Initializing RichText |
64 | 40 |
|
65 | | -Initialize RichText with the `richtext.Richtext` object constructor. The constructor has two parameters: |
| 41 | +Initialize RichText with the `richtext.Richtext` constructor. The constructor takes two parameters: |
66 | 42 |
|
67 | | -- the HTML container for RichText. The one we have created at the previous step. |
68 | | -- an object with configuration properties. [See the full list below](#configuration-properties). |
| 43 | +- an HTML container (the ID of the HTML container) |
| 44 | +- an object with configuration properties. [See the full list here](#configuration-properties) |
69 | 45 |
|
70 | 46 | ~~~jsx title="index.html" |
71 | | -// creating RichText |
| 47 | +// create RichText |
72 | 48 | const editor = new richtext.Richtext("#root", { |
73 | 49 | // configuration properties |
74 | 50 | }); |
75 | 51 | ~~~ |
76 | 52 |
|
77 | | -### <span id="config">Configuration properties</span> |
78 | | - |
79 | | -This is a list of properties that you can specify in the RichText configuration object: |
| 53 | +### Configuration properties |
80 | 54 |
|
81 | | -- [**mode**](guides/configuration.md#working-modes) - (string) the working mode of RichText. Can be either `default` or `document` |
82 | | -- [**toolbarBlocks**](guides/configuration.md#toolbar) - (array) specifies blocks of buttons that will be shown in the RichText toolbar |
83 | | -- [**customStats**](guides/configuration.md#custom-statistics-in-the-toolbar) - (array) defines the logic of displaying custom statistics |
| 55 | +:::note |
| 56 | +The full list of properties to configure **RichText** can be found [**here**](/category/richtext-properties/). |
| 57 | +::: |
84 | 58 |
|
85 | | -You can set configuration properties during initialization as the second parameter of the constructor: |
| 59 | +## Example |
86 | 60 |
|
87 | | -~~~jsx |
88 | | -const editor = new richtext.Richtext("#root", { |
89 | | - mode:"document" |
90 | | -}); |
91 | | -~~~ |
| 61 | +In this snippet you can see how to initialize **RichText** with the initial data: |
92 | 62 |
|
93 | | -**Related sample:** [Modes](https://snippet.dhtmlx.com/pdh5buvg) |
| 63 | +<iframe src="https://snippet.dhtmlx.com/tjryzka7?mode=js" frameborder="0" class="snippet_iframe" width="100%" height="500"></iframe> |
0 commit comments