History

Use navigator.clipboard.writeText

Simon Legner committed 1 year ago

Commit ba294a11 parent 34220e62 files · +3 −22Browse files

Showing the changes to assets/javascripts/views (1 of 2 files). Show all

Unified · Split

assets/javascripts/views/content/entry_page.js+3−4
@@ -217,10 +217,9 @@ app.views.EntryPage = class EntryPage extends app.View { · 216 unmodified lines
217 this.load();217 this.load();
218 } else if (target.classList.contains("_pre-clip")) {218 } else if (target.classList.contains("_pre-clip")) {
219 $.stopEvent(event);219 $.stopEvent(event);
220 target.classList.add(220 navigator.clipboard.writeText(target.parentNode.textContent).then(
221 $.copyToClipboard(target.parentNode.textContent)221 () => target.classList.add("_pre-clip-success"),
222 ? "_pre-clip-success"222 () => target.classList.add("_pre-clip-error"),
223 : "_pre-clip-error",
224 );223 );
225 setTimeout(() => (target.className = "_pre-clip"), 2000);224 setTimeout(() => (target.className = "_pre-clip"), 2000);
226 }225 }