diff browser_side/panels.py @ 400:487dd238ab88

browser_side: bug fixes for microblog raw/rich edition toggle
author souliane <souliane@mailoo.org>
date Tue, 11 Mar 2014 13:53:19 +0100
parents 6148e9063069
children ea03f898067f
line wrap: on
line diff
--- a/browser_side/panels.py	Tue Mar 11 12:55:31 2014 +0100
+++ b/browser_side/panels.py	Tue Mar 11 13:53:19 2014 +0100
@@ -609,6 +609,8 @@
         """Toggle the editor between raw and rich text"""
         original_content = self.bubble.getOriginalContent()
         rich = not isinstance(self.bubble, richtext.RichTextEditor)
+        if rich:
+            original_content['syntax'] = Const.SYNTAX_XHTML
 
         def setBubble(text):
             self.content = text
@@ -617,6 +619,8 @@
             self.bubble.removeFromParent()
             self.__setBubble(True)
             self.bubble.setOriginalContent(original_content)
+            if rich:
+                self.bubble.setDisplayContent()  # needed in case the edition is aborted, to not end with an empty bubble
 
         text = self.bubble.getContent()['text']
         if not text: