wechat-emoji-renderer
Version:
微信表情渲染器 - 支持 React、Vue3 和原生 JavaScript
69 lines (62 loc) • 1.91 kB
TypeScript
import React from 'react';
interface WechatEmojiRendererProps {
text: string;
emojiSize?: number;
bgScale?: number;
spriteUrl?: string;
className?: string;
style?: React.CSSProperties;
}
/**
* WeChat Emoji Renderer Component
* Renders text with emoji codes to display actual emoji icons
*/
declare const WechatEmojiRenderer: React.FC<WechatEmojiRendererProps>;
interface WechatEmoji {
name: string;
code: string;
position: [number, number];
}
interface EmojiPickerProps {
onSelectEmoji?: (emoji: WechatEmoji) => void;
emojiSize?: number;
bgScale?: number;
spriteUrl?: string;
className?: string;
style?: React.CSSProperties;
}
/**
* WeChat Emoji Picker Component
* Displays all available WeChat emojis for user selection
*/
declare const EmojiPicker: React.FC<EmojiPickerProps>;
/**
* Render WeChat emoji text to HTML string
* @param text text containing emoji codes
* @param options rendering options
* @returns rendered HTML string
*/
declare function renderWechatEmoji(text: string, options?: {
emojiSize?: number;
bgScale?: number;
spriteUrl?: string;
className?: string;
}): string;
/**
* Extract plain text from HTML containing emoji elements
* @param html HTML containing emoji elements
* @returns plain text string
*/
declare function extractTextFromHtml(html: string): string;
/**
* Copy text to clipboard
* @param text text to copy
* @returns Promise<boolean> whether copy was successful
*/
declare function copyToClipboard(text: string): Promise<boolean>;
/**
* Check if clipboard is supported
* @returns boolean indicating clipboard support
*/
declare function isClipboardSupported(): boolean;
export { EmojiPicker, type EmojiPickerProps, type WechatEmoji, WechatEmojiRenderer, type WechatEmojiRendererProps, copyToClipboard, extractTextFromHtml, isClipboardSupported, renderWechatEmoji };