-
-
Notifications
You must be signed in to change notification settings - Fork 754
feat: replace @emoji-mart/data with @blocknote/emoji-data, add emoji i18n #2903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nperez0111
wants to merge
5
commits into
main
Choose a base branch
from
feat/emoji-localization-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5eeca2f
feat: add @blocknote/emoji-data package with localized emoji support
nperez0111 3ebb3cd
feat: add localized emoji search with compact positional encoding
nperez0111 522840c
fix: add locale aliases for no→nb and zh-tw→zh-hant emoji data
nperez0111 7fb8dce
feat: add best-effort emoji i18n for ar, fa, he, hr, is, sk, uz
nperez0111 0387630
feat: add best-effort localized emoji search for ar, fa, he, hr, is, …
nperez0111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| export const en = { | ||
| locale: "en", | ||
| slash_menu: { | ||
| heading: { | ||
| title: "Heading 1", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| # @blocknote/emoji-data | ||
|
|
||
| Trimmed, localized emoji dataset for [BlockNote](https://www.blocknotejs.org), compatible with [emoji-mart](https://github.com/missive/emoji-mart). | ||
|
|
||
| This package replaces `@emoji-mart/data` with a smaller, i18n-capable dataset built from [emojibase](https://emojibase.dev). It provides: | ||
|
|
||
| - **Emoji dataset** — ~1,900 emojis in emoji-mart's native data format, with keyword search support | ||
| - **28 locale files** — Localized category names, skin-tone labels, and UI strings, each individually importable for minimal bundle impact | ||
| - **Automatic localization** — When using BlockNote, the emoji picker automatically localizes based on the editor's `dictionary.locale` | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install @blocknote/emoji-data | ||
| ``` | ||
|
|
||
| > **Note:** If you're using BlockNote, this package is already included as a dependency of `@blocknote/core` — you don't need to install it separately. The emoji picker automatically uses the locale from your editor's dictionary. | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Emoji data | ||
|
|
||
| ```ts | ||
| import { emojiData } from "@blocknote/emoji-data"; | ||
| import { init } from "emoji-mart"; | ||
|
|
||
| await init({ data: emojiData }); | ||
| ``` | ||
|
|
||
| ### Loading a locale dynamically | ||
|
|
||
| Use `loadEmojiLocale()` to load only the locale you need at runtime: | ||
|
|
||
| ```ts | ||
| import { emojiData, loadEmojiLocale } from "@blocknote/emoji-data"; | ||
| import { init } from "emoji-mart"; | ||
|
|
||
| const i18n = await loadEmojiLocale("fr"); | ||
| await init({ data: emojiData, i18n }); | ||
| ``` | ||
|
|
||
| This dynamically imports only the requested locale file (~0.5KB gzipped), not all 28. | ||
|
|
||
| ### Importing a specific locale directly | ||
|
|
||
| Each locale has its own entry point: | ||
|
|
||
| ```ts | ||
| import { fr } from "@blocknote/emoji-data/locales/fr"; | ||
| ``` | ||
|
|
||
| Or import multiple from the barrel: | ||
|
|
||
| ```ts | ||
| import { fr, de } from "@blocknote/emoji-data/locales"; | ||
| ``` | ||
|
|
||
| Available locales: `bn`, `da`, `de`, `en`, `enGb`, `es`, `esMx`, `et`, `fi`, `fr`, `hi`, `hu`, `it`, `ja`, `ko`, `lt`, `ms`, `nb`, `nl`, `pl`, `pt`, `ru`, `sv`, `th`, `uk`, `vi`, `zh`, `zhHant`. | ||
|
|
||
| ## Regenerating the data | ||
|
|
||
| The emoji dataset and locale files are generated from [emojibase-data](https://www.npmjs.com/package/emojibase-data) and [@emoji-mart/data](https://www.npmjs.com/package/@emoji-mart/data) (build-time only). To regenerate: | ||
|
|
||
| ```bash | ||
| pnpm --filter @blocknote/emoji-data generate-emoji-data | ||
| ``` | ||
|
|
||
| ## Bundle size | ||
|
|
||
| | Entry | Raw | Gzipped | | ||
| | -------------------- | ------- | ------- | | ||
| | Emoji data | 280 KB | 63 KB | | ||
| | Single locale | ~0.7 KB | ~0.5 KB | | ||
| | All locales (barrel) | 22 KB | 6 KB | | ||
|
|
||
| Compare to `@emoji-mart/data`: 27 MB installed, 432 KB runtime (native set). | ||
|
|
||
| ## Types | ||
|
|
||
| The package exports the following types: | ||
|
|
||
| - `EmojiMartData` — The top-level data object (categories, emojis, aliases, sheet) | ||
| - `Emoji` — A single emoji entry (id, name, keywords, skins) | ||
| - `EmojiSkin` — A skin variant ({ native: string }) | ||
| - `EmojiCategory` — A category ({ id, emojis: string[] }) | ||
| - `EmojiI18n` — The i18n locale object shape |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| { | ||
| "name": "@blocknote/emoji-data", | ||
| "homepage": "https://github.com/TypeCellOS/BlockNote", | ||
| "private": false, | ||
| "sideEffects": false, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/TypeCellOS/BlockNote.git", | ||
| "directory": "packages/emoji-data" | ||
| }, | ||
| "license": "MPL-2.0", | ||
| "version": "0.52.1", | ||
| "files": [ | ||
| "dist", | ||
| "types", | ||
| "src" | ||
| ], | ||
| "keywords": [ | ||
| "emoji", | ||
| "emoji-mart", | ||
| "blocknote", | ||
| "i18n" | ||
| ], | ||
| "description": "Trimmed, localized emoji dataset for BlockNote (emoji-mart compatible, built from emojibase).", | ||
| "type": "module", | ||
| "source": "src/index.ts", | ||
| "types": "./types/src/index.d.ts", | ||
| "main": "./dist/blocknote-emoji-data.cjs", | ||
| "module": "./dist/blocknote-emoji-data.js", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./types/src/index.d.ts", | ||
| "import": "./dist/blocknote-emoji-data.js", | ||
| "require": "./dist/blocknote-emoji-data.cjs" | ||
| }, | ||
| "./locales": { | ||
| "types": "./types/src/i18n/index.d.ts", | ||
| "import": "./dist/locales.js", | ||
| "require": "./dist/locales.cjs" | ||
| }, | ||
| "./locales/*": { | ||
| "types": "./types/src/i18n/locales/*.d.ts", | ||
| "import": "./dist/locales/*.js", | ||
| "require": "./dist/locales/*.cjs" | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "dev": "vp dev", | ||
| "lint": "vp lint src", | ||
| "clean": "rimraf dist && rimraf types", | ||
| "generate-emoji-data": "node scripts/generate.mjs" | ||
| }, | ||
| "dependencies": {}, | ||
| "devDependencies": { | ||
| "@emoji-mart/data": "^1.2.1", | ||
| "emojibase-data": "^16.0.1", | ||
| "rimraf": "^5.0.10", | ||
| "rollup-plugin-webpack-stats": "^0.2.6", | ||
| "typescript": "^5.9.3", | ||
| "vite-plus": "catalog:" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.