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
Copy file name to clipboardexpand all lines: README.md
+8-3
Original file line number
Diff line number
Diff line change
@@ -220,12 +220,17 @@ Get all words with a specific tag.
220
220
*`words` (table) - A table with all the words that matches the tag.
221
221
222
222
223
-
### richtext.truncate(words, length)
224
-
Truncate a text such that only a specific number of characters and images are visible. The function will disable nodes that shouldn't be seen at all and updates the text in nodes that should be partially visible. The text metrics of a truncated word will be updated.
223
+
### richtext.truncate(words, length, [options])
224
+
Truncate a text down to a specific length. This function has two modes of operation: 1) It can truncate the text on a per word basis or 2) on a per character/image basis. The function will disable nodes that shouldn't be visible and in the case of truncating on a per character basis also update the text in nodes that should be partially visible. The text metrics of a truncated word will be updated.
225
225
226
226
**PARAMETERS**
227
227
*`words` (table) - The words to truncate, as received by a call to `richtext.create()`.
228
-
*`length` (number) - Maximum number of characters or images to show.
228
+
*`length` (number) - Maximum number of words or characters and images to show.
229
+
*`options` (table) - Optional table with options when truncating.
230
+
231
+
Available options in the `option` table are:
232
+
233
+
*`words` (boolean) - True if the function should truncate down to the nearest full word instead of truncating to a partial word.
0 commit comments