mirror of
https://github.com/Av0idD4rk/packmate.git
synced 2026-10-25 13:29:24 +00:00
Добавил кнопку копирования как текст
This commit is contained in:
parent
98870edb1d
commit
ba3e3e3b92
@ -2,6 +2,7 @@
|
|||||||
<div class="packet" :class="{'packet-incoming': isIncoming}">
|
<div class="packet" :class="{'packet-incoming': isIncoming}">
|
||||||
<div>#{{id}} at {{new Date(timestamp).toLocaleDateString('ru-RU', {month: '2-digit', day: '2-digit', hour:'2-digit', minute: '2-digit', second: '2-digit'})}}
|
<div>#{{id}} at {{new Date(timestamp).toLocaleDateString('ru-RU', {month: '2-digit', day: '2-digit', hour:'2-digit', minute: '2-digit', second: '2-digit'})}}
|
||||||
<button @click.prevent="copyRaw" class="btn btn-link">Copy HEX</button>
|
<button @click.prevent="copyRaw" class="btn btn-link">Copy HEX</button>
|
||||||
|
<button @click.prevent="copyText" class="btn btn-link">Copy text</button>
|
||||||
<button @click.prevent="copyPythonBytes" class="btn btn-link">Copy as Python bytes </button></div>
|
<button @click.prevent="copyPythonBytes" class="btn btn-link">Copy as Python bytes </button></div>
|
||||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-2 pb-2 mb-3 border-bottom">
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-2 pb-2 mb-3 border-bottom">
|
||||||
<pre>{{ hexdata }}</pre>
|
<pre>{{ hexdata }}</pre>
|
||||||
@ -47,6 +48,9 @@ export default {
|
|||||||
copyRaw() {
|
copyRaw() {
|
||||||
this.copyContent(Buffer.from(this.$props.content, 'base64').toString('hex'));
|
this.copyContent(Buffer.from(this.$props.content, 'base64').toString('hex'));
|
||||||
},
|
},
|
||||||
|
copyText() {
|
||||||
|
this.copyContent(atob(this.$props.content));
|
||||||
|
},
|
||||||
copyContent(data) {
|
copyContent(data) {
|
||||||
const tempEl = document.createElement('textarea');
|
const tempEl = document.createElement('textarea');
|
||||||
tempEl.value = data; // Chrome
|
tempEl.value = data; // Chrome
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user