Webpack: move Twemoji icons back to CopyPlugin
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light';
|
||||
import { joinPublicPath } from 'soapbox/utils/static';
|
||||
|
||||
export default class AutosuggestEmoji extends React.PureComponent {
|
||||
|
||||
@ -21,7 +22,7 @@ export default class AutosuggestEmoji extends React.PureComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
url = require(`twemoji/assets/svg/${mapping.filename}.svg`);
|
||||
url = joinPublicPath(`packs/emoji/${mapping.filename}.svg`);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@ -7,6 +7,7 @@ import classNames from 'classnames';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { supportsPassiveEvents } from 'detect-passive-events';
|
||||
import { buildCustomEmojis } from '../../emoji/emoji';
|
||||
import { joinPublicPath } from 'soapbox/utils/static';
|
||||
|
||||
const messages = defineMessages({
|
||||
emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' },
|
||||
@ -357,7 +358,7 @@ class EmojiPickerDropdown extends React.PureComponent {
|
||||
<img
|
||||
className={classNames('emojione', { 'pulse-loading': active && loading })}
|
||||
alt='😂'
|
||||
src={require('twemoji/assets/svg/1f602.svg')}
|
||||
src={joinPublicPath('packs/emoji/1f602.svg')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import unicodeMapping from './emoji_unicode_mapping_light';
|
||||
import Trie from 'substring-trie';
|
||||
import { joinPublicPath } from 'soapbox/utils/static';
|
||||
|
||||
const trie = new Trie(Object.keys(unicodeMapping));
|
||||
|
||||
@ -60,7 +61,7 @@ const emojify = (str, customEmojis = {}, autoplay = false) => {
|
||||
} else { // matched to unicode emoji
|
||||
const { filename, shortCode } = unicodeMapping[match];
|
||||
const title = shortCode ? `:${shortCode}:` : '';
|
||||
const src = require(`twemoji/assets/svg/${filename}.svg`);
|
||||
const src = joinPublicPath(`packs/emoji/${filename}.svg`);
|
||||
replacement = `<img draggable="false" class="emojione" alt="${match}" title="${title}" src="${src}" />`;
|
||||
rend = i + match.length;
|
||||
// If the matched character was followed by VS15 (for selecting text presentation), skip it.
|
||||
|
||||
11
app/soapbox/utils/static.js
Normal file
11
app/soapbox/utils/static.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Static: functions related to static files.
|
||||
* @module soapbox/utils/static
|
||||
*/
|
||||
|
||||
import { join } from 'path';
|
||||
import { FE_SUBDIRECTORY } from 'soapbox/build_config';
|
||||
|
||||
export const joinPublicPath = (...paths) => {
|
||||
return join(FE_SUBDIRECTORY, ...paths);
|
||||
};
|
||||
Reference in New Issue
Block a user