1
0

Added "Copy to clipboard" to resume editor page

This commit is contained in:
Michael Gordeev
2019-12-14 10:17:30 +03:00
parent 453d31145b
commit e91f2f9c8c
2 changed files with 16 additions and 2 deletions
@@ -19,6 +19,8 @@
<div> <div>
<label asp-for="Content"></label> <label asp-for="Content"></label>
<textarea asp-for="Content" spellcheck="false"></textarea> <textarea asp-for="Content" spellcheck="false"></textarea>
<a class="comment" onclick="CopyToClipboard()" href="#">// &#xE16D; Copy to clipboard</a>
<span style="display: none" id="copied"> - Done</span><br />
<span asp-validation-for="Content" class="text-danger"></span> <span asp-validation-for="Content" class="text-danger"></span>
</div> </div>
<br /> <br />
@@ -34,4 +36,15 @@
textarea { textarea {
min-height: 500px; min-height: 500px;
} }
</style> </style>
<script type="text/javascript">
async function CopyToClipboard() {
text = document.getElementById("Content");
text.select();
document.execCommand("copy");
window.getSelection().removeAllRanges();
document.getElementById("copied").style.display = "initial";
await delay(3000);
document.getElementById("copied").style.display = "none";
}
</script>
+2 -1
View File
@@ -1,4 +1,5 @@
function ToggleMenu() const delay = ms => new Promise(res => setTimeout(res, ms));
function ToggleMenu()
{ {
var menu = document.getElementsByClassName("main-menu")[0]; var menu = document.getElementsByClassName("main-menu")[0];