mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-15 06:01:30 +03:00
Explicitly declare cli and use alt attribute for images
This commit is contained in:
parent
2b432a7718
commit
b68ea48444
2 changed files with 10 additions and 8 deletions
|
@ -177,7 +177,7 @@ export default class MFileBody extends React.Component {
|
||||||
<div className="mx_MFileBody_info">
|
<div className="mx_MFileBody_info">
|
||||||
<span className="mx_MFileBody_info_icon" >
|
<span className="mx_MFileBody_info_icon" >
|
||||||
{this.props.isExporting ?
|
{this.props.isExporting ?
|
||||||
<img className="mx_export_attach_icon" src="icons/attach.svg" />
|
<img alt="Attachment" className="mx_export_attach_icon" src="icons/attach.svg" />
|
||||||
: null}
|
: null}
|
||||||
</span>
|
</span>
|
||||||
<span className="mx_MFileBody_info_filename">{this.presentableTextForFile(content, false)}</span>
|
<span className="mx_MFileBody_info_filename">{this.presentableTextForFile(content, false)}</span>
|
||||||
|
|
|
@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {useContext} from "react";
|
import React, { useContext } from "react";
|
||||||
import {MatrixClient} from "matrix-js-sdk/src/client";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {formatFullDate} from "../../../DateUtils";
|
import { formatFullDate } from "../../../DateUtils";
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
mxEvent: MatrixEvent;
|
mxEvent: MatrixEvent;
|
||||||
|
@ -28,8 +29,9 @@ interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const RedactedBody = React.forwardRef<any, IProps>(({mxEvent, isExporting}, ref) => {
|
const RedactedBody = React.forwardRef<any, IProps>(({mxEvent, isExporting}, ref) => {
|
||||||
const cli: MatrixClient = useContext(MatrixClientContext);
|
let cli: MatrixClient = useContext(MatrixClientContext);
|
||||||
|
// As context doesn't propagate during export, we'll have to explicitly declare
|
||||||
|
if (isExporting) cli = MatrixClientPeg.get();
|
||||||
let text = _t("Message deleted");
|
let text = _t("Message deleted");
|
||||||
const unsigned = mxEvent.getUnsigned();
|
const unsigned = mxEvent.getUnsigned();
|
||||||
const redactedBecauseUserId = unsigned && unsigned.redacted_because && unsigned.redacted_because.sender;
|
const redactedBecauseUserId = unsigned && unsigned.redacted_because && unsigned.redacted_because.sender;
|
||||||
|
@ -45,7 +47,7 @@ const RedactedBody = React.forwardRef<any, IProps>(({mxEvent, isExporting}, ref)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className="mx_RedactedBody" ref={ref} title={titleText}>
|
<span className="mx_RedactedBody" ref={ref} title={titleText}>
|
||||||
{ isExporting ? <img className="mx_export_trash_icon" src="icons/trash.svg" title="Redacted" /> : null }
|
{ isExporting ? <img alt="Redacted" className="mx_export_trash_icon" src="icons/trash.svg" /> : null }
|
||||||
{ text }
|
{ text }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue