mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
Added support for user selection of code block content for copy/paste.
This commit is contained in:
parent
d55f3d0f7a
commit
69773c2611
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user