Stupid simple indication of text copied to the clipboard

This commit is contained in:
2021-08-03 14:46:10 -06:00
parent 772913e702
commit efb9608fad
2 changed files with 17 additions and 2 deletions

View File

@ -12,7 +12,8 @@ let app = new Vue({
],
inputBox: "ccc\n#4f46e5\n#db2777aa\n",
copyInput: "",
showStatusMessage: false,
showErrorMessage: false,
hexRegex: /^\#?[a-f0-9]{3,9}/i,
rgbRegex: /^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)/i,
@ -375,8 +376,20 @@ console.error('hexa to HSLa not implemented yet');
},
updateClipboard: function (text) {
let _this = this;
clipboard.writeText(text).then(() => {
console.log('text copied!');
_this.showErrorMessage = false;
_this.showStatusMessage = true;
setTimeout(() => {
_this.showStatusMessage = false;
}, 1000);
})
.catch(() => {
_this.showStatusMessage = false;
_this.showErrorMessage = true;
setTimeout(() => {
_this.showErrorMessage = false;
}, 1000);
});
},
},