1
私はtextarea
と注目に値するマークダウンエディタを作成しています。私は、テキストの長さが最小値よりも大きい場合にのみ提出したいと思います。私は私の出力に見られるあるテキストの実際の長さを取得できますか注目すべきマークダウン。実際のテキストの長さを取得する
var CharCounter = React.createClass({
getText : function(){
if(this.props.count < this.props.min)
return (this.props.min - this.props.count) + ' more to go';
else if(this.props.count < this.props.max)
return (this.props.max - this.props.count) + ' left';
else
return 'Done';
},
render : function(){
return(
<p><small>{this.getText()}</small></p>
);
}
});
問題は、私が試してみて、直接テキストエリアの値を使用している場合。長さにはマークダウン.ie ['*'、 '**']
よしである可能性があります。今すぐコードを追加する – peter
あなたはRemarkableライブラリをどこにバインドするかを追加できますか? – Pietro
私はこう言うでしょう: 'render'メソッドがhtmlを出力すると、それをdivに入れて、' .text()。length'をjQuery経由で取得します。 – Pietro