Mercurial > libervia-web
diff src/browser/sat_browser/editor_widget.py @ 803:89a0cd2aa763
browser_side: convertNewLinesToXHTML should only be called on raw text messages:
- some people use \n to aerate the text but don't necessarily want to see them as <br />
- method expandNewLinesToXHTML in backend finds the best out both editing styles
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 10 Dec 2015 13:30:27 +0100 |
parents | f3cd261ea12f |
children | f8a7a046ff9c |
line wrap: on
line diff
--- a/src/browser/sat_browser/editor_widget.py Thu Dec 10 11:19:46 2015 +0100 +++ b/src/browser/sat_browser/editor_widget.py Thu Dec 10 13:30:27 2015 +0100 @@ -225,6 +225,8 @@ class SimpleTextEditor(BaseTextEditor, FocusHandler, keyb.KeyboardHandler, ClickHandler): """Base class for manage a simple text editor.""" + CONVERT_NEW_LINES = True + def __init__(self, content=None, modifiedCb=None, afterEditCb=None, options=None): """ @param content @@ -289,7 +291,9 @@ text = strings.addURLToImage(text) if self.options['enhance_display']: text = strings.addURLToText(text) - self.display.setHTML(html_tools.convertNewLinesToXHTML(text)) + if self.CONVERT_NEW_LINES: + text = html_tools.convertNewLinesToXHTML(text) + self.display.setHTML(text) def setFocus(self, focus): raise NotImplementedError @@ -325,6 +329,8 @@ class HTMLTextEditor(SimpleTextEditor, HTML, FocusHandler, keyb.KeyboardHandler): """Manage a simple text editor with the HTML 5 "contenteditable" property.""" + CONVERT_NEW_LINES = False # overwrite definition in SimpleTextEditor + def __init__(self, content=None, modifiedCb=None, afterEditCb=None, options=None): HTML.__init__(self) SimpleTextEditor.__init__(self, content, modifiedCb, afterEditCb, options)