Skip to content

Commit

Permalink
chore: Update default values for character count and limit
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Jan 28, 2024
1 parent 20c4ead commit 55ed561
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/ChatBotInput/ChatBotInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const ChatBotInput = ({
if (inputRef.current) {
const characterLimit = botOptions.chatInput?.characterLimit
const newInput = event.target.value.replace(/\n/g, " ");
if (characterLimit != null && characterLimit > 0 && newInput.length > characterLimit) {
if (characterLimit != null && characterLimit >= 0 && newInput.length > characterLimit) {
inputRef.current.value = newInput.slice(0, characterLimit);
} else {
inputRef.current.value = newInput
Expand Down
4 changes: 2 additions & 2 deletions src/services/BotOptionsService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ const defaultOptions = {
disabled: false,
enabledPlaceholderText: "Type your message...",
disabledPlaceholderText: "",
showCharacterCount: true,
characterLimit: 10,
showCharacterCount: false,
characterLimit: -1,
botDelay: 1000,
sendButtonIcon: sendButtonIcon,
blockSpam: true,
Expand Down
2 changes: 1 addition & 1 deletion src/services/VoiceService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const startVoiceRecording = (botOptions: Options, handleToggleVoice: () =
if (inputRef.current) {
const characterLimit = botOptions.chatInput?.characterLimit
const newInput = inputRef.current.value + voiceInput;
if (characterLimit != null && characterLimit > 0 && newInput.length > characterLimit) {
if (characterLimit != null && characterLimit >= 0 && newInput.length > characterLimit) {
inputRef.current.value = newInput.slice(0, characterLimit);
} else {
inputRef.current.value = newInput
Expand Down

0 comments on commit 55ed561

Please sign in to comment.