Permalink
Browse files

Add .pdf image placeholder

For any other browser then Safari we want to show that pdf images
inline are not supported. Closes
framer/company#1637
  • Loading branch information...
koenbok committed May 10, 2016
1 parent ea52737 commit 7d32c8d858c0ce9030dbe86b6ef6d215ec65b37c
Showing with 7 additions and 2 deletions.
  1. +5 −0 framer/Layer.coffee
  2. +2 −2 framer/Utils.coffee
@@ -654,6 +654,11 @@ class exports.Layer extends BaseClass
@style["background-image"] = null
return
# Show placeholder image on any browser that doesn't support inline pdf
if _.endsWith(value.toLowerCase?(), ".pdf") and not (Utils.isSafari() or Utils.isFramerStudio())
@style["background-image"] = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAVlJREFUaAXtlwEOwiAMRdF4Cr3/0fQaSre9ZFSYLCrQpSSG/FLW9v92agghXJdP3KZlCp/J2up+WiUuzMt6zNukzPDYvALCsKme1/maV8BnQHqw9/IZ6KmAz0BP9ontMwATPXafgR6s65g+A5qRlrhmBu6FhG6LXf9/+JU/YclROkVWEs/8r9FLrChb2apSqVqWZgKmtRKz9/f+CdPxoVl8CAWylcWKUQZGwfhjB3OOHcw5djDn2MH6fBNLC42yaEnyoTXB2V36+lPlz+zN9x6HKfxrZwZ/HUbf5/lJviMpoBPWBWWxFJCtLNqplItIWuvPffx5Dphz7GB9vonNv4X2zICWuMTM3p7Gv/b5iVLmFaiZgb3M/Ns/Ud68AvIGkJ6ir8xh8wrQrzAve9Jjo2PzCsC8z4Aw0WP5DPRgXcf07wHNSEvsM9CS7VIsn4ESMy3sPgMtWN6K8QKfubDo2UqVogAAAABJRU5ErkJggg==')"
return
imageUrl = value
# Optional base image value
@@ -292,10 +292,10 @@ Utils.webkitVersion = ->
version
Utils.isChrome = ->
(/chrome/).test(navigator.userAgent.toLowerCase())
return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor)
Utils.isSafari = ->
(/safari/).test(navigator.userAgent.toLowerCase())
return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor)
Utils.isTouch = ->
window.ontouchstart is null and

0 comments on commit 7d32c8d

Please sign in to comment.