mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-31 07:08:40 -04:00

* Change copyright year from 2020 to 2021 Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * Change copyright year in jetbrains copyright template Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { ForkAwesomeIcons } from '../../../editor/editor-pane/tool-bar/emoji-picker/icon-names'
|
|
import emojiData from 'emojibase-data/en/compact.json'
|
|
|
|
interface EmojiEntry {
|
|
shortcodes: string[]
|
|
unicode: string
|
|
}
|
|
|
|
type ShortCodeMap = { [key: string]: string }
|
|
|
|
const shortCodeMap = (emojiData as unknown as EmojiEntry[])
|
|
.reduce((reduceObject, emoji) => {
|
|
emoji.shortcodes.forEach(shortcode => {
|
|
reduceObject[shortcode] = emoji.unicode
|
|
})
|
|
return reduceObject
|
|
}, {} as ShortCodeMap)
|
|
|
|
const emojiSkinToneModifierMap = [1, 2, 3, 4, 5]
|
|
.reduce((reduceObject, modifierValue) => {
|
|
const lightSkinCode = 127995
|
|
const codepoint = lightSkinCode + (modifierValue - 1)
|
|
const shortcode = `skin-tone-${modifierValue}`
|
|
reduceObject[shortcode] = `&#${codepoint};`
|
|
return reduceObject
|
|
}, {} as ShortCodeMap)
|
|
|
|
const forkAwesomeIconMap = Object.keys(ForkAwesomeIcons)
|
|
.reduce((reduceObject, icon) => {
|
|
const shortcode = `fa-${icon}`
|
|
// noinspection CheckTagEmptyBody
|
|
reduceObject[shortcode] = `<i class="fa fa-${icon}"></i>`
|
|
return reduceObject
|
|
}, {} as ShortCodeMap)
|
|
|
|
export const combinedEmojiData = {
|
|
...shortCodeMap,
|
|
...emojiSkinToneModifierMap,
|
|
...forkAwesomeIconMap
|
|
}
|