Skip to content

Commit

Permalink
Version 1.1.3
Browse files Browse the repository at this point in the history
• Fix copy of empty lines
  • Loading branch information
Martinomagnifico committed Nov 1, 2023
1 parent 50856c9 commit 88c1d13
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [1.1.3] - 2023-11-01

### Changed
- Fixed copy of empty lines in code blocks.

## [1.1.2] - 2023-06-30

### Changed
Expand Down
21 changes: 5 additions & 16 deletions css/demo.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:root {
--r-heading-text-transform: none ;
--r-background-color: #1a1626;
--r-background-color: #051525;
--r-main-font-size: 40px;
}

Expand All @@ -16,11 +16,11 @@
}

.backgrounds {
background: #1a1626;
background: var(--r-background-color);
}

.reveal.overview section {
background: #1a1626;
background: var(--r-background-color);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
Expand Down Expand Up @@ -126,8 +126,8 @@ p a[href*=html], p a[href*=http] {
}

a.github-corner {
position: absolute;
z-index: 1;
position: fixed;
z-index: 2;
width: clamp(50px, 8vmax, 80px);
line-height: 0;
color: rgba(255, 255, 255, 0.5);
Expand Down Expand Up @@ -209,15 +209,4 @@ em[class*=animate] {
display: inline-block;
width: 1.2em;
text-align: right;
}

.testarea {
z-index: 999;
position: absolute;
}

textarea#test {
margin: 0;
min-height: 100px;
min-width: 400px;
}
2 changes: 1 addition & 1 deletion demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<section>
<h1>CopyCode</h1>
<h3>for Reveal.js</h3><br>
<pre><code class="hljs javascript" data-line-numbers style="font-size: 1em">let why = `Because we always want to copy code
<pre><code class="hljs javascript" data-line-numbers style="font-size: 1em">let why = `Because we always want to copy code
during our presentations, right?`</code></pre>
</section>
<section>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reveal.js-copycode",
"version": "1.1.2",
"version": "1.1.3",
"main": "plugin/copycode/copycode.js",
"module": "plugin/copycode/copycode.esm.js",
"description": "A simple plugin for Reveal.js 4, that automatically shows a copy button in code blocks",
Expand Down
4 changes: 2 additions & 2 deletions plugin/copycode/copycode.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* https://github.com/Martinomagnifico
*
* CopyCode.js for Reveal.js
* Version 1.1.2
* Version 1.1.3
*
* @license
* MIT licensed
Expand Down Expand Up @@ -179,7 +179,7 @@ const Plugin = () => {
preblocks.forEach(preblock => buildStructure(preblock));
let clipboard = options.plaintextonly == true ? new ClipboardJS(".codeblock > button", {
text: function (trigger) {
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s*\n/gm, "");
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s+|\s+$/g, "");
}
}) : new ClipboardJS(".codeblock > button", {
target(_ref) {
Expand Down
4 changes: 2 additions & 2 deletions plugin/copycode/copycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* https://github.com/Martinomagnifico
*
* CopyCode.js for Reveal.js
* Version 1.1.2
* Version 1.1.3
*
* @license
* MIT licensed
Expand Down Expand Up @@ -185,7 +185,7 @@
preblocks.forEach(preblock => buildStructure(preblock));
let clipboard = options.plaintextonly == true ? new ClipboardJS(".codeblock > button", {
text: function (trigger) {
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s*\n/gm, "");
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s+|\s+$/g, "");
}
}) : new ClipboardJS(".codeblock > button", {
target(_ref) {
Expand Down
2 changes: 1 addition & 1 deletion plugin/copycode/plugin-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const Plugin = () => {
let clipboard = options.plaintextonly == true ?
new ClipboardJS(".codeblock > button", {
text: function(trigger) {
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s*\n/gm, "");
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s+|\s+$/g, "");
}}) :
new ClipboardJS(".codeblock > button", {
target({nextElementSibling}) {
Expand Down

0 comments on commit 88c1d13

Please sign in to comment.