From 5a91457a5b8595969957cd6676afc2fff858251e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Aug 2020 17:19:37 +0200 Subject: HTML Created events now have a description. Unfortunately they ALWAYS have a description. --- static/script.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'static/script.js') diff --git a/static/script.js b/static/script.js index 32bc3b4b..c2ea07c1 100644 --- a/static/script.js +++ b/static/script.js @@ -471,6 +471,28 @@ function place_in_edit_mode (event) { summary.replaceWith(input); + /* ---------------------------------------- */ + + let descs = popup.getElementsByClassName("description"); + if (descs.length === 1) { + let description = descs[0]; + let textarea = makeElement('textarea', { + name: "description", + placeholder: description.innerText, + required: false, + }); + + textarea.oninput = function () { + event.properties["description"] = this.value; + } + + let slot = event.properties["_slot_description"] + let idx = slot.findIndex(e => e[0] === description); + slot.splice(idx, 1, [input, (s, v) => s.innerHTML = v]) + + description.replaceWith(textarea); + } + /* ---------------------------------------- */ let submit = makeElement( 'input', { -- cgit v1.2.3