Skip to content
Permalink
Browse files

apply autolatex and mathjax

  • Loading branch information...
christianp committed Oct 9, 2019
1 parent 83d3e77 commit 004c55beeb87e4f6af0ef690f20aed215e63b950
@@ -8,6 +8,7 @@ import { isRtl } from '../rtl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import Textarea from 'react-textarea-autosize';
import classNames from 'classnames';
import try_replace from '../features/compose/util/autolatex.js';

const textAtCursorMatchesToken = (str, caretPosition) => {
let word;
@@ -77,6 +78,10 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
this.props.onChange(e);
}

onInput = (e) => {
try_replace(e.target);
}

onKeyDown = (e) => {
const { suggestions, disabled } = this.props;
const { selectedSuggestion, suggestionsHidden } = this.state;
@@ -216,6 +221,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
value={value}
onChange={this.onChange}
onKeyDown={this.onKeyDown}
onInput={this.onInput}
onKeyUp={onKeyUp}
onFocus={this.onFocus}
onBlur={this.onBlur}
@@ -94,9 +94,15 @@ export default class StatusContent extends React.PureComponent {
}
}

_renderMathJax () {
const node = this.node;
MathJax.Hub.Queue(["Typeset", MathJax.Hub, node]);
}

componentDidMount () {
this._updateStatusLinks();
this._updateStatusEmojis();
this._renderMathJax();
}

componentDidUpdate () {

0 comments on commit 004c55b

Please sign in to comment.
You can’t perform that action at this time.