Skip to content

Commit

Permalink
mathjax: remove componentWillMount from latexdropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Jul 19, 2024
1 parent af24bf9 commit 8d8af90
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ class LaTeXDropdown extends React.PureComponent {
placement: 'bottom',
};

constructor(props) {
super();

this.props = props;

const { intl: { formatMessage } } = this.props;

this.options = [
{ icon: 'inline-mode', value: 'inline', text: formatMessage(messages.inline_short), meta: formatMessage(messages.inline_long) },
{ icon: 'display-mode', value: 'display', text: formatMessage(messages.display_short), meta: formatMessage(messages.display_long) },
];
}

handleToggle = ({ target }) => {
if (this.props.isUserTouching && this.props.isUserTouching()) {
if (this.state.open) {
Expand Down Expand Up @@ -237,15 +250,6 @@ class LaTeXDropdown extends React.PureComponent {
this.props.onChange(value);
};

componentWillMount () {
const { intl: { formatMessage } } = this.props;

this.options = [
{ icon: 'inline-mode', value: 'inline', text: formatMessage(messages.inline_short), meta: formatMessage(messages.inline_long) },
{ icon: 'display-mode', value: 'display', text: formatMessage(messages.display_short), meta: formatMessage(messages.display_long) },
];
}

setTargetRef = c => {
this.target = c;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.compose-form {
.latex-dropdown {
position: absolute;
top: 24px;
right: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ class LaTeXDropdown extends React.PureComponent {
placement: 'bottom',
};

constructor(props) {
super();

this.props = props;

const { intl: { formatMessage } } = this.props;

this.options = [
{ icon: 'inline-mode', value: 'inline', text: formatMessage(messages.inline_short), meta: formatMessage(messages.inline_long) },
{ icon: 'display-mode', value: 'display', text: formatMessage(messages.display_short), meta: formatMessage(messages.display_long) },
];
}

handleToggle = ({ target }) => {
if (this.props.isUserTouching && this.props.isUserTouching()) {
if (this.state.open) {
Expand Down Expand Up @@ -237,15 +250,6 @@ class LaTeXDropdown extends React.PureComponent {
this.props.onChange(value);
};

componentWillMount () {
const { intl: { formatMessage } } = this.props;

this.options = [
{ icon: 'inline-mode', value: 'inline', text: formatMessage(messages.inline_short), meta: formatMessage(messages.inline_long) },
{ icon: 'display-mode', value: 'display', text: formatMessage(messages.display_short), meta: formatMessage(messages.display_long) },
];
}

setTargetRef = c => {
this.target = c;
};
Expand Down

0 comments on commit 8d8af90

Please sign in to comment.