1
0
Эх сурвалжийг харах

fix ui.html and ui.markdown

Falko Schindler 2 жил өмнө
parent
commit
cce9df0411

+ 2 - 2
nicegui/elements/markdown.py

@@ -41,6 +41,6 @@ class Markdown(ContentElement):
     def on_content_change(self, content: str) -> None:
         html = markdown2.markdown(content, extras=self.extras)
         html = apply_tailwind(html)  # we need explicit markdown styling because tailwind CSS removes all default styles
-        if self._text != html:
-            self._text = html
+        if self._props.get('innerHTML') != html:
+            self._props['innerHTML'] = html
             self.update()

+ 1 - 1
nicegui/elements/mixins/content_element.py

@@ -31,5 +31,5 @@ class ContentElement(Element):
     def on_content_change(self, content: str) -> None:
         if '</script>' in content:
             raise ValueError('HTML elements must not contain <script> tags. Use ui.add_body_html() instead.')
-        self._text = content
+        self._props['innerHTML'] = content
         self.update()