Mercurial > libervia-web
changeset 759:34f066ed3b23
browser_side: replaced mbdata2tags and tags2mbdata by sat.tools.common.dict2iter and iter2dict
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 24 Nov 2015 23:26:55 +0100 |
parents | f725cc49e996 |
children | 78caef6ed8e7 |
files | src/browser/sat_browser/richtext.py |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/sat_browser/richtext.py Tue Nov 24 22:49:25 2015 +0100 +++ b/src/browser/sat_browser/richtext.py Tue Nov 24 23:26:55 2015 +0100 @@ -21,6 +21,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger log = getLogger(__name__) +from sat.tools import common from pyjamas.ui.TextArea import TextArea from pyjamas.ui.Button import Button @@ -39,8 +40,6 @@ import html_tools import list_manager -from sat_frontends.quick_frontend import quick_blog - class RichTextEditor(editor_widget.BaseTextEditor, FlexTable): """Panel for the rich text editor.""" @@ -100,7 +99,7 @@ self.display = editor_widget.HTMLTextEditor(options={'enhance_display': False, 'listen_keyboard': False}) # for display mode for listener in self.edit_listeners: self.display.addEditListener(listener) - + if not self.read_only and not hasattr(self, 'textarea'): self.textarea = EditTextArea(self) # for edition mode self.textarea.addStyleName(self.STYLE['textarea']) @@ -266,7 +265,7 @@ if hasattr(self, 'title_panel'): content.update({'title': self.strproc(self.title_panel.getText())}) if hasattr(self, 'tags_panel'): - content.update(quick_blog.tags2mbdata(self.tags_panel.getTags())) + common.iter2dict('tag', self.tags_panel.getTags(), content) return content def edit(self, edit=False, abort=False, sync=False): @@ -297,13 +296,13 @@ content.update({'text': text}) content.update({'syntax': syntax}) self.textarea.setText(content['text']) - + if hasattr(self, 'title_panel') and 'title' in content: self.title_panel.setText(content['title']) self.title_panel.setStackVisible(0, content['title'] != '') if hasattr(self, 'tags_panel'): - tags = quick_blog.mbdata2tags(content) + tags = list(common.dict2iter('tag', content)) self.tags_panel.setTags(tags) self.tags_panel.setStackVisible(0, len(tags) > 0) @@ -325,7 +324,7 @@ text = content['text'] if 'title' in content and content['title']: text = '<h1>%s</h1>%s' % (html_tools.html_sanitize(content['title']), text) - tags = quick_blog.mbdata2tags(content) + tags = list(common.dict2iter('tag', content)) if tags: # FIXME: display it more beautiful text = '%s<h3>%s %s</h3>' % (text, _("Tags:"), html_tools.html_sanitize(", ".join(tags))) self.display.setContent({'text': text})