Skip to content

Commit

Permalink
fix: copy code-samples included \n\r characters
Browse files Browse the repository at this point in the history
fixes #296
  • Loading branch information
RomanHotsiy committed Aug 2, 2017
1 parent 8193194 commit cd962fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/shared/components/CopyButton/copy-button.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export class CopyButton implements OnInit {
onClick() {
let copied;
if (this.copyText) {
copied = Clipboard.copyCustom(JSON.stringify(this.copyText, null, 2));
const text = (typeof this.copyText === 'string')
? this.copyText
: JSON.stringify(this.copyText, null, 2);
copied = Clipboard.copyCustom(text);
} else {
copied = Clipboard.copyElement(this.copyElement);
}
Expand Down

0 comments on commit cd962fa

Please sign in to comment.