changeset 292:1a5dc08c2749

browser_side: set the ideal width for the rich text dialog when displayed in the unibox panel
author souliane <souliane@mailoo.org>
date Tue, 10 Dec 2013 14:03:47 +0100
parents 89818bca1a33
children 7c79d4d66161
files browser_side/panels.py public/libervia.css
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/panels.py	Tue Dec 10 13:04:51 2013 +0100
+++ b/browser_side/panels.py	Tue Dec 10 14:03:47 2013 +0100
@@ -90,6 +90,7 @@
         self.host.panel._contactsMove(self)
 
         def onCloseCallback():
+            Window.removeWindowResizeListener(self)
             self.host.panel._contactsMove(self.host.panel._hpanel)
             self.setCellWidth(self.unibox, '100%')
             self.button.setVisible(True)
@@ -97,8 +98,15 @@
             self.host.resize()
 
         richtext.RichTextEditor.getOrCreate(self.host, self, onCloseCallback)
+        Window.addWindowResizeListener(self)
         self.host.resize()
 
+    def onWindowResized(self, width, height):
+        right = self.host.panel.menu.getAbsoluteLeft() + self.host.panel.menu.getOffsetWidth()
+        left = self.host.panel._contacts.getAbsoluteLeft() + self.host.panel._contacts.getOffsetWidth()
+        ideal_width = right - left - 40
+        self.host.richtext.setWidth("%spx" % ideal_width)
+
 
 class UniBox(TextArea, MouseHandler): #AutoCompleteTextBox):
     """This text box is used as a main typing point, for message, microblog, etc"""
--- a/public/libervia.css	Tue Dec 10 13:04:51 2013 +0100
+++ b/public/libervia.css	Tue Dec 10 14:03:47 2013 +0100
@@ -1202,11 +1202,8 @@
 /* Rich Text Editor */
 
 .richTextEditor {
-	width: 600px;
-	max-width:600px;
-	min-width: 600px;
-	margin-top: 9px;
-	margin-left:18px;
+	width: 100%;
+	margin: 9px 18px;
 }
 
 .richTextToolbar {