fix and improve item editing #36
improve-item-edit into master clear text -> update deletes an item, two clicks. (if 'X' would directly delete the item, that can be easily lead to mis-clicks as the button is close to the 'update' button - sure, there can be other solutions (confirmation, swipe, delete-placement - but that one is quite simple and does the trick)
@ -71,1 +71,4 @@
.AppListClearButton {
border-right: none;
border-radius: 0 !important;
I think increasing selector specificity is usually better than !important
it is. however, for tiny things, well, don't make me think :)
@ -66,7 +66,12 @@ const mod = {
// INTERFACE
InterfaceEdit (index) {
if (document.getElementsByClassName('AppUpdate').length > 0) {
I think it's worth adding a comment here or making a named var. Also the commit message says ; this does not work?
i am not a fan of too many comments that easily get outdated (comments tend to not being updated by subsequent coders :)
but i changes the code so the gist get a bit clearer.
@ -78,2 +83,3 @@
form.innerHTML = `
<input class="AppListItemUpdateField AppListItemField" type="text" value="${ item.text }" autofocus />
<input class="AppListItemUpdateField AppListItemField" type="text" value="${ oldText }" autofocus />
<input class="AppListClearButton AppListItemButton" type="button" value="X" onclick="AppBehaviour.ControlDelete(${ index })" />
A hard-coded index looks fragile, but alright, good enough.
@ -82,3 +88,3 @@
event.preventDefault();
const response = document.querySelector(`#${ item.guid }-form .AppListItemUpdateField`).value;
const newText = document.querySelector(`#${ item.guid }-form .AppListItemUpdateField`).value.trim();
The trim() is now inconsistent with ControlCreate(). So if you create an item with spaces at the end, then edit it without changing anything, an update will be sent.
const titleText = document.getElementById('AppHeading').innerText;
webxdc.sendUpdate({
payload: { changes: [] },
document: titleText,
}, `New title: ${titleText}`);
document.getElementById('AppSaveTitleButton').style.display = 'none';
},
ControlExport () {
webxdc.sendToChat({
// Markdown-style
text:
document.getElementById('AppHeading').innerText + '\n\n' +
yip, ControlCreate should trim as well, i add a commit
4432ec7d3b
to c313bd5021
i go for a trashbin in the last commit, i think, the PR is good enough for now, we can iterate as needed
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?