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
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,8 @@ or there is UMD build available. [Check out this pen as example](https://codepen
53
53
| movePopupAsYouType | boolean | When it's true the textarea will move along with a caret as a user continues to type. Defaults to false. |
54
54
| boundariesElement | string \| HTMLElement | Element which should prevent autocomplete to overflow. Defaults to _body_. |
55
55
| textAreaComponent | React.Component \| {component: React.Component, ref: string} | What component use for as textarea. Default is `textarea`. (You can combine this with [react-autosize-textarea](https://github.com/buildo/react-autosize-textarea) for instance) |
56
-
| renderToBody | boolean | When set to `true` the autocomplete will be rendered at the end of the `<body>`. Default is `false`. |
56
+
| renderToBody | boolean | When set to `true` the autocomplete will be rendered at the end of the `<body>`. Default is `false`. |
57
+
| onItemSelected | ({currentTrigger: string, item: string \| Object}) => void | Callback get called everytime item is selected |
@@ -481,7 +492,7 @@ class ReactTextareaAutocomplete extends React.Component<
481
492
thrownewError(
482
493
`Output functor should return string or object in shape {text: string, caretPosition: string | number}.\nGot "${String(
483
494
textToReplace
484
-
)}". Check the implementation for trigger "${currentTrigger}" and its token "${actualToken}"\n\nSee https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more informations.\n`
495
+
)}". Check the implementation for trigger "${currentTrigger}"\n\nSee https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information.\n`
485
496
);
486
497
}
487
498
@@ -496,13 +507,13 @@ class ReactTextareaAutocomplete extends React.Component<
496
507
497
508
if(!textToReplace.text){
498
509
thrownewError(
499
-
`Output "text" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "${currentTrigger}" and its token "${actualToken}"\n`
510
+
`Output "text" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "${currentTrigger}"\n`
500
511
);
501
512
}
502
513
503
514
if(!textToReplace.caretPosition){
504
515
thrownewError(
505
-
`Output "caretPosition" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "${currentTrigger}" and its token "${actualToken}"\n`
516
+
`Output "caretPosition" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "${currentTrigger}"\n`
506
517
);
507
518
}
508
519
@@ -666,7 +677,8 @@ class ReactTextareaAutocomplete extends React.Component<
666
677
"dropdownClassName",
667
678
"movePopupAsYouType",
668
679
"textAreaComponent",
669
-
"renderToBody"
680
+
"renderToBody",
681
+
"onItemSelected"
670
682
];
671
683
672
684
// eslint-disable-next-line
@@ -830,10 +842,7 @@ class ReactTextareaAutocomplete extends React.Component<
0 commit comments