Set "Description" field limit to 5000 characters.

This applies to both Channel and Claim description.
This commit is contained in:
infiinte-persistence 2020-06-12 17:18:04 +02:00 committed by Sean Yesmunt
parent 749b13e3eb
commit 805904360e
6 changed files with 13 additions and 3 deletions

View file

@ -6,6 +6,7 @@ import SelectAsset from 'component/selectAsset';
import * as PAGES from 'constants/pages';
import { MINIMUM_PUBLISH_BID } from 'constants/claim';
import TagsSearch from 'component/tagsSearch';
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
type Props = {
claim: ChannelClaim,
@ -173,6 +174,7 @@ function ChannelForm(props: Props) {
value={params.description}
disabled={false}
onChange={text => setParams({ ...params, description: text })}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
/>
<TagsSearch

View file

@ -13,6 +13,7 @@ import { FormField, Form } from 'component/common/form';
import CommentCreate from 'component/commentCreate';
import classnames from 'classnames';
import usePersistedState from 'effects/use-persisted-state';
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
type Props = {
uri: string,
@ -196,6 +197,7 @@ function Comment(props: Props) {
onChange={handleEditMessageChanged}
quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
quickActionHandler={toggleEditorMode}
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
/>
<div className="section__actions">
<Button

View file

@ -8,6 +8,7 @@ import ChannelSelection from 'component/selectChannel';
import usePersistedState from 'effects/use-persisted-state';
import * as MODALS from 'constants/modal_types';
import I18nMessage from 'component/i18nMessage';
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
type Props = {
commentingEnabled: boolean,
@ -120,6 +121,7 @@ export function CommentCreate(props: Props) {
charCount={charCount}
onChange={handleCommentChange}
autoFocus={isReply}
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
/>
<div className="section__actions">
<Button

View file

@ -5,7 +5,7 @@ import ReactDOMServer from 'react-dom/server';
import SimpleMDE from 'react-simplemde-editor';
import MarkdownPreview from 'component/common/markdown-preview';
import { openEditorMenu, stopContextMenu } from 'util/context-menu';
import { MAX_CHARACTERS_IN_COMMENT as defaultTextAreaLimit } from 'constants/form-field';
import { FF_MAX_CHARS_DEFAULT } from 'constants/form-field';
import 'easymde/dist/easymde.min.css';
import Button from 'component/button';
@ -80,7 +80,7 @@ export class FormField extends React.PureComponent<Props> {
labelOnLeft,
blockWrap,
charCount,
textAreaMaxLength = defaultTextAreaLimit,
textAreaMaxLength = FF_MAX_CHARS_DEFAULT,
quickActionLabel,
quickActionHandler,
...inputProps

View file

@ -3,6 +3,7 @@ import React from 'react';
import { FormField } from 'component/common/form';
import usePersistedState from 'effects/use-persisted-state';
import Card from 'component/common/card';
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
type Props = {
title: ?string,
@ -42,6 +43,7 @@ function PublishText(props: Props) {
onChange={value => updatePublishForm({ description: advancedEditor ? value : value.target.value })}
quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
quickActionHandler={toggleMarkdown}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
/>
</React.Fragment>
}

View file

@ -1 +1,3 @@
export const MAX_CHARACTERS_IN_COMMENT = 2000;
export const FF_MAX_CHARS_DEFAULT = 2000;
export const FF_MAX_CHARS_IN_COMMENT = 2000;
export const FF_MAX_CHARS_IN_DESCRIPTION = 5000;