From 090295fc57c1e730b7cad7f60fcf2cb6a572bf3a Mon Sep 17 00:00:00 2001 From: Falko Schindler Date: Fri, 6 Aug 2021 17:18:05 +0200 Subject: [PATCH] demonstrate max_lines; minor improvements --- main.py | 2 +- nicegui/elements/log.js | 2 +- nicegui/elements/log.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index fe00ec193..26a9740a9 100755 --- a/main.py +++ b/main.py @@ -267,7 +267,7 @@ def button_increment(): with example(ui.log): from datetime import datetime - log = ui.log().classes('h-16') + log = ui.log(max_lines=10).classes('h-16') ui.button('Log time', on_click=lambda: log.push(datetime.now().strftime("%X.%f")[:-5])) with example(ui.joystick): diff --git a/nicegui/elements/log.js b/nicegui/elements/log.js index c171d1781..2c361a71b 100644 --- a/nicegui/elements/log.js +++ b/nicegui/elements/log.js @@ -7,7 +7,7 @@ Vue.component("log", { }, methods: { push(line) { - const decoded = decodeURI(line); + const decoded = decodeURIComponent(line); const textarea = document.getElementById(this.$props.jp_props.id); textarea.innerHTML += (num_lines ? "\n" : "") + decoded; textarea.scrollTop = textarea.scrollHeight; diff --git a/nicegui/elements/log.py b/nicegui/elements/log.py index c39b53cd7..6d0ff5c2e 100644 --- a/nicegui/elements/log.py +++ b/nicegui/elements/log.py @@ -22,7 +22,7 @@ def __init__(self, max_lines: int = None): super().__init__(LogView(max_lines=max_lines)) - self.classes('border whitespace-pre font-mono').style('opacity: 1 !important') + self.classes('border whitespace-pre font-mono').style('opacity: 1 !important; cursor: text !important') async def push_async(self, line: str):