Mercurial > libervia-web
comparison src/browser/sat_browser/blog.py @ 771:102050e489fa
browser_side (blog): fixes syntax conversion
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 26 Nov 2015 18:31:01 +0100 |
parents | e67d8c13ba22 |
children | 2970b8af3cd7 |
comparison
equal
deleted
inserted
replaced
770:e67d8c13ba22 | 771:102050e489fa |
---|---|
241 | 241 |
242 if self.mode in ENTRY_RICH: | 242 if self.mode in ENTRY_RICH: |
243 # TODO: if the user change his parameters after the message edition started, | 243 # TODO: if the user change his parameters after the message edition started, |
244 # the message syntax could be different then the current syntax: pass the | 244 # the message syntax could be different then the current syntax: pass the |
245 # message syntax in mb_data for the frontend to use it instead of current syntax. | 245 # message syntax in mb_data for the frontend to use it instead of current syntax. |
246 self.item.content_rich = content['text'] | 246 self.item.content_rich = content['text'] # XXX: this also works if the syntax is XHTML |
247 self.item.title = content['title'] | 247 self.item.title = content['title'] |
248 self.item.tags = list(common.dict2iter('tag', content)) | 248 self.item.tags = list(common.dict2iter('tag', content)) |
249 else: | 249 else: |
250 self.item.content = content['text'] | 250 self.item.content = content['text'] |
251 | 251 |
307 def _changeMode(self, original_content, text): | 307 def _changeMode(self, original_content, text): |
308 self.mode = C.ENTRY_MODE_RICH if self.mode == C.ENTRY_MODE_TEXT else C.ENTRY_MODE_TEXT | 308 self.mode = C.ENTRY_MODE_RICH if self.mode == C.ENTRY_MODE_TEXT else C.ENTRY_MODE_TEXT |
309 if self.mode in ENTRY_RICH and not text: | 309 if self.mode in ENTRY_RICH and not text: |
310 text = ' ' # something different than empty string is needed to initialize the rich text editor | 310 text = ' ' # something different than empty string is needed to initialize the rich text editor |
311 self.item.content = text | 311 self.item.content = text |
312 if self.mode in ENTRY_RICH: | |
313 self.item.content_rich = text # XXX: this also works if the syntax is XHTML | |
314 self.bubble.setDisplayContent() # needed in case the edition is aborted, to not end with an empty bubble | |
315 else: | |
316 self.item.content_xhtml = '' | |
312 self.bubble.removeFromParent() | 317 self.bubble.removeFromParent() |
313 self._setBubble() | 318 self._setBubble() |
314 self.bubble.setOriginalContent(original_content) | 319 self.bubble.setOriginalContent(original_content) |
315 if self.mode in ENTRY_RICH: | |
316 self.item.content_xhtml = text | |
317 self.bubble.setDisplayContent() # needed in case the edition is aborted, to not end with an empty bubble | |
318 else: | |
319 self.item.content_xhtml = '' | |
320 | 320 |
321 def toggleContentSyntax(self): | 321 def toggleContentSyntax(self): |
322 """Toggle the editor between raw and rich text""" | 322 """Toggle the editor between raw and rich text""" |
323 original_content = self.bubble.getOriginalContent() | 323 original_content = self.bubble.getOriginalContent() |
324 rich = self.mode in ENTRY_RICH | 324 rich = self.mode in ENTRY_RICH |