From 5d40a4c9f63a43740c73feab402890809266e5b5 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sat, 20 Mar 2021 07:48:47 +0800 Subject: [PATCH] Markdown editor: Remove character limit ## Issue Closes 5687: Ensure post mode has no text limit ## Changes - `type="markdown"` can now have unlimited length if clients don't define `textAreaMaxWidth`. - The internal default limit of 2000 is narrowed down to `type=textarea`. --- ui/component/common/form-components/form-field.jsx | 14 ++++++++++---- ui/component/postEditor/view.jsx | 12 +++++------- ui/constants/form-field.js | 1 - 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ui/component/common/form-components/form-field.jsx b/ui/component/common/form-components/form-field.jsx index 3662b17ac..cc7e7fd3f 100644 --- a/ui/component/common/form-components/form-field.jsx +++ b/ui/component/common/form-components/form-field.jsx @@ -80,7 +80,7 @@ export class FormField extends React.PureComponent { labelOnLeft, blockWrap, charCount, - textAreaMaxLength = FF_MAX_CHARS_DEFAULT, + textAreaMaxLength, quickActionLabel, quickActionHandler, ...inputProps @@ -208,7 +208,7 @@ export class FormField extends React.PureComponent { // to pass the current value to it's callback, nor query the current // text length from the callback. So, we'll use our own widget. const hasCharCount = charCount !== undefined && charCount >= 0; - const countInfo = hasCharCount && ( + const countInfo = hasCharCount && textAreaMaxLength !== undefined && ( {`${charCount || '0'}/${textAreaMaxLength}`} ); @@ -242,7 +242,7 @@ export class FormField extends React.PureComponent { ); } else if (type === 'textarea') { const hasCharCount = charCount !== undefined && charCount >= 0; - const countInfo = hasCharCount && ( + const countInfo = hasCharCount && textAreaMaxLength !== undefined && ( {`${charCount || '0'}/${textAreaMaxLength}`} ); input = ( @@ -255,7 +255,13 @@ export class FormField extends React.PureComponent { {quickAction} )} -