Remove countableText to count all text
This commit is contained in:
parent
dc2f44d706
commit
5795433a29
2 changed files with 2 additions and 12 deletions
|
@ -16,7 +16,6 @@ import WarningContainer from '../containers/warning_container';
|
|||
import { isMobile } from '../../../is_mobile';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { length } from 'stringz';
|
||||
import { countableText } from '../util/counter';
|
||||
import Icon from 'mastodon/components/icon';
|
||||
import { maxChars } from '../../../initial_state';
|
||||
|
||||
|
@ -85,7 +84,7 @@ class ComposeForm extends ImmutablePureComponent {
|
|||
|
||||
// Submit disabled:
|
||||
const { is_submitting, is_changing_upload, is_uploading, anyMedia } = this.props;
|
||||
const fulltext = [this.props.spoiler_text, countableText(this.props.text)].join('');
|
||||
const fulltext = [this.props.spoiler_text, this.props.text].join('');
|
||||
|
||||
if (is_submitting || is_uploading || is_changing_upload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
|
||||
return;
|
||||
|
@ -162,7 +161,7 @@ class ComposeForm extends ImmutablePureComponent {
|
|||
render () {
|
||||
const { intl, onPaste, showSearch, anyMedia } = this.props;
|
||||
const disabled = this.props.is_submitting;
|
||||
const text = [this.props.spoiler_text, countableText(this.props.text)].join('');
|
||||
const text = [this.props.spoiler_text, this.props.text].join('');
|
||||
const disabledButton = disabled || this.props.is_uploading || this.props.is_changing_upload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
|
||||
let publishText = '';
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
import { urlRegex } from './url_regex';
|
||||
|
||||
const urlPlaceholder = 'xxxxxxxxxxxxxxxxxxxxxxx';
|
||||
|
||||
export function countableText(inputText) {
|
||||
return inputText
|
||||
.replace(urlRegex, urlPlaceholder)
|
||||
.replace(/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/ig, '$1@$3');
|
||||
};
|
Loading…
Reference in a new issue