From 79b1cc2c70fd43b02c8b81274e512320513533b8 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Wed, 3 Jan 2018 16:01:03 -0200 Subject: [PATCH] Merge pull request #9311 from RocketChat/fix-svg-firefox [FIX] svg render on firefox --- packages/rocketchat-ui-master/client/main.js | 2 ++ packages/rocketchat-ui/client/components/icon.html | 2 +- packages/rocketchat-ui/client/components/icon.js | 7 +++++++ packages/rocketchat-ui/package.js | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 packages/rocketchat-ui/client/components/icon.js diff --git a/packages/rocketchat-ui-master/client/main.js b/packages/rocketchat-ui-master/client/main.js index 05d98df004f2..74a41c42339d 100644 --- a/packages/rocketchat-ui-master/client/main.js +++ b/packages/rocketchat-ui-master/client/main.js @@ -4,6 +4,8 @@ import s from 'underscore.string'; RocketChat.settings.collection.find({_id:/theme-color-rc/i}, {fields:{ value: 1 }}).observe({changed: () => { DynamicCss.run(true); }}); +this.isFirefox = navigator.userAgent.match(/Firefox\/(\d+)\.\d/); + Template.body.onRendered(function() { new Clipboard('.clipboard'); diff --git a/packages/rocketchat-ui/client/components/icon.html b/packages/rocketchat-ui/client/components/icon.html index d875feb5db3e..fd29bd068e08 100644 --- a/packages/rocketchat-ui/client/components/icon.html +++ b/packages/rocketchat-ui/client/components/icon.html @@ -1,5 +1,5 @@ diff --git a/packages/rocketchat-ui/client/components/icon.js b/packages/rocketchat-ui/client/components/icon.js new file mode 100644 index 000000000000..c16c92c2c1c8 --- /dev/null +++ b/packages/rocketchat-ui/client/components/icon.js @@ -0,0 +1,7 @@ +/* globals isFirefox */ + +const firefoxBaseUrlFix = () => `${ window.location.origin }${ FlowRouter.current().path }`; + +Template.icon.helpers({ + baseUrl: isFirefox && isFirefox[1] < 55 ? firefoxBaseUrlFix : undefined +}); diff --git a/packages/rocketchat-ui/package.js b/packages/rocketchat-ui/package.js index f23eb29a3608..2c9994250719 100644 --- a/packages/rocketchat-ui/package.js +++ b/packages/rocketchat-ui/package.js @@ -120,6 +120,7 @@ Package.onUse(function(api) { api.addFiles('client/views/app/photoswipe.js', 'client'); api.addFiles('client/components/icon.html', 'client'); + api.addFiles('client/components/icon.js', 'client'); api.addFiles('client/components/popupList.html', 'client'); api.addFiles('client/components/popupList.js', 'client');