2018-02-07 18:06:07 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2020-08-25 07:20:16 +00:00
|
|
|
import { withTranslation } from 'react-i18next';
|
2016-08-11 17:24:02 +00:00
|
|
|
|
2016-08-11 17:29:30 +00:00
|
|
|
class EditorAccessibility extends React.Component {
|
2016-08-11 17:24:02 +00:00
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
}
|
|
|
|
render() {
|
2017-02-22 19:29:35 +00:00
|
|
|
const messages = [];
|
2016-08-11 19:38:32 +00:00
|
|
|
if (this.props.lintMessages.length > 0) {
|
2016-08-24 21:54:26 +00:00
|
|
|
this.props.lintMessages.forEach((lintMessage, i) => {
|
2018-05-09 01:35:18 +00:00
|
|
|
messages.push((
|
|
|
|
<li key={lintMessage.id}>
|
|
|
|
{lintMessage.severity} in line
|
|
|
|
{lintMessage.line} :
|
|
|
|
{lintMessage.message}
|
|
|
|
</li>));
|
2016-08-24 21:54:26 +00:00
|
|
|
});
|
2016-08-11 19:38:32 +00:00
|
|
|
} else {
|
2020-08-25 07:20:16 +00:00
|
|
|
messages.push(<li key={0}>{this.props.t('EditorAccessibility.NoLintMessages')}</li>);
|
2016-08-11 17:24:02 +00:00
|
|
|
}
|
|
|
|
return (
|
2016-08-11 19:38:32 +00:00
|
|
|
<div className="editor-accessibility">
|
2016-08-11 20:02:21 +00:00
|
|
|
<ul className="editor-lintmessages" title="lint messages">
|
2016-08-11 17:24:02 +00:00
|
|
|
{messages}
|
|
|
|
</ul>
|
2020-08-25 07:20:16 +00:00
|
|
|
<p> {this.props.t('EditorAccessibility.CurrentLine')}
|
2016-08-25 16:32:06 +00:00
|
|
|
<span className="editor-linenumber" aria-live="polite" aria-atomic="true" id="current-line"> </span>
|
2016-08-11 20:02:21 +00:00
|
|
|
</p>
|
2016-08-11 17:24:02 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-11 17:29:30 +00:00
|
|
|
EditorAccessibility.propTypes = {
|
2017-02-22 19:29:35 +00:00
|
|
|
lintMessages: PropTypes.arrayOf(PropTypes.shape({
|
|
|
|
severity: PropTypes.string.isRequired,
|
|
|
|
line: PropTypes.number.isRequired,
|
|
|
|
message: PropTypes.string.isRequired,
|
|
|
|
id: PropTypes.number.isRequired
|
|
|
|
})).isRequired,
|
2020-08-25 07:20:16 +00:00
|
|
|
t: PropTypes.func.isRequired
|
2016-08-11 17:24:02 +00:00
|
|
|
};
|
|
|
|
|
2020-08-25 07:20:16 +00:00
|
|
|
export default withTranslation()(EditorAccessibility);
|