Skip to content

Commit 8c89a96

Browse files
[add] code sample links across RichText docs
- 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
1 parent 3013292 commit 8c89a96

11 files changed

Lines changed: 56 additions & 6 deletions

File tree

docs/api/config/trigger-template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,9 @@ new Richtext("#root", {
6565

6666
**Change log:** The property was added in v2.1
6767

68+
**Related samples:**
69+
70+
- [RichText. Custom dropdown template per trigger](https://snippet.dhtmlx.com/0p3bbnhz?tag=richtext)
71+
- [RichText. Emoji autocomplete](https://snippet.dhtmlx.com/g5z1d868?tag=richtext)
72+
6873
**Related articles:** [Mentions and tags](guides/mentions_and_tags.md)

docs/api/config/triggers.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,13 @@ new richtext.Richtext("#root", {
238238

239239
**Change log:** The property was added in v2.1
240240

241+
**Related samples:**
242+
243+
- [RichText. Mentions, tags, and async lookup](https://snippet.dhtmlx.com/nfvvfize?tag=richtext)
244+
- [RichText. Custom dropdown template per trigger](https://snippet.dhtmlx.com/0p3bbnhz?tag=richtext)
245+
- [RichText. Emoji autocomplete](https://snippet.dhtmlx.com/g5z1d868?tag=richtext)
246+
- [RichText. Slash commands](https://snippet.dhtmlx.com/e0mrmyam?tag=richtext)
247+
- [RichText. Find and highlight mentions](https://snippet.dhtmlx.com/8y6zvzh2?tag=richtext)
248+
- [RichText. Highlight all mentions](https://snippet.dhtmlx.com/2rbo12jx?tag=richtext)
249+
241250
**Related articles:** [Mentions and tags](guides/mentions_and_tags.md)

docs/api/events/hide-suggest.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ editor.api.on("hide-suggest", () => {
4545
~~~
4646

4747
**Change log:** The event was added in v2.1
48+
49+
**Related sample:** [RichText. Mentions, tags, and async lookup](https://snippet.dhtmlx.com/nfvvfize?tag=richtext)
50+
51+
**Related articles:** [Mentions and tags](guides/mentions_and_tags.md)

docs/api/events/insert-token.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ editor.api.on("insert-token", ({ data, trigger, showTrigger }) => {
5656

5757
**Change log:** The event was added in v2.1
5858

59+
**Related sample:** [RichText. Mentions, tags, and async lookup](https://snippet.dhtmlx.com/nfvvfize?tag=richtext)
60+
5961
**Related articles:** [Mentions and tags](guides/mentions_and_tags.md)

docs/api/events/show-suggest.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ editor.api.intercept("show-suggest", (state) => {
5959

6060
**Change log:** The event was added in v2.1
6161

62+
**Related sample:** [RichText. Mentions, tags, and async lookup](https://snippet.dhtmlx.com/nfvvfize?tag=richtext)
63+
6264
**Related articles:** [Mentions and tags](guides/mentions_and_tags.md)

docs/api/methods/insert-value.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ editor.insertValue("<a href=\"https://example.com\" title=\"Example\">link</a>")
4343
The inserted content is added as a single history entry and can be reverted with one **Undo** step.
4444

4545
**Change log:** The method was added in v2.1
46+
47+
**Related samples:**
48+
49+
- [RichText. Insert content at cursor](https://snippet.dhtmlx.com/pew2g1ku?tag=richtext)
50+
- [RichText. Working with different formats (Markdown, HTML, text)](https://snippet.dhtmlx.com/cne4kujn?tag=richtext)

docs/api/methods/set-value.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ editor.setValue(editor_value, fromTextEncoder);
4343
~~~
4444

4545
**Change log:** The method was updated in v2.0. The `mode` parameter was removed. The `encoder` parameter was added
46+
47+
**Related sample:** [RichText. Working with different formats (Markdown, HTML, text)](https://snippet.dhtmlx.com/cne4kujn?tag=richtext)

docs/guides/configuration.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const editor = new richtext.Richtext("#root", {
4242
});
4343
~~~
4444

45+
**Related sample:** [RichText. Document and classic modes](https://snippet.dhtmlx.com/jz8q432l?tag=richtext)
46+
4547
## Toolbar
4648

4749
The RichText toolbar groups controls into several blocks that you can customize.
@@ -125,7 +127,7 @@ new richtext.Richtext("#root", {
125127
});
126128
~~~
127129

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)
129131

130132
### Add custom toolbar controls
131133

@@ -202,6 +204,8 @@ new richtext.Richtext("#root", {
202204
});
203205
~~~
204206

207+
**Related sample:** [RichText. Initialization with menubar](https://snippet.dhtmlx.com/tjryzka7?tag=richtext)
208+
205209
## Set the initial content
206210

207211
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", {
215219

216220
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.
217221

222+
**Related sample:** [RichText. Working with different formats (Markdown, HTML, text)](https://snippet.dhtmlx.com/cne4kujn?tag=richtext)
223+
218224
## Set the initial locale
219225

220226
Use the [`locale`](api/config/locale.md) property to apply a localization object on initialization:

docs/guides/initialization.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,5 @@ editor.destructor();
7676
The example below initializes RichText with the menubar enabled:
7777

7878
<iframe src="https://snippet.dhtmlx.com/tjryzka7?mode=js" frameborder="0" class="snippet_iframe" width="100%" height="500"></iframe>
79+
80+
**Related sample:** [RichText. Initialization](https://snippet.dhtmlx.com/t55alxiy?tag=richtext)

docs/guides/mentions_and_tags.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Each trigger is an object `{ trigger, data, showTrigger?, action? }` within the
5454
}
5555
~~~
5656

57+
**Related sample:** [RichText. Mentions, tags, and async lookup](https://snippet.dhtmlx.com/nfvvfize?tag=richtext)
58+
5759
## Token rendering
5860

5961
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:
7880
}
7981
~~~
8082

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+
8188
## Hide the trigger character
8289

8390
Set `showTrigger: false` on a trigger to insert only the item label, without the trigger symbol:
@@ -136,6 +143,8 @@ new richtext.Richtext("#root", {
136143
});
137144
~~~
138145

146+
**Related sample:** [RichText. Custom dropdown template per trigger](https://snippet.dhtmlx.com/0p3bbnhz?tag=richtext)
147+
139148
## Custom action on select
140149

141150
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) {
180189
}
181190
~~~
182191

192+
**Related sample:** [RichText. Emoji autocomplete](https://snippet.dhtmlx.com/g5z1d868?tag=richtext)
193+
183194
### Group emoji by categories
184195

185196
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", {
252263
});
253264
~~~
254265

266+
**Related sample:** [RichText. Slash commands](https://snippet.dhtmlx.com/e0mrmyam?tag=richtext)
267+
255268
## Related API
256269

257270
- [`triggers`](api/config/triggers.md)

0 commit comments

Comments
 (0)