Mercurial > libervia-web
changeset 356:b95099a1d11b
browser_side: do not use addURLToText to display Microblog XHTML content
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 13 Feb 2014 12:53:07 +0100 |
parents | 9bb78c09e9fc |
children | 2b5503392fbd |
files | browser_side/base_panels.py browser_side/richtext.py |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <enter> 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:
--- 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'])