Skip to content

Commit

Permalink
Merge pull request #9311 from RocketChat/fix-svg-firefox
Browse files Browse the repository at this point in the history
[FIX] svg render on firefox
  • Loading branch information
rodrigok committed Jan 3, 2018
1 parent f070358 commit 79b1cc2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/rocketchat-ui-master/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/components/icon.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template name="icon">
<svg class="rc-icon {{block}} {{block}}--{{icon}} {{classes}}" aria-hidden="true">
<use xlink:href="#icon-{{icon}}"></use>
<use xlink:href="{{baseUrl}}#icon-{{icon}}"></use>
</svg>
</template>
7 changes: 7 additions & 0 deletions packages/rocketchat-ui/client/components/icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* globals isFirefox */

const firefoxBaseUrlFix = () => `${ window.location.origin }${ FlowRouter.current().path }`;

Template.icon.helpers({
baseUrl: isFirefox && isFirefox[1] < 55 ? firefoxBaseUrlFix : undefined
});
1 change: 1 addition & 0 deletions packages/rocketchat-ui/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 79b1cc2

Please sign in to comment.