Fix TextualBody.js to remove NodeList.forEach()

Not all browsers support forEach() on NodeList objects. This causes crashes on some browsers, such as IE and FF<50.
This commit is contained in:
adi1 2018-02-22 13:59:37 +01:00 committed by GitHub
parent 663c7e5285
commit f2e1c0ebca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -337,7 +337,7 @@ module.exports = React.createClass({
_addCodeCopyButton() { _addCodeCopyButton() {
// Add 'copy' buttons to pre blocks // Add 'copy' buttons to pre blocks
ReactDOM.findDOMNode(this).querySelectorAll('.mx_EventTile_body pre').forEach((p) => { Array.from(ReactDOM.findDOMNode(this).querySelectorAll('.mx_EventTile_body pre')).forEach((p) => {
const button = document.createElement("span"); const button = document.createElement("span");
button.className = "mx_EventTile_copyButton"; button.className = "mx_EventTile_copyButton";
button.onclick = (e) => { button.onclick = (e) => {