Added support for user selection of code block content for copy/paste.

This commit is contained in:
David Russell 2017-01-15 19:15:52 +07:00
parent d55f3d0f7a
commit 69773c2611

View File

@ -34,4 +34,26 @@
}
]
});
Reveal.configure({
keyboard: {
83: function() { // bind "s" key to "select" code block content
var currentSlide = Reveal.getCurrentSlide();
var preBlock = $(currentSlide).find("pre");
if(preBlock.length > 0) {
if (window.getSelection) {
var range = document.createRange();
range.selectNodeContents(preBlock[0]);
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
}
}
}
});
</script>