Emoji多端统一处理

介绍

项目中在聊天页面,要求实现一个类似 youtubeemoji 功能,发送后能消息界面,多端显示一致 显示

需求分析

一个富文本框,支持输入文字,插入 emoji 转成 img ,同时在发送时转成字符串,接收消息,将字符串转成 document node 在页面显示

约定格式

const dataList = [
  {
  'GroupID': 'g1',
  'Groupname_EN': 'people',
  'Groupname_CN': '人物',
  'Childrens': []
  },
  {
    'GroupID': 'g2',
    'Groupname_EN': 'nature',
    'Groupname_CN': '自然',
    'Childrens': [
      {
      'ID': 'g2_1',
      'Unicode': 'u1f436',
      'Name_CN': '狗臉',
      'Name_EN': 'dog_face',
      'Url': 'emoji_u1f436.png',
      'Group': 'g2',
      'CorlorID': '',
      'Key': '🐶'
      }
    ]
  }
]

emoji类实现

参考

Last updated

Was this helpful?