Mercurial > libervia-web
comparison src/browser/sat_browser/richtext.py @ 716:3b91225b457a
server + browser side: blogging refactoring (draft), huge commit sorry:
/!\ everything is not working yet, group blog is not working for now
- adaptation to backend changes
- frontend commons part of blog have been moved to QuickFrontend
- (editors) button "WYSIWYG edition" renamed to "preview"
- (editors) Shift + [ENTER] is now used to send a text message, [ENTER] to finish a ligne normally
- (editors) fixed modifiers handling
- global simplification, resulting of the refactoring
- with backend refactoring, we are now using PEP again, XEP-0277 compatibility is restored \o/
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 16 Aug 2015 01:51:12 +0200 |
parents | 9877607c719a |
children | fe3c2357a8c9 |
comparison
equal
deleted
inserted
replaced
715:b2465423c76e | 716:3b91225b457a |
---|---|
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat_frontends.tools import composition | 20 from sat_frontends.tools import composition |
21 from sat.core.i18n import _ | 21 from sat.core.i18n import _ |
22 from sat.core.log import getLogger | |
23 log = getLogger(__name__) | |
22 | 24 |
23 from pyjamas.ui.TextArea import TextArea | 25 from pyjamas.ui.TextArea import TextArea |
24 from pyjamas.ui.Button import Button | 26 from pyjamas.ui.Button import Button |
25 from pyjamas.ui.CheckBox import CheckBox | 27 from pyjamas.ui.CheckBox import CheckBox |
26 from pyjamas.ui.DialogBox import DialogBox | 28 from pyjamas.ui.DialogBox import DialogBox |
155 self.toolbar = HorizontalPanel() | 157 self.toolbar = HorizontalPanel() |
156 self.toolbar.syntax = syntax | 158 self.toolbar.syntax = syntax |
157 self.toolbar.addStyleName(self.style['toolbar']) | 159 self.toolbar.addStyleName(self.style['toolbar']) |
158 for key in composition.RICH_SYNTAXES[syntax].keys(): | 160 for key in composition.RICH_SYNTAXES[syntax].keys(): |
159 self.addToolbarButton(syntax, key) | 161 self.addToolbarButton(syntax, key) |
160 self.wysiwyg_button = CheckBox(_('WYSIWYG edition')) | 162 self.wysiwyg_button = CheckBox(_('preview')) |
161 wysiywgCb = lambda sender: self.setWysiwyg(sender.getChecked()) | 163 wysiywgCb = lambda sender: self.setWysiwyg(sender.getChecked()) |
162 self.wysiwyg_button.addClickListener(wysiywgCb) | 164 self.wysiwyg_button.addClickListener(wysiywgCb) |
163 self.toolbar.add(self.wysiwyg_button) | 165 self.toolbar.add(self.wysiwyg_button) |
164 self.syntax_label = Label(_("Syntax: %s") % syntax) | 166 self.syntax_label = Label(_("Syntax: %s") % syntax) |
165 self.syntax_label.addStyleName("richTextSyntaxLabel") | 167 self.syntax_label.addStyleName("richTextSyntaxLabel") |
434 setContent(target, data) | 436 setContent(target, data) |
435 | 437 |
436 def __syncToUniBox(self, recipients=None, emptyText=False): | 438 def __syncToUniBox(self, recipients=None, emptyText=False): |
437 """Synchronize to unibox if a maximum of one recipient is set. | 439 """Synchronize to unibox if a maximum of one recipient is set. |
438 @return True if the sync could be done, False otherwise""" | 440 @return True if the sync could be done, False otherwise""" |
441 # FIXME: To be removed (unibox doesn't exist anymore) | |
439 if not self.host.uni_box: | 442 if not self.host.uni_box: |
440 return | 443 return |
441 setText = lambda: self.host.uni_box.setText("" if emptyText else self.getContent()['text']) | 444 setText = lambda: self.host.uni_box.setText("" if emptyText else self.getContent()['text']) |
442 if not hasattr(self, 'recipient'): | 445 if not hasattr(self, 'recipient'): |
443 setText() | 446 setText() |
534 KeyboardHandler.__init__(self) | 537 KeyboardHandler.__init__(self) |
535 self.addKeyboardListener(self) | 538 self.addKeyboardListener(self) |
536 | 539 |
537 def onKeyDown(self, sender=None, keycode=None, modifiers=None): | 540 def onKeyDown(self, sender=None, keycode=None, modifiers=None): |
538 for listener in self._parent.edit_listeners: | 541 for listener in self._parent.edit_listeners: |
539 listener(self, keycode) | 542 listener(self, keycode, modifiers) # FIXME: edit_listeners must either be removed, or send an action instead of keycode/modifiers |