# HG changeset patch # User souliane # Date 1392292387 -3600 # Node ID b95099a1d11bba0c8d7017446e4830eff58971b7 # Parent 9bb78c09e9fc68b4d355bc4761912b8f721497ca browser_side: do not use addURLToText to display Microblog XHTML content diff -r 9bb78c09e9fc -r b95099a1d11b browser_side/base_panels.py --- a/browser_side/base_panels.py Thu Feb 13 10:32:26 2014 +0100 +++ b/browser_side/base_panels.py Thu Feb 13 12:53:07 2014 +0100 @@ -418,19 +418,21 @@ class LightTextEditor(BaseTextEditor, HTML, FocusHandler, KeyboardHandler): """Manage a simple text editor whith the HTML 5 "contenteditable" property.""" - def __init__(self, content=None, modifiedCb=None, afterEditCb=None, single_line=False): + def __init__(self, content=None, modifiedCb=None, afterEditCb=None, single_line=False, enhance_display=True): """ @param content @param modifiedCb @param afterEditCb @param single_line: set to True to manage a single line editor. In that case the edition would be terminated when the focus is lost or key is pressed. + @param enhance_display: if True, the display text will be enhanced with addURLToText """ HTML.__init__(self) if single_line: FocusHandler.__init__(self) KeyboardHandler.__init__(self) self.__single_line = single_line + self.__enhance_display = enhance_display strproc = lambda text: html_sanitize(html_strip(text)) if self.__single_line else html_strip(text) BaseTextEditor.__init__(self, content, strproc, modifiedCb, afterEditCb) @@ -459,7 +461,7 @@ self.removeKeyboardListener(self) def setDisplayContent(self): - self.setHTML(addURLToText(self._original_content['text'])) + self.setHTML(addURLToText(self._original_content['text']) if self.__enhance_display else self._original_content['text']) def setFocus(self, focus): if focus: diff -r 9bb78c09e9fc -r b95099a1d11b browser_side/richtext.py --- a/browser_side/richtext.py Thu Feb 13 10:32:26 2014 +0100 +++ b/browser_side/richtext.py Thu Feb 13 12:53:07 2014 +0100 @@ -95,7 +95,7 @@ if hasattr(self, 'toolbar'): self.toolbar.setVisible(False) if not hasattr(self, 'display'): - self.display = LightTextEditor() # for display mode + self.display = LightTextEditor(enhance_display=False) # for display mode if not self.read_only and not hasattr(self, 'textarea'): self.textarea = TextArea() # for edition mode self.textarea.addStyleName(self.style['textarea'])