neue json Struktur
This commit is contained in:
@@ -152,6 +152,22 @@
|
||||
console.log("FShow content received, length", content.length);
|
||||
const el = document.querySelector("textarea#GCodeWindow.editor-look");
|
||||
if (el) el.value = content;
|
||||
} else if (data.startsWith("{")) {
|
||||
try {
|
||||
const json = JSON.parse(data);
|
||||
if (json.programId === "log" && Array.isArray(json.lines)) {
|
||||
console.log("FShow JSON received, lines:", json.lines.length, "cursor:", json.cursor);
|
||||
const el = document.getElementById("GCodeWindow");
|
||||
if (el) {
|
||||
el.value = json.lines.join("\n");
|
||||
// Scroll to cursor line
|
||||
const lineHeight = el.scrollHeight / json.lines.length;
|
||||
el.scrollTop = Math.max(0, (json.cursor - 5)) * lineHeight;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("DATA:", Date.now() - startTime, data);
|
||||
}
|
||||
} else {
|
||||
console.log("DATA:", Date.now() - startTime, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user