diff --git a/zephyr/lib/bugdown/__init__.py b/zephyr/lib/bugdown/__init__.py index b5bb65d028..6e1f99ee72 100644 --- a/zephyr/lib/bugdown/__init__.py +++ b/zephyr/lib/bugdown/__init__.py @@ -99,13 +99,14 @@ class InlineImagePreviewProcessor(markdown.treeprocessors.Treeprocessor): def run(self, root): image_urls = self.find_images(root) for (url, link) in image_urls: - a = markdown.util.etree.SubElement(root, "a") + div = markdown.util.etree.SubElement(root, "div") + div.set("class", "message_inline_image"); + a = markdown.util.etree.SubElement(div, "a") a.set("href", link) a.set("target", "_blank") a.set("title", link) img = markdown.util.etree.SubElement(a, "img") img.set("src", url) - img.set("class", "message_inline_image") return root diff --git a/zephyr/static/styles/zephyr.css b/zephyr/static/styles/zephyr.css index c617a2cb84..3e7e221ce6 100644 --- a/zephyr/static/styles/zephyr.css +++ b/zephyr/static/styles/zephyr.css @@ -803,6 +803,10 @@ table.floating_recipient { height: 100px; } +.message_inline_image img { + height: 100%; +} + .actions_popover a { cursor: pointer; } diff --git a/zephyr/tests.py b/zephyr/tests.py index 96466d6811..82cbf37c50 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -2172,38 +2172,38 @@ xxxxxxx
\nxxxxxxx xxxxx xxxx xxxxx:
\nxxxxxx
: xxx
msg = 'Google logo today: https://www.google.com/images/srpr/logo4w.png\nKinda boring'
converted = convert(msg)
- self.assertEqual(converted, '
Google logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boring
Google logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boring
Google logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boringGoogle logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boring
Google logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boringGoogle logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boring
Check out the debate: http://www.youtube.com/watch?v=hx1mjT73xYE
\n') + self.assertEqual(converted, 'Check out the debate: http://www.youtube.com/watch?v=hx1mjT73xYE
\n ') def test_inline_dropbox(self): msg = 'Look at how hilarious our old office was: https://www.dropbox.com/s/ymdijjcg67hv2ta/IMG_0923.JPG' converted = convert(msg) - self.assertEqual(converted, 'Look at how hilarious our old office was: https://www.dropbox.com/s/ymdijjcg67hv2ta/IMG_0923.JPG
\n') + self.assertEqual(converted, 'Look at how hilarious our old office was: https://www.dropbox.com/s/ymdijjcg67hv2ta/IMG_0923.JPG
\n ') msg = 'Look at my hilarious drawing: https://www.dropbox.com/sh/inlugx9d25r314h/JYwv59v4Jv/credit_card_rushmore.jpg' converted = convert(msg) - self.assertEqual(converted, 'Look at my hilarious drawing: https://www.dropbox.com/sh/inlugx9d25r314h/JYwv59v4Jv/credit_card_rushmore.jpg
\n') + self.assertEqual(converted, 'Look at my hilarious drawing: https://www.dropbox.com/sh/inlugx9d25r314h/JYwv59v4Jv/credit_card_rushmore.jpg
\n ') # Make sure we're not overzealous in our conversion: msg = 'Look at the new dropbox logo: https://www.dropbox.com/static/images/home_logo.png' converted = convert(msg) - self.assertEqual(converted, 'Look at the new dropbox logo: https://www.dropbox.com/static/images/home_logo.png
\n') + self.assertEqual(converted, 'Look at the new dropbox logo: https://www.dropbox.com/static/images/home_logo.png
\n ') def test_inline_interesting_links(self): def make_link(url):