Skip to content

Commit 7af7071

Browse files
Update internal methods
1 parent 0875364 commit 7af7071

7 files changed

Lines changed: 56 additions & 70 deletions

File tree

docs/api/internal/detach.md

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_label: api.detach()
2+
sidebar_label: api.detach() ?
33
title: on Method
44
description: You can learn about the on method 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.
55
---
@@ -8,37 +8,10 @@ description: You can learn about the on method in the documentation of the DHTML
88

99
### Description
1010

11-
@short: Allows attaching a handler to the inner events
12-
1311
### Usage
1412

15-
~~~jsx {}
16-
api.detach(
17-
event: string,
18-
handler: function
19-
): void;
20-
~~~
21-
2213
### Parameters
2314

24-
- `event` - (required) an event to be fired
25-
- `handler` - (required) a handler to be attached (the handler arguments will depend on the event to be fired)
26-
2715
### Events
2816

29-
:::info
30-
The full list of the RichText internal events can be found [**here**](api/overview/main_overview.md/#richtext-events)
31-
:::
32-
3317
### Example
34-
35-
~~~jsx {7-9}
36-
// create RichText
37-
const editor = new richtext.Richtext("#root", {
38-
...
39-
});
40-
// ...
41-
editor.api.detach("move-card", ({ id, columnId }) => {
42-
console.log({ id, columnId });
43-
});
44-
~~~

docs/api/internal/exec.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: You can learn about the exec method in the documentation of the DHT
88

99
### Description
1010

11-
@short: Allows triggering the inner events
11+
@short: Allows triggering inner events
1212

1313
### Usage
1414

@@ -21,30 +21,26 @@ api.exec(
2121

2222
### Parameters
2323

24-
- `event` - (required) an event to be fired
24+
- `event` - (required) an event to be fired
2525
- `config` - (required) the config object with parameters (see the event to be fired)
2626

2727
### Events
2828

2929
:::info
30-
The full list of the RichText internal events can be found [**here**](api/overview/main_overview.md/#richtext-events)
30+
The full list of the RichText internal events can be found [**here**](/category/richtext-events/)
3131
:::
3232

3333
### Example
3434

35-
~~~jsx {7,9-12}
36-
// create RichText
35+
~~~jsx {5-8}
36+
// initialize RichText
3737
const editor = new richtext.Richtext("#root", {
38-
columns,
39-
cards
40-
});
41-
// select the card with the 1 ID
42-
editor.api.exec("select-card", { id: 1 });
43-
// add new card without sending changes to the server
44-
editor.api.exec("add-card", {
45-
columnId: "backlog",
46-
skipProvider: true,
38+
// configuration parameters
4739
});
40+
// set the text font size
41+
editor.api.exec("set-font-size", {
42+
fontSize: "16px"
43+
});
4844
~~~
4945

50-
**Related sample:** [RichText. Preserve sorting](https://snippet.dhtmlx.com/74nyuv14?tag=richtext)
46+
**Change log:** The method was added in v2.0

docs/api/internal/get-reactive-state.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,27 @@ The method returns an object with the following parameters:
2222

2323
~~~jsx {}
2424
{
25-
...
25+
cursorState: { subscribe: any },
26+
defaultStyles {...},
27+
document {...},
28+
fullscreen {...},
29+
history {...},
30+
layoutMode {...},
31+
popup {...},
32+
selection {...}
2633
}
2734
~~~
2835

2936
### Example
3037

31-
~~~jsx {7-37}
32-
// create RichText
38+
~~~jsx {5-7}
39+
// initialize RichText
3340
const editor = new richtext.Richtext("#root", {
34-
...
41+
// configuration parameters
3542
});
3643
// get the Reactive State of RichText
37-
const state = editor.api.getReactiveState();
44+
const reactive_state = editor.api.getReactiveState();
45+
console.log(reactive_state)
3846
~~~
3947

40-
**Change log:**
48+
**Change log:** The method was added in v2.0

docs/api/internal/get-state.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,28 @@ api.getState(): object;
2121
The method returns an object with the following parameters:
2222

2323
~~~jsx {}
24-
{
25-
...
24+
{
25+
cursorState: {},
26+
defaultStyles: {},
27+
document: {},
28+
fullscreen: boolean,
29+
history: []
30+
layoutMode: string,
31+
popup: any,
32+
selection: {}
2633
}
34+
~~~
2735

2836
### Example
2937

30-
~~~jsx {7-12}
31-
// create RichText
38+
~~~jsx {5-7}
39+
// initialize RichText
3240
const editor = new richtext.Richtext("#root", {
33-
...
41+
// configuration parameters
3442
});
3543
// get the State of RichText
3644
const state = editor.api.getState();
37-
console.log(...); // ...
38-
//...
45+
console.log(state);
3946
~~~
4047

41-
**Change log:**
48+
**Change log:** The method was added in v2.0

docs/api/internal/intercept.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ The full list of the RichText internal events can be found [**here**](api/overvi
3232

3333
### Example
3434

35-
~~~jsx {7-11}
35+
~~~jsx {5-10}
3636
// create RichText
3737
const editor = new richtext.Richtext("#root", {
38-
...
38+
// configuration parameters
3939
});
40-
// forbid moving cards to the column with the "done" ID
41-
editor.api.intercept("move-card", ({ id, columnId }) => {
42-
if(columnId !== "done" ){
40+
// forbid changing the font size
41+
editor.api.intercept("set-font-size", (obj) => {
42+
if(obj.fontSize !== "36px" ){
4343
return false;
4444
}
4545
});
4646
~~~
47+
48+
**Change log:** The method was added in v2.0

docs/api/internal/on.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ api.on(
2727
### Events
2828

2929
:::info
30-
The full list of the RichText internal events can be found [**here**](api/overview/main_overview.md/#richtext-events)
30+
The full list of the RichText internal events can be found [**here**](/category/richtext-events/)
3131
:::
3232

3333
### Example
3434

35-
~~~jsx {7-9}
36-
// create RichText
35+
~~~jsx {5-8}
36+
// initialize RichText
3737
const editor = new richtext.Richtext("#root", {
38-
...
38+
// configuration parameters
3939
});
40-
// ...
41-
editor.api.on("move-card", ({ id, columnId }) => {
42-
console.log({ id, columnId });
40+
// subscribe on the "set-font-size" event
41+
editor.api.on("set-font-size", (obj) => {
42+
console.log(obj.fontSize);
4343
});
4444
~~~

docs/api/internal/set-next.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const restProvider = new richtext.RestDataProvider(url);
2828

2929
Promise.all([
3030
...
31-
]).then(([cards, columns, rows]) => {
31+
]).then(([value]) => {
3232
const editor = new richtext.Richtext("#root", {
3333
...
3434
});

0 commit comments

Comments
 (0)