Skip to content

Commit

Permalink
Version 1.1.1
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
Martinomagnifico committed Jun 8, 2023
1 parent 8945c3b commit 98b262e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Changelog

## [1.1.1] - 2023-06-xx

### Changed
- Fixed a bug where plaintext codeblocks indents got removed.


## [1.1.0] - 2023-05-21

### Added
- Added (SVG) icon option.
- Added border option.
- Added offset option.
- Added scale option.
- Added tooltip option.
- Added MarkDown example.
- Added Quarto compatibility.
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.0",
"version": "1.1.1",
"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
6 changes: 3 additions & 3 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.0
* Version 1.1.1
*
* @license
* MIT licensed
Expand Down Expand Up @@ -179,14 +179,14 @@ const Plugin = () => {
preblocks.forEach(preblock => buildStructure(preblock));
let clipboard = options.plaintextonly == true ? new ClipboardJS(".codeblock > button", {
text: function (trigger) {
return trigger.nextElementSibling.firstChild.textContent.replace(/^\s*\n/gm, "");
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s*\n/gm, "");
}
}) : new ClipboardJS(".codeblock > button", {
target(_ref) {
let {
nextElementSibling
} = _ref;
return nextElementSibling.firstChild.replace(/^\s*\n/gm, "");
return nextElementSibling.firstChild;
}

});
Expand Down
6 changes: 3 additions & 3 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.0
* Version 1.1.1
*
* @license
* MIT licensed
Expand Down Expand Up @@ -185,14 +185,14 @@
preblocks.forEach(preblock => buildStructure(preblock));
let clipboard = options.plaintextonly == true ? new ClipboardJS(".codeblock > button", {
text: function (trigger) {
return trigger.nextElementSibling.firstChild.textContent.replace(/^\s*\n/gm, "");
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s*\n/gm, "");
}
}) : new ClipboardJS(".codeblock > button", {
target(_ref) {
let {
nextElementSibling
} = _ref;
return nextElementSibling.firstChild.replace(/^\s*\n/gm, "");
return nextElementSibling.firstChild;
}

});
Expand Down
19 changes: 9 additions & 10 deletions plugin/copycode/plugin-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,19 @@ const Plugin = () => {

preblocks.forEach(preblock => buildStructure(preblock) );


let clipboard = options.plaintextonly == true ?
new ClipboardJS(".codeblock > button", {
text: function(trigger) {
return trigger.nextElementSibling.firstChild.textContent.replace(/^\s*\n/gm, "");
}}) :
new ClipboardJS(".codeblock > button", {
target({nextElementSibling}) {
return nextElementSibling.firstChild.replace(/^\s*\n/gm, "") ;
}}) ;
new ClipboardJS(".codeblock > button", {
text: function(trigger) {
return trigger.nextElementSibling.firstChild.innerText.replace(/^\s*\n/gm, "");
}}) :
new ClipboardJS(".codeblock > button", {
target({nextElementSibling}) {
return nextElementSibling.firstChild;
}}) ;


clipboard.on("success", e => {

let button = e.trigger;
e.clearSelection();

Expand Down

0 comments on commit 98b262e

Please sign in to comment.