feat: Chats umbenennen (#1187); fix: ausgeblendete Elemente wirklich unsichtbar, Denkstufe nur bei bestätigtem Test (#1188); Version 0.1.17-rc4
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHhg6sxZ8wsKZAVLQ6Xj5
This commit is contained in:
@ -1411,7 +1411,7 @@ const CHAT_JS: &str = r#"(function () {
|
||||
return JSON.stringify(v);
|
||||
}
|
||||
function gleicherInhalt(a, b) {
|
||||
return a.titel === b.titel && !!a.angeheftet === !!b.angeheftet &&
|
||||
return a.titel === b.titel && !!a.titelManuell === !!b.titelManuell && !!a.angeheftet === !!b.angeheftet &&
|
||||
kanonisch(a.nachrichten) === kanonisch(b.nachrichten);
|
||||
}
|
||||
// Der Server hat einen neueren Stand (zum Beispiel aus einem anderen Tab): Nichts wird überschrieben. Der
|
||||
@ -1588,7 +1588,8 @@ const CHAT_JS: &str = r#"(function () {
|
||||
}
|
||||
c.nachrichten = messages.slice();
|
||||
c.konfigs = Object.assign({}, konfigs);
|
||||
c.titel = titelVon(messages);
|
||||
// Ein von Hand vergebener Name bleibt (Umbenennen); sonst kommt der Titel aus der ersten Frage.
|
||||
c.titel = c.titelManuell && c.titel ? c.titel : titelVon(messages);
|
||||
c.zeit = Date.now();
|
||||
chatAufServer(c);
|
||||
zeichneListe();
|
||||
@ -1620,6 +1621,40 @@ const CHAT_JS: &str = r#"(function () {
|
||||
titel.textContent = (c.titel || "Ohne Titel") + (ausstehend.speichern[c.id] ? " (ungesichert)" : "");
|
||||
titel.setAttribute("aria-current", c.id === aktuell ? "true" : "false");
|
||||
titel.addEventListener("click", function () { oeffnen(c.id); });
|
||||
var name = document.createElement("button");
|
||||
name.type = "button";
|
||||
name.className = "sm";
|
||||
name.textContent = "Umbenennen";
|
||||
name.setAttribute("aria-label", "Chat umbenennen: " + (c.titel || "Ohne Titel"));
|
||||
name.addEventListener("click", function () {
|
||||
var feld = document.createElement("input");
|
||||
feld.type = "text";
|
||||
feld.className = "titel-eingabe";
|
||||
feld.value = c.titel || "";
|
||||
feld.maxLength = 120;
|
||||
feld.setAttribute("aria-label", "Neuer Name des Chats");
|
||||
var fertig = false;
|
||||
function uebernehmen(speichern) {
|
||||
if (fertig) { return; }
|
||||
fertig = true;
|
||||
var neu = feld.value.trim();
|
||||
if (speichern && neu && neu !== c.titel) {
|
||||
c.titel = neu;
|
||||
c.titelManuell = true;
|
||||
c.zeit = Date.now();
|
||||
chatAufServer(c);
|
||||
}
|
||||
zeichneListe();
|
||||
}
|
||||
feld.addEventListener("keydown", function (e) {
|
||||
if (e.key === "Enter") { e.preventDefault(); uebernehmen(true); }
|
||||
else if (e.key === "Escape") { e.preventDefault(); uebernehmen(false); }
|
||||
});
|
||||
feld.addEventListener("blur", function () { uebernehmen(true); });
|
||||
li.replaceChild(feld, titel);
|
||||
feld.focus();
|
||||
feld.select();
|
||||
});
|
||||
var pin = document.createElement("button");
|
||||
pin.type = "button";
|
||||
pin.className = "sm";
|
||||
@ -1645,6 +1680,7 @@ const CHAT_JS: &str = r#"(function () {
|
||||
chatLoeschen(c);
|
||||
});
|
||||
li.appendChild(titel);
|
||||
li.appendChild(name);
|
||||
li.appendChild(pin);
|
||||
li.appendChild(weg);
|
||||
liste.appendChild(li);
|
||||
|
||||
Reference in New Issue
Block a user