Skip to content

Commit 240a1d8

Browse files
committed
fix: negative maxlength values handling
1 parent 92fc683 commit 240a1d8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class EnrichedTextInputViewManager :
166166
view: EnrichedTextInputView?,
167167
maxLength: Int,
168168
) {
169-
view?.maxLength = maxLength
169+
view?.maxLength = if (maxLength < 0) MaxLength.UNLIMITED else maxLength
170170
}
171171

172172
@ReactProp(name = "mentionIndicators")

src/web/pmPlugins/MaxLengthPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const MaxLengthPlugin = Extension.create<MaxLengthPluginOptions>({
148148
key: new PluginKey('maxLength'),
149149
appendTransaction: (transactions, _oldState, newState) => {
150150
const maxLength = this.options.getMaxLength();
151-
if (maxLength == null) return null;
151+
if (maxLength == null || maxLength < 0) return null;
152152
if (!transactions.some((tr) => tr.docChanged)) return null;
153153

154154
let overflow = docPlainLength(newState.doc) - maxLength;

0 commit comments

Comments
 (0)