This commit is contained in:
nate smith 2024-03-09 16:41:46 -08:00
parent 2d6a417028
commit 367ee97400
2 changed files with 19 additions and 4 deletions

View File

@ -324,10 +324,25 @@ class ThemeToggler extends HTMLAnchorElement {
}
}
// TODO bug: if pinned then moved, pin button loses bold
class PoemSaver extends HTMLFormElement {
// TODO oops, you can't copy an image on ff; disable copy if image selected
connectedCallback() {
this.querySelectorAll("input[name=type]").forEach((e) => {
e.addEventListener("change", (e) => {
if (e.target.value == "image") {
this.querySelector("button.copy").setAttribute("disabled", true);
} else {
this.querySelector("button").removeAttribute("disabled");
}
});
});
const fd = new FormData(this);
if (fd.get("type") == "image") {
this.querySelector("button.copy").setAttribute("disabled", true);
}
this.addEventListener("submit", (e) => {
e.preventDefault();
const fd = new FormData(e.target);

View File

@ -50,8 +50,6 @@ span.linetext {
<span class="linetext"></span>
<p is="source-text"></p>
</template>
<script src="/html2canvas.min.js"></script>
<script src="/main.js"></script>
<h1 style="display:block;margin:0">Trunkless</h1>
<p style="margin-top:0;font-size:80%">
<a href="/about">about</a>
@ -64,8 +62,8 @@ span.linetext {
<input name="type" value="text" type="radio" checked />as text
<input name="type" value="image" type="radio"/>as image
<input name="sources" type="checkbox"/>include sources
<button type="submit">copy</button>
<button type="submit">save</button>
<button class="copy" type="submit">copy</button>
<button class="save" type="submit">save</button>
</form>
</div>
<div style="border: 1px solid grey; padding: 5px">
@ -77,5 +75,7 @@ span.linetext {
<button is="line-adder" title="add line">+</button>
</div>
</div>
<script src="/html2canvas.min.js"></script>
<script src="/main.js"></script>
</body>
</html>