diff --git a/docs/guides/configuration.md b/docs/guides/configuration.md index f782c3a..d81b47c 100644 --- a/docs/guides/configuration.md +++ b/docs/guides/configuration.md @@ -6,19 +6,20 @@ description: You can learn about the configuration in the documentation of the D # Configuration -You can configure RichText appearance and functionality via the corresponding API. The available parameters will allow you to: +Configure RichText appearance and functionality with the following properties: -- Show/hide **menubar** using the [`menubar`](api/config/menubar.md) property -- Configure **toolbar** using the [`toolbar`](api/config/toolbar.md) property -- Enable the **fullscreen mode** using the [`fullscreenMode`](api/config/fullscreen-mode.md) property -- Toggle the **layout** between "classic" and "document" modes using the [`layoutMode`](api/config/layout-mode.md) property -- Specify **initial value** using the [`value`](api/config/value.md) property -- Specify **initial locale** using the [`locale`](api/config/locale.md) property -- Apply **initial styles** using the [`defaultStyles`](api/config/default-styles.md) property +- [`menubar`](api/config/menubar.md) — show or hide the top menubar +- [`toolbar`](api/config/toolbar.md) — configure toolbar buttons +- [`fullscreenMode`](api/config/fullscreen-mode.md) — start the editor in fullscreen mode +- [`layoutMode`](api/config/layout-mode.md) — toggle between "classic" and "document" layout +- [`value`](api/config/value.md) — set the initial editor content +- [`locale`](api/config/locale.md) — set the initial locale +- [`defaultStyles`](api/config/default-styles.md) — apply default styles to block types +- [`imageUploadUrl`](api/config/image-upload-url.md) — specify the URL for image uploads -## Layout modes +## Set the layout mode -There are two layout modes of RichText editor between which you can select to get the best working place for creating your perfect content: +RichText supports two layout modes. Select the mode that best fits your workflow: - **"classic"** @@ -32,7 +33,7 @@ There are two layout modes of RichText editor between which you can select to ge ![Document mode](./../assets/richtext/document_mode.png) -To specify the desired mode, you need to define it in the [`layoutMode`](api/config/layout-mode.md) property of the RichText configuration object during initialization of the component: +Set the [`layoutMode`](api/config/layout-mode.md) property to `"document"` or `"classic"` during initialization: ~~~jsx const editor = new richtext.Richtext("#root", { @@ -40,13 +41,13 @@ const editor = new richtext.Richtext("#root", { }); ~~~ -## Toolbar +## Configure the toolbar -The RichText toolbar consists of several blocks of controls that can be changed according to your needs. +The RichText toolbar consists of several blocks of controls. Customize the toolbar to match your needs. -### Default toolbar controls +### Default controls -You can specify the following buttons and controls in the RichText toolbar: +Use the following string values to specify buttons in the [`toolbar`](api/config/toolbar.md) property: | Button | Description | |---------------------|-----------------------------------------------------------------------------| @@ -76,11 +77,11 @@ You can specify the following buttons and controls in the RichText toolbar: | `clear` | Removes all formatting from the selected text | | `print` | Opens the print dialog | | `fullscreen` | Toggles fullscreen mode | -| `mode` | Switches between 2 view modes: Classic/ Document | +| `mode` | Switches between 2 view modes: Classic / Document | | `shortcuts` | Displays a list of available keyboard shortcuts | | `separator` | Adds a visual separator between controls | -The toolbar structure is defined using the [`toolbar`](api/config/toolbar.md) property, which is an array with strings presenting the names of controls. +Define the toolbar structure with the [`toolbar`](api/config/toolbar.md) property. Pass an array of button name strings: ~~~jsx {2-36} new richtext.Richtext("#root", { @@ -125,16 +126,18 @@ new richtext.Richtext("#root", { **Related sample:** [RichText. Custom control and simplified toolbar](https://snippet.dhtmlx.com/wda202ih?tag=richtext) -### Custom toolbar controls +### Add custom controls -You can also specify custom controls as objects in the [`toolbar`](api/config/toolbar.md) property with the following parameters: +Add custom controls to the toolbar as objects in the [`toolbar`](api/config/toolbar.md) property. Each custom control supports the following parameters: -- `type` - (required) specifies a custom control type. The following types are available: `"button"`, `"richselect"`, `"colorpicker"` -- `id` - (optional) a custom control ID (cannot overlap with existing control ID) -- `label` - (optional) a button label (combines with icon) -- `tooltip` - (optional) a tooltip displayed on hover (if not specified, uses the value from "label") -- `css` - (optional) a css class name assigned to the control (default supported classes: wx-primary, wx-secondary) -- `handler` - (optional) a callback function that executes when the button is clicked +- `type` — (required) custom control type; available values: `"button"`, `"richselect"`, `"colorpicker"` +- `id` — (optional) control ID; cannot overlap with existing control IDs +- `label` — (optional) button label; combines with icon +- `tooltip` — (optional) tooltip shown on hover; uses `label` value if not specified +- `css` — (optional) CSS class name; default supported classes: `wx-primary`, `wx-secondary` +- `handler` — (optional) callback function executed on button click + +The following code snippet adds both predefined and custom controls to the toolbar: ~~~jsx {6-32} new richtext.Richtext("#root", { @@ -176,9 +179,26 @@ new richtext.Richtext("#root", { **Related sample:** [RichText. Custom control and simplified toolbar](https://snippet.dhtmlx.com/wda202ih?tag=richtext) -### Hide Toolbar +Use `richtext.defaultToolbarButtons` to extend the default toolbar without rewriting the full button list: -If you need to hide toolbar, set the [`toolbar`](api/config/toolbar.md) property to `false` as follows: +~~~jsx {4} +new richtext.Richtext("#root", { + toolbar: [ + ...richtext.defaultToolbarButtons, + { + type: "button", + id: "btn1", + icon: "wxo-help", + label: "Help", + } + ] + // other configuration properties +}); +~~~ + +### Hide the toolbar + +Set the [`toolbar`](api/config/toolbar.md) property to `false` to hide the toolbar: ~~~jsx {2} new richtext.Richtext("#root", { @@ -187,9 +207,44 @@ new richtext.Richtext("#root", { }); ~~~ -## Default styles +## Enable the menubar -You can apply default style values for specific block types in the editor using the [`defaultStyles`](api/config/default-styles.md) property. +Use the [`menubar`](api/config/menubar.md) property to show the top menubar with File, Edit, View, and other menus. + +~~~jsx {2} +new richtext.Richtext("#root", { + menubar: true, + // other configuration properties +}); +~~~ + +## Enable fullscreen mode + +Use the [`fullscreenMode`](api/config/fullscreen-mode.md) property to start the editor in fullscreen mode. + +~~~jsx {2} +new richtext.Richtext("#root", { + fullscreenMode: true, + // other configuration properties +}); +~~~ + +## Set the initial value + +Use the [`value`](api/config/value.md) property to preload content into the editor on initialization. + +~~~jsx {2} +new richtext.Richtext("#root", { + value: "

Hello, world!

Start editing...

" + // other configuration properties +}); +~~~ + +## Set default styles + +Use the [`defaultStyles`](api/config/default-styles.md) property to apply initial style values to specific block types. + +The following type signature shows the supported block types and style properties: ~~~jsx {} defaultStyles?: boolean | { @@ -250,13 +305,13 @@ defaultStyles?: boolean | { }; ~~~ -The `defaultStyles` property DOES NOT set the actual CSS to the affected blocks. CSS styles have to be applied separately: +The `defaultStyles` property does not apply CSS to the affected blocks. Apply CSS separately: -```html title="index.html" +~~~html title="index.html"
-``` +~~~ -```jsx {2-9} title="index.js" +~~~jsx {2-9} title="index.js" const editor = new richtext.Richtext("#root", { defaultStyles: { h2: { @@ -267,17 +322,30 @@ const editor = new richtext.Richtext("#root", { } } }); -``` +~~~ -```css title="index.css" +~~~css title="index.css" #root h2 { font-family: Roboto; font-size: 28px; color: purple; background: #FFC0CB; } -``` +~~~ -In this example, all `h2` blocks are assigned to the `"Roboto"` font-family with a font-size of 28px with both the foreground and the background colors changed as well. Css styles are assigned to `h2` blocks as well. +This example assigns the `"Roboto"` font, 28px size, and custom colors to all `h2` blocks. The CSS applies the same values at the DOM level. **Related sample:** [RichText. Changing the default value for typography (font, font size, etc.)](https://snippet.dhtmlx.com/6u3ti01s?tag=richtext) + +## Set image upload URL + +Use the [`imageUploadUrl`](api/config/image-upload-url.md) property to specify the server URL for image uploads. + +The following code snippet configures the URL for uploading images inserted through the toolbar: + +~~~jsx {2} +new richtext.Richtext("#root", { + imageUploadUrl: "https://example.com/upload" + // other configuration properties +}); +~~~ diff --git a/docs/guides/initialization.md b/docs/guides/initialization.md index a43bf9e..0acd780 100644 --- a/docs/guides/initialization.md +++ b/docs/guides/initialization.md @@ -6,45 +6,47 @@ description: You can learn about the initialization in the documentation of the # Initialization -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: +Follow these steps to add RichText to your page: -1. [Include the RichText source files on a page](#including-source-files). -2. [Create a container for RichText](#creating-container). -3. [Initialize RichText with the object constructor](#initializing-richtext). +1. [Include the RichText source files on a page](#include-source-files). +2. [Create a container for RichText](#create-a-container). +3. [Initialize RichText with the object constructor](#initialize-richtext). -## Including source files +## Include source files [Download the package](https://dhtmlx.com/docs/products/dhtmlxRichText/download.shtml) and unpack it into a folder of your project. -To create RichText, you need to include 2 source files on your page: +Include two source files on your page: - *richtext.js* - *richtext.css* -Make sure that you set correct relative paths to the source files: +Set correct relative paths to the source files: ~~~html title="index.html" ~~~ -## Creating container +## Create a container -Add a container for RichText and give it an ID, for example *"root"*: +Add a container element with an ID, for example *"root"*: ~~~jsx title="index.html"
~~~ -## Initializing RichText +## Initialize RichText -Initialize RichText with the `richtext.Richtext` constructor. The constructor takes two parameters: +Use the `richtext.Richtext` constructor to initialize RichText. The constructor takes two parameters: - an HTML container (the ID of the HTML container) - an object with configuration properties. [See the full list here](#configuration-properties) -~~~jsx title="index.html" -// create RichText +The following code snippet initializes RichText in the *"root"* container: + +~~~jsx title="index.js" +// initialize RichText const editor = new richtext.Richtext("#root", { // configuration properties }); @@ -53,11 +55,11 @@ const editor = new richtext.Richtext("#root", { ### Configuration properties :::note -The full list of properties to configure **RichText** can be found [**here**](api/overview/properties_overview.md). +The full list of properties to configure RichText can be found [here](api/overview/properties_overview.md). ::: ## Example -In this snippet you can see how to initialize **RichText** with the initial data: +The snippet below initializes RichText with initial data: diff --git a/docs/guides/integration_with_angular.md b/docs/guides/integration_with_angular.md index 5525455..890e063 100644 --- a/docs/guides/integration_with_angular.md +++ b/docs/guides/integration_with_angular.md @@ -12,33 +12,33 @@ You should be familiar with basic concepts and patterns of **Angular** before re DHTMLX RichText is compatible with **Angular**. We have prepared code examples on how to use DHTMLX RichText with **Angular**. For more information, refer to the corresponding [**Example on GitHub**](https://github.com/DHTMLX/angular-richtext-demo). -## Creating a project +## Create a project :::info Before you start to create a new project, install [**Angular CLI**](https://v17.angular.io/cli) and [**Node.js**](https://nodejs.org/en/). ::: -Create a new **my-angular-richtext-app** project using Angular CLI. Run the following command for this purpose: +Create a new **my-angular-richtext-app** project using Angular CLI. Run the following command: ~~~json ng new my-angular-richtext-app ~~~ :::note -If you want to follow this guide, disable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) when creating new Angular app! +If you want to follow this guide, disable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) when creating new Angular app. ::: -The command above installs all the necessary tools, so you don't need to run any additional commands. +This command installs all necessary tools. No additional commands are required. -### Installation of dependencies +### Install dependencies -Go to the new created app directory: +Go to the newly created app directory: ~~~json cd my-angular-richtext-app ~~~ -Install dependencies and start the dev server. For this, use the [**yarn**](https://yarnpkg.com/) package manager: +Install dependencies and start the dev server. Use the [**yarn**](https://yarnpkg.com/) package manager: ~~~json yarn @@ -47,21 +47,21 @@ yarn start The app should run on a localhost (for instance `http://localhost:3000`). -## Creating RichText +## Create RichText -Now you should get the DHTMLX RichText source code. First of all, stop the app and proceed with installing the RichText package. +Get the DHTMLX RichText source code. Stop the dev server, then install the RichText package. ### Step 1. Package installation -Download the [**trial RichText package**](/how_to_start/#installing-richtext-via-npm-or-yarn) and follow steps mentioned in the README file. Note that trial RichText is available 30 days only. - +Download the [**trial RichText package**](/how_to_start/#installing-richtext-via-npm-or-yarn) and follow steps mentioned in the README file. Note that the trial version is available for 30 days only. + ### Step 2. Component creation -Now you need to create an Angular component, to add Richtext into the application. Create the **richtext** folder in the **src/app/** directory, add a new file into it and name it **richtext.component.ts**. +Create an Angular component to add RichText to the application. Create the *richtext* folder in the *src/app/* directory, then add a new file named *richtext.component.ts*. #### Import source files -Open the **richtext.component.ts** file and import RichText source files. Note that: +Open *richtext.component.ts* and import RichText source files. Note that: - if you use PRO version and install the RichText package from a local folder, the imported path looks like this: @@ -77,9 +77,9 @@ import { Richtext} from '@dhx/trial-richtext'; In this tutorial you can see how to configure the **trial** version of RichText. -#### Set containers and initialize the Richtext +#### Set up the container and initialize RichText -To display RichText on the page, you need to set a container for RichText, and initialize the component using the corresponding constructor: +To display RichText on the page, set a container for RichText and initialize the component with the `Richtext` constructor: ~~~jsx {} title="richtext.component.ts" import { Richtext} from '@dhx/trial-richtext'; @@ -111,9 +111,9 @@ export class RichTextComponent implements OnInit, OnDestroy { } ~~~ -#### Adding styles +#### Add styles -To display RichText correctly, you need to provide the corresponding styles. For this purpose, you can create the **richtext.component.css** file in the **src/app/richtext/** directory and specify important styles for RichText and its container: +To display RichText correctly, provide the corresponding styles. Create *richtext.component.css* in the *src/app/richtext/* directory and specify styles for RichText and its container: ~~~css title="richtext.component.css" /* import RichText styles */ @@ -139,9 +139,9 @@ body{ } ~~~ -#### Loading data +#### Load data -To add data into RichText, you need to provide a data set. You can create the **data.ts** file in the **src/app/richtext/** directory and add some data into it: +To add data, provide a data set. Create *data.ts* in the *src/app/richtext/* directory and add some data: ~~~jsx {} title="data.ts" export function getData() { @@ -153,7 +153,7 @@ export function getData() { } ~~~ -Then open the ***richtext.component.ts*** file. Import the file with data and specify the corresponding data properties to the configuration object of RichText within the `ngOnInit()` method, as shown below: +Open *richtext.component.ts*, import the data file, and pass data properties to the RichText configuration object inside `ngOnInit()`: ~~~jsx {} title="richtext.component.ts" import { Richtext} from '@dhx/trial-richtext'; @@ -188,7 +188,7 @@ export class RichTextComponent implements OnInit, OnDestroy { } ~~~ -You can also use the [`setValue()`](api/methods/set-value.md) method inside the `ngOnInit()` method of Angular to load data into RichText. +You can also use the [`setValue()`](api/methods/set-value.md) method inside `ngOnInit()` to load data into RichText: ~~~jsx {} title="richtext.component.ts" import { Richtext} from '@dhx/trial-richtext'; @@ -225,13 +225,13 @@ export class RichTextComponent implements OnInit, OnDestroy { } ~~~ -Now the RichText component is ready to use. When the element will be added to the page, it will initialize the RichText with data. You can provide necessary configuration settings as well. Visit our [RichText API docs](api/overview/main_overview.md) to check the full list of available properties. +The RichText component is ready. When the element is added to the page, RichText initializes with data. Visit our [RichText API docs](api/overview/main_overview.md) to check the full list of available properties. -#### Handling events +#### Handle events -When a user makes some action in the RichText, it invokes an event. You can use these events to detect the action and run the desired code for it. See the [full list of events](api/overview/events_overview.md). +When a user performs an action in RichText, the component fires an event. Use these events to detect the action and run the desired code. See the [full list of events](api/overview/events_overview.md). -Open the **richtext.component.ts** file and complete the `ngOnInit()` method in the following way: +Open *richtext.component.ts* and complete the `ngOnInit()` method: ~~~jsx {} title="richtext.component.ts" // ... @@ -248,9 +248,9 @@ ngOnDestroy(): void { } ~~~ -### Step 3. Adding RichText into the app +### Step 3. Add RichText to the app -To add the ***RichTextComponent*** component into your app, open the ***src/app/app.component.ts*** file and replace the default code with the following one: +To add the *RichTextComponent* component to your app, open *src/app/app.component.ts* and replace the default code: ~~~jsx {} title="app.component.ts" import { Component } from "@angular/core"; @@ -264,7 +264,7 @@ export class AppComponent { } ~~~ -Then create the ***app.module.ts*** file in the ***src/app/*** directory and specify the *RichTextComponent* as shown below: +Create *app.module.ts* in the *src/app/* directory and specify the *RichTextComponent*: ~~~jsx {} title="app.module.ts" import { NgModule } from "@angular/core"; @@ -281,7 +281,7 @@ import { RichTextComponent } from "./richtext/richtext.component"; export class AppModule {} ~~~ -The last step is to open the ***src/main.ts*** file and replace the existing code with the following one: +Open *src/main.ts* and replace the existing code: ~~~jsx title="main.ts" import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; @@ -291,10 +291,10 @@ platformBrowserDynamic() .catch((err) => console.error(err)); ~~~ -After that, you can start the app to see RichText loaded with data on a page. +Start the app to see RichText loaded with data on a page.
![RichText initialization](../assets/trial_richtext.png)
-Now you know how to integrate DHTMLX RichText with Angular. You can customize the code according to your specific requirements. The final advanced example you can find on [**GitHub**](https://github.com/DHTMLX/angular-richtext-demo). +You have integrated DHTMLX RichText with Angular. Customize the code to fit your requirements. For the complete advanced example, see [**GitHub**](https://github.com/DHTMLX/angular-richtext-demo). diff --git a/docs/guides/integration_with_react.md b/docs/guides/integration_with_react.md index 1244911..a4111f7 100644 --- a/docs/guides/integration_with_react.md +++ b/docs/guides/integration_with_react.md @@ -12,27 +12,27 @@ You should be familiar with the basic concepts and patterns of [**React**](https DHTMLX RichText is compatible with **React**. We have prepared code examples on how to use DHTMLX RichText with **React**. For more information, refer to the corresponding [**Example on GitHub**](https://github.com/DHTMLX/react-richtext-demo). -## Creating a project +## Create a project :::info Before you start to create a new project, install [**Vite**](https://vite.dev/) (optional) and [**Node.js**](https://nodejs.org/en/). ::: -You can create a basic **React** project or use **React with Vite**. Let's name the project as **my-react-richtext-app**: +Create a basic **React** project or use **React with Vite**. Let's name the project **my-react-richtext-app**: ~~~json npx create-react-app my-react-richtext-app ~~~ -### Installation of dependencies +### Install dependencies -Go to the new created app directory: +Go to the newly created app directory: ~~~json cd my-react-richtext-app ~~~ -Install dependencies and start the dev server. For this, use a package manager: +Install dependencies and start the dev server. Use a package manager: - if you use [**yarn**](https://yarnpkg.com/), run the following commands: @@ -50,21 +50,21 @@ npm run dev The app should run on a localhost (for instance `http://localhost:3000`). -## Creating RichText +## Create RichText -Now you should get the DHTMLX RichText source code. First of all, stop the app and proceed with installing the RichText package. +Get the DHTMLX RichText source code. Stop the dev server, then install the RichText package. ### Step 1. Package installation -Download the [**trial RichText package**](/how_to_start/#installing-richtext-via-npm-or-yarn) and follow steps mentioned in the README file. Note that trial RichText is available 30 days only. +Download the [**trial RichText package**](/how_to_start/#installing-richtext-via-npm-or-yarn) and follow steps mentioned in the README file. Note that the trial version is available for 30 days only. ### Step 2. Component creation -Now you need to create a React component, to add a RichText into the application. Create a new file in the ***src/*** directory and name it ***Richtext.jsx***. +Create a React component to add RichText to the application. Add a new file named *Richtext.jsx* in the *src/* directory. -#### Importing source files +#### Import source files -Open the ***Richtext.jsx*** file and import RichText source files. Note that: +Open *Richtext.jsx* and import RichText source files. Note that: - if you use PRO version and install the RichText package from a local folder, the import paths look like this: @@ -82,9 +82,9 @@ import "@dhx/trial-richtext/dist/richtext.css"; In this tutorial you can see how to configure the **trial** version of RichText. -#### Setting containers and adding Richtext +#### Set up the container and initialize RichText -To display RichText on the page, you need to create container for RichText and initialize the component using the corresponding constructors: +To display RichText on the page, create a container for RichText and initialize the component with the `Richtext` constructor: ~~~jsx {} title="Richtext.jsx" import { useEffect, useRef } from "react"; @@ -109,9 +109,9 @@ export default function RichTextComponent(props) { } ~~~ -#### Adding styles +#### Add styles -To display RichText correctly, you need to specify important styles for RichText and its container in the main css file of the project: +To display RichText correctly, specify styles for RichText and its container in the main CSS file of the project: ~~~css title="index.css" /* specify styles for initial page */ @@ -135,9 +135,9 @@ body, } ~~~ -#### Loading data +#### Load data -To add data into the RichText, you need to provide a data set. You can create the ***data.js*** file in the ***src/*** directory and add some data into it: +To add data, provide a data set. Create *data.js* in the *src/* directory and add some data: ~~~jsx {} title="data.js" export function getData() { @@ -149,7 +149,7 @@ export function getData() { } ~~~ -Then open the ***App.js*** file and import data. After this you can pass data into the new created `` components as **props**: +Open *App.js*, import data, and pass the data to the new `` component as props: ~~~jsx {2,5-6} title="App.js" import RichText from "./Richtext"; @@ -163,7 +163,7 @@ function App() { export default App; ~~~ -Go to the ***Richtext.jsx*** file and apply the passed **props** to the RichText configuration object: +Open *Richtext.jsx* and apply the props to the RichText configuration object: ~~~jsx {} title="Richtext.jsx" import { useEffect, useRef } from "react"; @@ -190,7 +190,7 @@ export default function RichTextComponent(props) { } ~~~ -You can also use the [`setValue()`](api/methods/set-value.md) method inside the `useEffect()` method of React to load data into RichText: +You can also use the [`setValue()`](api/methods/set-value.md) method inside `useEffect()` to load data into RichText: ~~~jsx {} title="Richtext.jsx" import { useEffect, useRef } from "react"; @@ -220,13 +220,13 @@ export default function RichTextComponent(props) { } ~~~ -Now the RichText component is ready. When the element will be added to the page, it will initialize the RichText with data. You can provide necessary configuration settings as well. Visit our [RichText API docs](api/overview/main_overview.md) to check the full list of available properties. +The RichText component is ready. When the element is added to the page, RichText initializes with data. Visit our [RichText API docs](api/overview/main_overview.md) to check the full list of available properties. -#### Handling events +#### Handle events -When a user makes some action in the RichText, it invokes an event. You can use these events to detect the action and run the desired code for it. See the [full list of events](api/overview/events_overview.md). +When a user performs an action in RichText, the component fires an event. Use these events to detect the action and run the desired code. See the [full list of events](api/overview/events_overview.md). -Open ***Richtext.jsx*** and complete the `useEffect()` method in the following way: +Open *Richtext.jsx* and complete the `useEffect()` method: ~~~jsx {} title="Richtext.jsx" // ... @@ -244,10 +244,10 @@ useEffect(() => { // ... ~~~ -After that, you can start the app to see RichText loaded with data on a page. +Start the app to see RichText loaded with data on a page.
![RichText initialization](../assets/trial_richtext.png)
-Now you know how to integrate DHTMLX RichText with React. You can customize the code according to your specific requirements. The final advanced example you can find on [**GitHub**](https://github.com/DHTMLX/react-richtext-demo). +You have integrated DHTMLX RichText with React. Customize the code to fit your requirements. For the complete advanced example, see [**GitHub**](https://github.com/DHTMLX/react-richtext-demo). diff --git a/docs/guides/integration_with_svelte.md b/docs/guides/integration_with_svelte.md index db9839f..93b863a 100644 --- a/docs/guides/integration_with_svelte.md +++ b/docs/guides/integration_with_svelte.md @@ -12,7 +12,7 @@ You should be familiar with the basic concepts and patterns of **Svelte** before DHTMLX RichText is compatible with **Svelte**. We have prepared code examples on how to use DHTMLX RichText with **Svelte**. For more information, refer to the corresponding [**Example on GitHub**](https://github.com/DHTMLX/svelte-richtext-demo). -## Creating a project +## Create a project :::info Before you start to create a new project, install [**Vite**](https://vite.dev/) (optional) and [**Node.js**](https://nodejs.org/en/). @@ -32,15 +32,15 @@ npm create vite@latest Check the details in the [related article](https://svelte.dev/docs/introduction#start-a-new-project-alternatives-to-sveltekit). -### Installation of dependencies +### Install dependencies -Let's name the project as **my-svelte-richtext-app** and go to the app directory: +Let's name the project **my-svelte-richtext-app** and go to the app directory: ~~~json cd my-svelte-richtext-app ~~~ -Install dependencies and start the dev server. For this, use a package manager: +Install dependencies and start the dev server. Use a package manager: - if you use [**yarn**](https://yarnpkg.com/), run the following commands: @@ -58,21 +58,21 @@ npm run dev The app should run on a localhost (for instance `http://localhost:3000`). -## Creating RichText +## Create RichText -Now you should get the DHTMLX RichText source code. First of all, stop the app and proceed with installing the RichText package. +Get the DHTMLX RichText source code. Stop the dev server, then install the RichText package. ### Step 1. Package installation -Download the [**trial RichText package**](/how_to_start/#installing-richtext-via-npm-or-yarn) and follow steps mentioned in the README file. Note that trial RichText is available 30 days only. +Download the [**trial RichText package**](/how_to_start/#installing-richtext-via-npm-or-yarn) and follow steps mentioned in the README file. Note that the trial version is available for 30 days only. ### Step 2. Component creation -Now you need to create a Svelte component, to add a RichText into the application. Let's create a new file in the ***src/*** directory and name it ***Richtext.svelte***. +Create a Svelte component to add RichText to the application. Add a new file named *Richtext.svelte* in the *src/* directory. -#### Importing source files +#### Import source files -Open the ***Richtext.svelte*** file and import RichText source files. Note that: +Open *Richtext.svelte* and import RichText source files. Note that: - if you use PRO version and install the RichText package from a local folder, the import paths look like this: @@ -94,9 +94,9 @@ import '@dhx/trial-richtext/dist/richtext.css'; In this tutorial you can see how to configure the **trial** version of RichText. -#### Setting containers and adding RichText +#### Set up the container and initialize RichText -To display RichText on the page, you need to create container for RichText, and initialize the component using the corresponding constructor: +To display RichText on the page, create a container for RichText and initialize the component with the `Richtext` constructor: ~~~html {} title="Richtext.svelte"