提交 bf1b1e97 编写于 作者: J Joseph Pecoraro

Semi-fix for Firefox code Copy and Paste

The underlieing problem is that Firefox ignores the css 'white-space:pre'
rule when actually copying and pasting. This Javascript turns newlines
into <br /> tags inside the code containers.

This will run in Safari, Opera, Chrome, Webkit, etc. gracefully.
This will not run in IE due to IE not having the methods needed.

A permanent solution would be at the Markdown level in such a way that
the highlighter still runs on the output with brake tags.
上级 f68fca2e
function guideMenu(){
if (document.getElementById('guides').style.display == "none") {
document.getElementById('guides').style.display = "block";
} else {
document.getElementById('guides').style.display = "none";
}
}
// Fix Copy+Paste of Code blocks in Firefox 3
if ( window.addEventListener && document.getElementsByClassName ) {
window.addEventListener('load', function() {
var list = document.getElementsByClassName('code_container');
for (var i=0, len=list.length; i<len; i++) {
list[i].innerHTML = list[i].innerHTML.replace(/\n/g, '<br />');
}
}, false);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册