From 04d38e10733d5feaf2335fb7a0f5114a9cf42ff6 Mon Sep 17 00:00:00 2001 From: Hannah Kolbeck Date: Tue, 25 Jul 2023 19:55:18 -0700 Subject: [PATCH] Add a "Cut" button to in flight items --- src/in-flight.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/in-flight.js b/src/in-flight.js index 0043892..96c46d5 100644 --- a/src/in-flight.js +++ b/src/in-flight.js @@ -96,7 +96,7 @@ function buildInFlightItem(idx, chunk) { nameInput.type = "text" nameInput.placeholder = getLocalized("untitledName") nameInput.ariaLabel = getLocalized("nameLabel") - nameInput.onchange = () => inFlight[idx].name = nameInput.value + nameInput.onchange = () => MyAltTextOrg.inFlight[idx].name = nameInput.value outer.appendChild(nameInput) const charCounter = document.createElement("div") @@ -132,6 +132,17 @@ function buildInFlightItem(idx, chunk) { copyBtn.onclick = () => duplicateChunk(idx) controls.appendChild(copyBtn) + const cutButton = document.createElement("button") + cutButton.classList.add("page-button", "emoji-button") + cutButton.innerText = "✂️" + cutButton.title = "Cut" + cutButton.ariaLabel = "Cut text" + cutButton.onclick = async () => { + await navigator.clipboard.writeText(textArea.value) + removeInFlight(idx) + } + controls.appendChild(cutButton) + const saveBtn = document.createElement("button") saveBtn.classList.add("page-button", "emoji-button") saveBtn.innerText = "💾"