You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- link v2.1 samples in What's new (triggers, formats, insertValue)
- add Related sample links to new v2.1 API: triggers, triggerTemplate,
insertValue, show-suggest, insert-token, hide-suggest, and
markdown-aware setValue
- add sample links to guides: mentions and tags, configuration,
initialization
Copy file name to clipboardExpand all lines: docs/guides/configuration.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,8 @@ const editor = new richtext.Richtext("#root", {
42
42
});
43
43
~~~
44
44
45
+
**Related sample:**[RichText. Document and classic modes](https://snippet.dhtmlx.com/jz8q432l?tag=richtext)
46
+
45
47
## Toolbar
46
48
47
49
The RichText toolbar groups controls into several blocks that you can customize.
@@ -125,7 +127,7 @@ new richtext.Richtext("#root", {
125
127
});
126
128
~~~
127
129
128
-
**Related sample:**[RichText. Custom control and simplified toolbar](https://snippet.dhtmlx.com/wda202ih?tag=richtext)
130
+
**Related sample:**[RichText. Full toolbar](https://snippet.dhtmlx.com/ziynafp7?tag=richtext)
129
131
130
132
### Add custom toolbar controls
131
133
@@ -202,6 +204,8 @@ new richtext.Richtext("#root", {
202
204
});
203
205
~~~
204
206
207
+
**Related sample:**[RichText. Initialization with menubar](https://snippet.dhtmlx.com/tjryzka7?tag=richtext)
208
+
205
209
## Set the initial content
206
210
207
211
Use the [`value`](api/config/value.md) property to pass initial HTML content into the editor on initialization:
@@ -215,6 +219,8 @@ new richtext.Richtext("#root", {
215
219
216
220
To replace the content after initialization, or to load it in a non-HTML format with a custom encoder, call the [`setValue()`](api/methods/set-value.md) method.
217
221
222
+
**Related sample:**[RichText. Working with different formats (Markdown, HTML, text)](https://snippet.dhtmlx.com/cne4kujn?tag=richtext)
223
+
218
224
## Set the initial locale
219
225
220
226
Use the [`locale`](api/config/locale.md) property to apply a localization object on initialization:
Copy file name to clipboardExpand all lines: docs/guides/mentions_and_tags.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,8 @@ Each trigger is an object `{ trigger, data, showTrigger?, action? }` within the
54
54
}
55
55
~~~
56
56
57
+
**Related sample:**[RichText. Mentions, tags, and async lookup](https://snippet.dhtmlx.com/nfvvfize?tag=richtext)
58
+
57
59
## Token rendering
58
60
59
61
When the user picks an item from the dropdown, RichText inserts it as an `<a>` element with two data attributes:
@@ -78,6 +80,11 @@ You can style tokens with the `data-token` selector:
78
80
}
79
81
~~~
80
82
83
+
**Related samples:**
84
+
85
+
-[RichText. Find and highlight mentions](https://snippet.dhtmlx.com/8y6zvzh2?tag=richtext)
86
+
-[RichText. Highlight all mentions](https://snippet.dhtmlx.com/2rbo12jx?tag=richtext)
87
+
81
88
## Hide the trigger character
82
89
83
90
Set `showTrigger: false` on a trigger to insert only the item label, without the trigger symbol:
@@ -136,6 +143,8 @@ new richtext.Richtext("#root", {
136
143
});
137
144
~~~
138
145
146
+
**Related sample:**[RichText. Custom dropdown template per trigger](https://snippet.dhtmlx.com/0p3bbnhz?tag=richtext)
147
+
139
148
## Custom action on select
140
149
141
150
By default, picking an item inserts it into the document as a token. To run your own code instead, add an `action` callback to the trigger. RichText removes the typed trigger text and calls `action(item)` with the picked item — no token is inserted, so you can decide what to add.
@@ -180,6 +189,8 @@ function emojiFromCode(code) {
When the `data` parameter is a function, you are not limited to the built-in `label` matching. You can run your own filtering and keep category headers in the dropdown. Add header items that include a `label` field and do not include `code`. The `data` function first finds the emoji that match the query, then returns emoji together with the headers of the categories that still have matches:
@@ -252,6 +263,8 @@ const editor = new richtext.Richtext("#root", {
0 commit comments