Merge pull request #9311 from RocketChat/fix-svg-firefox

[FIX] svg render on firefox
pull/8800/merge
Rodrigo Nascimento 8 years ago committed by GitHub
commit dde0c2f4e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/rocketchat-ui-master/client/main.js
  2. 2
      packages/rocketchat-ui/client/components/icon.html
  3. 7
      packages/rocketchat-ui/client/components/icon.js
  4. 1
      packages/rocketchat-ui/package.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');

@ -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>

@ -0,0 +1,7 @@
/* globals isFirefox */
const firefoxBaseUrlFix = () => `${ window.location.origin }${ FlowRouter.current().path }`;
Template.icon.helpers({
baseUrl: isFirefox && isFirefox[1] < 55 ? firefoxBaseUrlFix : undefined
});

@ -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');

Loading…
Cancel
Save