diff --git a/packages/client/src/tiptap/menus/emoji/constants.ts b/packages/client/src/tiptap/menus/emoji/constants.ts deleted file mode 100644 index f178b3e..0000000 --- a/packages/client/src/tiptap/menus/emoji/constants.ts +++ /dev/null @@ -1,171 +0,0 @@ -export const EXPRESSIONES = [ - '๐Ÿ˜€', - '๐Ÿ˜ƒ', - '๐Ÿ˜„', - '๐Ÿ˜', - '๐Ÿ˜†', - '๐Ÿ˜…', - '๐Ÿ˜‚', - '๐Ÿคฃ', - '๐Ÿฅฒ', - '๐Ÿ˜Š', - '๐Ÿ˜‡', - '๐Ÿ™‚', - '๐Ÿ™ƒ', - '๐Ÿ˜‰', - '๐Ÿ˜Œ', - '๐Ÿ˜', - '๐Ÿฅฐ', - '๐Ÿ˜˜', - '๐Ÿ˜—', - '๐Ÿ˜™', - '๐Ÿ˜š', - '๐Ÿ˜‹', - '๐Ÿ˜›', - '๐Ÿ˜', - '๐Ÿ˜œ', - '๐Ÿคช', - '๐Ÿคจ', - '๐Ÿง', - '๐Ÿค“', - '๐Ÿ˜Ž', - '๐Ÿฅธ', - '๐Ÿคฉ', - '๐Ÿฅณ', - '๐Ÿ˜', - '๐Ÿ˜’', - '๐Ÿ˜ž', - '๐Ÿ˜”', - '๐Ÿ˜Ÿ', - '๐Ÿ˜•', - '๐Ÿ™', - '๐Ÿ˜ฃ', - '๐Ÿ˜–', - '๐Ÿ˜ซ', - '๐Ÿ˜ฉ', - '๐Ÿฅบ', - '๐Ÿ˜ข', - '๐Ÿ˜ญ', - '๐Ÿ˜ค', - '๐Ÿ˜ ', - '๐Ÿ˜ก', - '๐Ÿคฌ', - '๐Ÿคฏ', - '๐Ÿ˜ณ', - '๐Ÿฅต', - '๐Ÿฅถ', - '๐Ÿ˜ฑ', - '๐Ÿ˜จ', - '๐Ÿ˜ฐ', - '๐Ÿ˜ฅ', - '๐Ÿ˜“', - '๐Ÿค—', - '๐Ÿค”', - '๐Ÿคญ', - '๐Ÿคซ', - '๐Ÿคฅ', - '๐Ÿ˜ถ', - '๐Ÿ˜', - '๐Ÿ˜‘', - '๐Ÿ˜ฌ', - '๐Ÿ™„', - '๐Ÿ˜ฏ', - '๐Ÿ˜ฆ', - '๐Ÿ˜ง', - '๐Ÿ˜ฎ', - '๐Ÿ˜ฒ', - '๐Ÿฅฑ', - '๐Ÿ˜ด', - '๐Ÿคค', - '๐Ÿ˜ช', - '๐Ÿ˜ต', - '๐Ÿค', - '๐Ÿฅด', - '๐Ÿคข', - '๐Ÿคฎ', - '๐Ÿคง', - '๐Ÿ˜ท', - '๐Ÿค’', - '๐Ÿค•', - '๐Ÿค‘', - '๐Ÿค ', - '๐Ÿ˜ˆ', - '๐Ÿ‘ฟ', - '๐Ÿ‘น', - '๐Ÿ‘บ', - '๐Ÿคก', - '๐Ÿ’ฉ', - '๐Ÿ‘ป', - '๐Ÿ’€', - 'โ˜ ๏ธ', - '๐Ÿ‘ฝ', - '๐Ÿ‘พ', - '๐Ÿค–', - '๐ŸŽƒ', - '๐Ÿ˜บ', - '๐Ÿ˜ธ', - '๐Ÿ˜น', - '๐Ÿ˜ป', - '๐Ÿ˜ผ', - '๐Ÿ˜ฝ', - '๐Ÿ™€', - '๐Ÿ˜ฟ', - '๐Ÿ˜พ', -]; - -export const GESTURES = [ - '๐Ÿ‘‹', - '๐Ÿคš', - '๐Ÿ–', - 'โœ‹', - '๐Ÿ––', - '๐Ÿ‘Œ', - '๐ŸคŒ', - '๐Ÿค', - 'โœŒ๏ธ', - '๐Ÿคž', - '๐ŸคŸ', - '๐Ÿค˜', - '๐Ÿค™', - '๐Ÿ‘ˆ', - '๐Ÿ‘‰', - '๐Ÿ‘†', - '๐Ÿ–•', - '๐Ÿ‘‡', - 'โ˜๏ธ', - '๐Ÿ‘', - '๐Ÿ‘Ž', - 'โœŠ', - '๐Ÿ‘Š', - '๐Ÿค›', - '๐Ÿคœ', - '๐Ÿ‘', - '๐Ÿ™Œ', - '๐Ÿ‘', - '๐Ÿคฒ', - '๐Ÿค', - '๐Ÿ™', - 'โœ๏ธ', - '๐Ÿ’…', - '๐Ÿคณ', - '๐Ÿ’ช', - '๐Ÿฆพ', - '๐Ÿฆต', - '๐Ÿฆฟ', - '๐Ÿฆถ', - '๐Ÿ‘ฃ', - '๐Ÿ‘‚', - '๐Ÿฆป', - '๐Ÿ‘ƒ', - '๐Ÿซ€', - '๐Ÿซ', - '๐Ÿง ', - '๐Ÿฆท', - '๐Ÿฆด', - '๐Ÿ‘€', - '๐Ÿ‘', - '๐Ÿ‘…', - '๐Ÿ‘„', - '๐Ÿ’‹', - '๐Ÿฉธ', -]; diff --git a/packages/client/src/tiptap/menus/emoji/index.module.scss b/packages/client/src/tiptap/menus/emoji/index.module.scss deleted file mode 100644 index 3c2158f..0000000 --- a/packages/client/src/tiptap/menus/emoji/index.module.scss +++ /dev/null @@ -1,24 +0,0 @@ -.wrap { - height: 300px; - overflow: auto; -} - -.listWrap { - display: flex; - width: 320px; - padding: 0; - margin: 0; - list-style: none; - flex-wrap: wrap; - - > li { - display: flex; - justify-content: center; - align-items: center; - width: 32px; - height: 32px; - padding: 4px; - font-size: 24px; - cursor: pointer; - } -} diff --git a/packages/client/src/tiptap/menus/emoji/index.tsx b/packages/client/src/tiptap/menus/emoji/index.tsx index 0a77cf3..e95540d 100644 --- a/packages/client/src/tiptap/menus/emoji/index.tsx +++ b/packages/client/src/tiptap/menus/emoji/index.tsx @@ -1,63 +1,22 @@ import React, { useCallback } from 'react'; import { Editor } from '@tiptap/core'; -import { Popover, Button, Typography } from '@douyinfe/semi-ui'; +import { Button } from '@douyinfe/semi-ui'; import { Tooltip } from 'components/tooltip'; import { IconEmoji } from 'components/icons'; -import { EXPRESSIONES, GESTURES } from './constants'; -import styles from './index.module.scss'; - -const { Title } = Typography; - -const LIST = [ - { - title: '่กจๆƒ…', - data: EXPRESSIONES, - }, - { - title: 'ๆ‰‹ๅŠฟ', - data: GESTURES, - }, -]; +import { EmojiPicker } from 'components/emoji-picker'; export const Emoji: React.FC<{ editor: Editor }> = ({ editor }) => { const setEmoji = useCallback((emoji) => { - return () => { - const transaction = editor.state.tr.insertText(emoji); - editor.view.dispatch(transaction); - }; + const { selection } = editor.state; + const { $anchor } = selection; + return editor.chain().insertContentAt($anchor.pos, emoji).run(); }, []); return ( - - {LIST.map((item, index) => { - return ( -
- - {item.title} - - -
- ); - })} - - } - > - - -