diff sat_frontends/jp/xmlui_manager.py @ 2783:442ab697f831

frontends, jp, templates: added XHTMLBox widget: for jp, the XHTML is rendered for now using markdown.
author Goffi <goffi@goffi.org>
date Sat, 19 Jan 2019 11:39:02 +0100
parents 003b8b4b56a7
children 18a98a541f7a
line wrap: on
line diff
--- a/sat_frontends/jp/xmlui_manager.py	Sat Jan 19 11:39:02 2019 +0100
+++ b/sat_frontends/jp/xmlui_manager.py	Sat Jan 19 11:39:02 2019 +0100
@@ -238,6 +238,18 @@
     type = u"textbox"
 
 
+class XHTMLBoxWidget(xmlui_base.XHTMLBoxWidget, StringWidget):
+    type = u"xhtmlbox"
+
+    def show(self):
+        # FIXME: we use bridge in a blocking way as permitted by python-dbus
+        #        this only for now to make it simpler, it must be refactored
+        #        to use async when jp will be fully async (expected for 0.8)
+        self.value = self.host.bridge.syntaxConvert(
+            self.value, C.SYNTAX_XHTML, "markdown", False, self.host.profile)
+        super(XHTMLBoxWidget, self).show()
+
+
 class ListWidget(xmlui_base.ListWidget, OptionsWidget):
     type = u"list"
     # TODO: handle flags, notably multi