From 3a08085c699af2f9aa64e9389af155bc9e98f015 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Mon, 17 Jun 2024 05:03:18 +0300 Subject: [PATCH] Add width and indent parameters for topic viewer --- clover/www/js/topics.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clover/www/js/topics.js b/clover/www/js/topics.js index ea792ba59..ef0b03c03 100644 --- a/clover/www/js/topics.js +++ b/clover/www/js/topics.js @@ -64,8 +64,11 @@ function viewTopic(topic) { } } - let txt = `
${counter} received
${YAML.stringify(msg)}`; // JSON.stringify(msg, null, 4); - topicMessage.innerHTML = txt; + let width = Number(params.width) || 100; + let indent = Number(params.indent) || 2; + let txt = YAML.stringify(msg, { lineWidth: width, indent: indent }); + let html = `
${counter} received
${txt}`; // JSON.stringify(msg, null, 4); + topicMessage.innerHTML = html; }); }