Skip to content

Commit

Permalink
added copy button
Browse files Browse the repository at this point in the history
added row default
  • Loading branch information
A1Gard committed Jul 15, 2023
1 parent 1bff93d commit c6f5961
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions assets/js/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ var app = new Vue({
method: 'get', // default methods
old: '',
flds: [
{"type":"row","name":"","label":"","size":12,"id":"","options":"","others":[]}
], // list of field
// type of inputs
typ: [
Expand Down Expand Up @@ -607,6 +608,14 @@ var app = new Vue({
},
changeTheme: function () {
},
copy: function () {
var dummyInput = document.createElement('textarea');
document.body.appendChild(dummyInput);
dummyInput.value = document.querySelector('#code').innerText;
dummyInput.select();
document.execCommand('copy');
document.body.removeChild(dummyInput);
},
},

});
Expand Down
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,12 @@ <h4 class="ui dividing header">Elements</h4>
</div>

<div class="ui segment inverted">
<h2>
<h2 >
Generated Code
<div class="right floated ui button olive" @click="copy">
&nbsp;
<i class="copy outline icon"></i>
</div>
</h2>
<pre id="code">
{{code}}
Expand Down

0 comments on commit c6f5961

Please sign in to comment.