1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

Add comments & remove redundant check

This commit is contained in:
David Baker
2017-06-08 14:53:21 +01:00
parent b40636a425
commit 71eb405859
2 changed files with 11 additions and 7 deletions

View File

@@ -365,6 +365,11 @@ export function bodyToHtml(content, highlights, opts) {
}
function addCodeCopyButton(safeBody) {
// Adds 'copy' buttons to pre blocks
// Note that this only manipulates the markup to add the buttons:
// we need to add the event handlers once the nodes are in the DOM
// since we can't save functions in the markup.
// This is done in TextualBody
const el = document.createElement("div");
el.innerHTML = safeBody;
const codeBlocks = Array.from(el.getElementsByTagName("pre"));