v0.2.78
This commit is contained in:
1 parent
a6efa52f78
commit
0a269cf6fb
11 files changed
+437
-22
No files matched your search
@@ -9,6 +9,5 @@
|
||||
|
||||
// Generated from Unicode Emoji 17.0 emoji-test.txt.
|
||||
// Native glyphs use the platform emoji font (Apple style on Apple devices).
|
||||
export const EMOJI_GROUPS = [{ "name": "Smileys & Emotion", "items": [{ "emoji": "😀", "name": "grinning face", "keywords": "face smiling" }, { "emoji": "😃", "name": "grinning face with big eyes", "keywords": "face smiling" }, { "emoji": "😄", "name": "grinning face with smiling eyes", "keywords": "face smiling" }, { "emoji": "😁", "name": "beaming face with smiling eyes", "keywords": "face smiling" }, { "emoji": "😆", "name": "grinning squinting face", "keywords": "face smiling" }, { "emoji": "😅", "name": "grinning face with sweat", "keywords": "face smiling" }, { "emoji": "🤣", "name": "rolling on the floor laughing", "keywords": "face smiling" }, { "emoji": "😂", "name": "face with tears of joy", "keywords": "face smiling" }, { "emoji": "🙂", "name": "slightly smiling face", "keywords": "face smiling" }, { "emoji": "🙃", "name": "upside-down face", "keywords": "face smiling" }, { "emoji": "🫠", "name": "melting face", "keywords": "face smiling" }, { "emoji": "😉", "name": "winking face", "keywords": "face smiling" }, { "emoji": "😊", "name": "smiling face with smiling eyes", "keywords": "face smiling" }, { "emoji": "😇", "name": "smiling face with halo", "keywords": "face smiling" }, { "emoji": "🥰", "name": "smiling face with hearts", "keywords": "face affection" }, { "emoji": "😍", "name": "smiling face with heart-eyes", "keywords": "face affection" }, { "emoji": "🤩", "name": "star-struck", "keywords": "face affection" }, { "emoji": "😘", "name": "face blowing a kiss", "keywords": "face affection" }, { "emoji": "😗", "name": "kissing face", "keywords": "face affection" }, { "emoji": "☺️", "name": "smiling face", "keywords": "face affection" }, { "emoji": "😚", "name": "kissing face with closed eyes", "keywords": "face affection" }, { "emoji": "😙", "name": "kissing face with smiling eyes", "keywords": "face affection" }, { "emoji": "🥲", "name": "smiling face with tear", "keywords": "face affection" }, { "emoji": "😋", "name": "face savoring food", "keywords": "face tongue" }, { "emoji": "😛", "name": "face with tongue", "keywords": "face tongue" }, { "emoji": "😜", "name": "winking face with tongue", "keywords": "face tongue" }, { "emoji": "🤪", "name": "zany face", "keywords": "face tongue" }, { "emoji": "😝", "name": "squinting face with tongue", "keywords": "face tongue" }, { "emoji": "🤑", "name": "money-mouth face", "keywords": "face tongue" }, { "emoji": "🤗", "name": "smiling face with open hands", "keywords": "face hand" }, { "emoji": "🤭", "name": "face with hand over mouth", "keywords": "face hand" }, { "emoji": "🫢", "name": "face with open eyes and hand over mouth", "keywords": "face hand" }, { "emoji": "🫣", "name": "face with peeking eye", "keywords": "face hand" }, { "emoji": "🤫", "name": "shushing face", "keywords": "face hand" }, { "emoji": "🤔", "name": "thinking face", "keywords": "face hand" }, { "emoji": "🫡", "name": "saluting face", "keywords": "face hand" }, { "emoji": "🤐", "name": "zipper-mouth face", "keywords": "face neutral skeptical" }, { "emoji": "🤨", "name": "face with raised eyebrow", "keywords": "face neutral skeptical" }, { "emoji": "😐", "name": "neutral face", "keywords": "face neutral skeptical" }, { "emoji": "😑", "name": "expressionless face", "keywords": "face neutral skeptical" }, { "emoji": "😶", "name": "face without mouth", "keywords": "face neutral skeptical" }, { "emoji": "🫥", "name": "dotted line face", "keywords": "face neutral skeptical" }, { "emoji": "😶🌫️", "name": "face in clouds", "keywords": "face neutral skeptical" }, { "emoji": "😏", "name": "smirking face", "keywords": "face neutral skeptical" }, { "emoji": "😒", "name": "unamused face", "keywords": "face neutral skeptical" }, { "emoji": "🙄", "name": "face with rolling eyes", "keywords": "face neutral skeptical" }, { "emoji": "😬", "name": "grimacing face", "keywords": "face neutral skeptical" }, { "emoji": "😮💨", "name": "face exhaling", "keywords": "face neutral skeptical" }, { "emoji": "🤥", "name": "lying face", "keywords": "face neutral skeptical" }, { "emoji": "🫨", "name": "shaking face", "keywords": "face neutral skeptical" }, { "emoji": "🙂↔️", "name": "head shaking horizontally", "keywords": "face neutral skeptical" }, { "emoji": "🙂↕️", "name": "head shaking vertically", "keywords": "face neutral skeptical" }, { "emoji": "😌", "name": "relieved face", "keywords": "face sleepy" }, { "emoji": "😔", "name": "pensive face", "keywords": "face sleepy" }, { "emoji": "😪", "name": "sleepy face", "keywords": "face sleepy" }, { "emoji": "🤤", "name": "drooling face", "keywords": "face sleepy" }, { "emoji": "😴", "name": "sleeping face", "keywords": "face sleepy" }, { "emoji": "", "name": "face with bags under eyes", "keywords": "face sleepy" }, { "emoji": "😷", "name": "face with medical mask", "keywords": "face unwell" }, { "emoji": "Line truncated
|
||||
|
||||
export const EMOJI_SHORTCODES = { "+1": "👍", "-1": "👎", "100": "💯", "1st_place_medal": "🥇", "2nd_place_medal": "🥈", "3rd_place_medal": "🥉", "a_button_blood_type": "🅰️", "ab_button_blood_type": "🆎", "abacus": "🧮", "accordion": "🪗", "adhesive_bandage": "🩹", "admission_tickets": "🎟️", "aerial_tramway": "🚡", "airplane": "✈️", "airplane_arrival": "🛬", "airplane_departure": "🛫", "alarm_clock": "⏰", "alembic": "⚗️", "alien": "👽", "alien_monster": "👾", "ambulance": "🚑", "american_football": "🏈", "amphora": "🏺", "anatomical_heart": "🫀", "anchor": "⚓", "anger_symbol": "💢", "angry": "😠", "angry_face": "😠", "angry_face_with_horns": "👿", "anguished_face": "😧", "ant": "🐜", "antenna_bars": "📶", "anxious_face_with_sweat": "😰", "aquarius": "♒", "aries": "♈", "articulated_lorry": "🚛", "artist": "🧑🎨", "artist_dark_skin_tone": "🧑🏿🎨", "artist_light_skin_tone": "🧑🏻🎨", "artist_medium_dark_skin_tone": "🧑🏾🎨", "artist_medium_light_skin_tone": "🧑🏼🎨", "artist_medium_skin_tone": "🧑🏽🎨", "artist_palette": "🎨", "astonished_face": "😲", "astronaut": "🧑🚀", "astronaut_dark_skin_tone": "🧑🏿🚀", "astronaut_light_skin_tone": "🧑🏻🚀", "astronaut_medium_dark_skin_tone": "🧑🏾🚀", "astronaut_medium_light_skin_tone": "🧑🏼🚀", "astronaut_medium_skin_tone": "🧑🏽🚀", "atm_sign": "🏧", "atom_symbol": "⚛️", "auto_rickshaw": "🛺", "automobile": "🚗", "avocado": "🥑", "axe": "🪓", "b_button_blood_type": "🅱️", "baby": "👶", "baby_angel": "👼", "baby_angel_dark_skin_tone": "👼🏿", "baby_angel_light_skin_tone": "👼🏻", "baby_angel_medium_dark_skin_tone": "👼🏾", "baby_angel_medium_light_skin_tone": "👼🏼", "baby_angel_medium_skin_tone": "👼🏽", "baby_bottle": "🍼", "baby_chick": "🐤", "baby_dark_skin_tone": "👶🏿", "baby_light_skin_tone": "👶🏻", "baby_medium_dark_skin_tone": "👶🏾", "baby_medium_light_skin_tone": "👶🏼", "baby_medium_skin_tone": "👶🏽", "baby_symbol": "🚼", "back_arrow": "🔙", "backhand_index_pointing_down": "👇", "backhand_index_pointing_down_dark_skin_tone": "👇🏿", "backhand_index_pointing_down_light_skin_tone": "👇🏻", "backhand_index_pointing_down_medium_dark_skin_tone": "👇🏾", "backhand_index_pointing_down_medium_light_skin_tone": "👇🏼", "backhand_index_pointing_down_medium_skin_tone": "👇🏽", "backhand_index_pointing_left": "👈", "backhand_index_pointing_left_dark_skin_tone": "👈🏿", "backhand_index_pointing_left_light_skin_tone": "👈🏻", "backhand_index_pointing_left_medium_dark_skin_tone": "👈🏾", "backhand_index_pointing_left_medium_light_skin_tone": "👈🏼", "backhand_index_pointing_left_medium_skin_tone": "👈🏽", "backhand_index_pointing_right": "👉", "backhand_index_pointing_right_dark_skin_tone": "👉🏿", "backhand_index_pointing_right_light_skin_tone": "👉🏻", "backhand_index_pointing_right_medium_dark_skin_tone": "👉🏾", "backhand_index_pointing_right_medium_light_skin_tone": "👉🏼", "backhand_index_pointing_right_medium_skin_tone": "👉🏽", "backhand_index_pointing_up": "👆", "backhand_index_pointing_up_dark_skin_tone": "👆🏿", "backhand_index_pointing_up_light_skin_tone": "👆🏻", "backhand_index_pointing_up_medium_dark_skin_tone": "👆🏾", "backhand_index_pointing_up_medium_light_skin_tone": "👆🏼", "backhand_index_pointing_up_medium_skin_tone": "👆🏽", "backpack": "🎒", "bacon": "🥓", "badger": "🦡", "badminton": "🏸", "bagel": "🥯", "baggage_claim": "🛄", "baguette_bread": "🥖", "balance_scale": "⚖️", "ballet_dancer": "🧑🩰", "ballet_dancer_dark_skin_tone": "🧑🏿🩰", "ballet_dancer_light_skin_tone": "🧑🏻🩰", "ballet_dancer_medium_dark_skin_tone": "🧑🏾🩰", "ballet_dancer_medium_light_skin_tone": "🧑🏼🩰", "ballet_dancer_medium_skin_tone": "🧑🏽🩰", "ballet_shoes": "🩰", "balloon": "🎈", "ballot_box_with_ballot": "🗳️", "banana": "🍌", "banjo": "🪕", "bank": "🏦", "bar_chart": "📊", "barber_pole": "💈", "baseball": "⚾", "basket": "🧺", "basketball": "🏀", "bat": "🦇", "bathtub": "🛁", "battery": "🔋", "beach_with_umbrella": "🏖️", "beaming_face_with_smiling_eyes": "😁", "beans": "🫘", "bear": "🐻", "beating_heart": "💓", "beaver": "🦫", "bed": "🛏️", "beer_mug": "🍺", "beetle": "🪲", "bell": "🔔", "bell_pepper": "🫑", "bell_with_slash": "🔕", "bellhop_bell": "🛎️", "bento_box": "🍱", "beverage_box": "🧃", "bicycle": "🚲", "bikini": "👙", "billed_cap": "🧢", "biohazard": "☣️", "bird": "🐦", "birthday_cake": "🎂", "bison": "🦬", "biting_lip": "🫦", "black_bird": "🐦⬛", "black_cat": "🐈⬛", "black_circle": "⚫", "black_flag": "🏴", "black_heart": "🖤", "black_larLine truncated
|
||||
export { EMOJI_GROUPS } from "@rustpad/emoji-groups";
|
||||
export { EMOJI_SHORTCODES } from "@rustpad/emoji-shortcodes";
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Mateusz Gruszczyński @linuxiarz.pl
|
||||
* Source-Available Code / Dual-Licensed.
|
||||
*
|
||||
* Free for non-commercial and evaluation use under terms of BSL/GPLv3.
|
||||
* Commercial or production use requires a valid paid license.
|
||||
* See LICENSE file in repository root for details.
|
||||
*/
|
||||
|
||||
// Generated from Unicode Emoji 17.0 emoji-test.txt.
|
||||
// Native glyphs use the platform emoji font (Apple style on Apple devices).
|
||||
export const EMOJI_GROUPS = [{ "name": "Smileys & Emotion", "items": [{ "emoji": "😀", "name": "grinning face", "keywords": "face smiling" }, { "emoji": "😃", "name": "grinning face with big eyes", "keywords": "face smiling" }, { "emoji": "😄", "name": "grinning face with smiling eyes", "keywords": "face smiling" }, { "emoji": "😁", "name": "beaming face with smiling eyes", "keywords": "face smiling" }, { "emoji": "😆", "name": "grinning squinting face", "keywords": "face smiling" }, { "emoji": "😅", "name": "grinning face with sweat", "keywords": "face smiling" }, { "emoji": "🤣", "name": "rolling on the floor laughing", "keywords": "face smiling" }, { "emoji": "😂", "name": "face with tears of joy", "keywords": "face smiling" }, { "emoji": "🙂", "name": "slightly smiling face", "keywords": "face smiling" }, { "emoji": "🙃", "name": "upside-down face", "keywords": "face smiling" }, { "emoji": "🫠", "name": "melting face", "keywords": "face smiling" }, { "emoji": "😉", "name": "winking face", "keywords": "face smiling" }, { "emoji": "😊", "name": "smiling face with smiling eyes", "keywords": "face smiling" }, { "emoji": "😇", "name": "smiling face with halo", "keywords": "face smiling" }, { "emoji": "🥰", "name": "smiling face with hearts", "keywords": "face affection" }, { "emoji": "😍", "name": "smiling face with heart-eyes", "keywords": "face affection" }, { "emoji": "🤩", "name": "star-struck", "keywords": "face affection" }, { "emoji": "😘", "name": "face blowing a kiss", "keywords": "face affection" }, { "emoji": "😗", "name": "kissing face", "keywords": "face affection" }, { "emoji": "☺️", "name": "smiling face", "keywords": "face affection" }, { "emoji": "😚", "name": "kissing face with closed eyes", "keywords": "face affection" }, { "emoji": "😙", "name": "kissing face with smiling eyes", "keywords": "face affection" }, { "emoji": "🥲", "name": "smiling face with tear", "keywords": "face affection" }, { "emoji": "😋", "name": "face savoring food", "keywords": "face tongue" }, { "emoji": "😛", "name": "face with tongue", "keywords": "face tongue" }, { "emoji": "😜", "name": "winking face with tongue", "keywords": "face tongue" }, { "emoji": "🤪", "name": "zany face", "keywords": "face tongue" }, { "emoji": "😝", "name": "squinting face with tongue", "keywords": "face tongue" }, { "emoji": "🤑", "name": "money-mouth face", "keywords": "face tongue" }, { "emoji": "🤗", "name": "smiling face with open hands", "keywords": "face hand" }, { "emoji": "🤭", "name": "face with hand over mouth", "keywords": "face hand" }, { "emoji": "🫢", "name": "face with open eyes and hand over mouth", "keywords": "face hand" }, { "emoji": "🫣", "name": "face with peeking eye", "keywords": "face hand" }, { "emoji": "🤫", "name": "shushing face", "keywords": "face hand" }, { "emoji": "🤔", "name": "thinking face", "keywords": "face hand" }, { "emoji": "🫡", "name": "saluting face", "keywords": "face hand" }, { "emoji": "🤐", "name": "zipper-mouth face", "keywords": "face neutral skeptical" }, { "emoji": "🤨", "name": "face with raised eyebrow", "keywords": "face neutral skeptical" }, { "emoji": "😐", "name": "neutral face", "keywords": "face neutral skeptical" }, { "emoji": "😑", "name": "expressionless face", "keywords": "face neutral skeptical" }, { "emoji": "😶", "name": "face without mouth", "keywords": "face neutral skeptical" }, { "emoji": "🫥", "name": "dotted line face", "keywords": "face neutral skeptical" }, { "emoji": "😶🌫️", "name": "face in clouds", "keywords": "face neutral skeptical" }, { "emoji": "😏", "name": "smirking face", "keywords": "face neutral skeptical" }, { "emoji": "😒", "name": "unamused face", "keywords": "face neutral skeptical" }, { "emoji": "🙄", "name": "face with rolling eyes", "keywords": "face neutral skeptical" }, { "emoji": "😬", "name": "grimacing face", "keywords": "face neutral skeptical" }, { "emoji": "😮💨", "name": "face exhaling", "keywords": "face neutral skeptical" }, { "emoji": "🤥", "name": "lying face", "keywords": "face neutral skeptical" }, { "emoji": "🫨", "name": "shaking face", "keywords": "face neutral skeptical" }, { "emoji": "🙂↔️", "name": "head shaking horizontally", "keywords": "face neutral skeptical" }, { "emoji": "🙂↕️", "name": "head shaking vertically", "keywords": "face neutral skeptical" }, { "emoji": "😌", "name": "relieved face", "keywords": "face sleepy" }, { "emoji": "😔", "name": "pensive face", "keywords": "face sleepy" }, { "emoji": "😪", "name": "sleepy face", "keywords": "face sleepy" }, { "emoji": "🤤", "name": "drooling face", "keywords": "face sleepy" }, { "emoji": "😴", "name": "sleeping face", "keywords": "face sleepy" }, { "emoji": "", "name": "face with bags under eyes", "keywords": "face sleepy" }, { "emoji": "😷", "name": "face with medical mask", "keywords": "face unwell" }, { "emoji": "Line truncated
|
||||
@@ -7,7 +7,7 @@
|
||||
* See LICENSE file in repository root for details.
|
||||
*/
|
||||
|
||||
import { EMOJI_GROUPS } from "@rustpad/emoji-data";
|
||||
import { EMOJI_GROUPS } from "@rustpad/emoji-groups";
|
||||
import { t } from "@rustpad/i18n";
|
||||
|
||||
const RECENTS_KEY = "rustpad:recent-emojis";
|
||||
@@ -153,4 +153,9 @@ export function bindEmojiPicker({ editor, details, search, categories, grid, emp
|
||||
document.addEventListener("rustpad:languagechange", () => {
|
||||
if (details.open) render();
|
||||
});
|
||||
|
||||
if (details.open) {
|
||||
render();
|
||||
requestAnimationFrame(() => search.focus());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2026 Mateusz Gruszczyński @linuxiarz.pl
|
||||
* Source-Available Code / Dual-Licensed.
|
||||
*
|
||||
* Free for non-commercial and evaluation use under terms of BSL/GPLv3.
|
||||
* Commercial or production use requires a valid paid license.
|
||||
* See LICENSE file in repository root for details.
|
||||
*/
|
||||
|
||||
// Generated from Unicode Emoji 17.0 emoji-test.txt.
|
||||
// Native glyphs use the platform emoji font (Apple style on Apple devices).
|
||||
export const EMOJI_SHORTCODES = { "+1": "👍", "-1": "👎", "100": "💯", "1st_place_medal": "🥇", "2nd_place_medal": "🥈", "3rd_place_medal": "🥉", "a_button_blood_type": "🅰️", "ab_button_blood_type": "🆎", "abacus": "🧮", "accordion": "🪗", "adhesive_bandage": "🩹", "admission_tickets": "🎟️", "aerial_tramway": "🚡", "airplane": "✈️", "airplane_arrival": "🛬", "airplane_departure": "🛫", "alarm_clock": "⏰", "alembic": "⚗️", "alien": "👽", "alien_monster": "👾", "ambulance": "🚑", "american_football": "🏈", "amphora": "🏺", "anatomical_heart": "🫀", "anchor": "⚓", "anger_symbol": "💢", "angry": "😠", "angry_face": "😠", "angry_face_with_horns": "👿", "anguished_face": "😧", "ant": "🐜", "antenna_bars": "📶", "anxious_face_with_sweat": "😰", "aquarius": "♒", "aries": "♈", "articulated_lorry": "🚛", "artist": "🧑🎨", "artist_dark_skin_tone": "🧑🏿🎨", "artist_light_skin_tone": "🧑🏻🎨", "artist_medium_dark_skin_tone": "🧑🏾🎨", "artist_medium_light_skin_tone": "🧑🏼🎨", "artist_medium_skin_tone": "🧑🏽🎨", "artist_palette": "🎨", "astonished_face": "😲", "astronaut": "🧑🚀", "astronaut_dark_skin_tone": "🧑🏿🚀", "astronaut_light_skin_tone": "🧑🏻🚀", "astronaut_medium_dark_skin_tone": "🧑🏾🚀", "astronaut_medium_light_skin_tone": "🧑🏼🚀", "astronaut_medium_skin_tone": "🧑🏽🚀", "atm_sign": "🏧", "atom_symbol": "⚛️", "auto_rickshaw": "🛺", "automobile": "🚗", "avocado": "🥑", "axe": "🪓", "b_button_blood_type": "🅱️", "baby": "👶", "baby_angel": "👼", "baby_angel_dark_skin_tone": "👼🏿", "baby_angel_light_skin_tone": "👼🏻", "baby_angel_medium_dark_skin_tone": "👼🏾", "baby_angel_medium_light_skin_tone": "👼🏼", "baby_angel_medium_skin_tone": "👼🏽", "baby_bottle": "🍼", "baby_chick": "🐤", "baby_dark_skin_tone": "👶🏿", "baby_light_skin_tone": "👶🏻", "baby_medium_dark_skin_tone": "👶🏾", "baby_medium_light_skin_tone": "👶🏼", "baby_medium_skin_tone": "👶🏽", "baby_symbol": "🚼", "back_arrow": "🔙", "backhand_index_pointing_down": "👇", "backhand_index_pointing_down_dark_skin_tone": "👇🏿", "backhand_index_pointing_down_light_skin_tone": "👇🏻", "backhand_index_pointing_down_medium_dark_skin_tone": "👇🏾", "backhand_index_pointing_down_medium_light_skin_tone": "👇🏼", "backhand_index_pointing_down_medium_skin_tone": "👇🏽", "backhand_index_pointing_left": "👈", "backhand_index_pointing_left_dark_skin_tone": "👈🏿", "backhand_index_pointing_left_light_skin_tone": "👈🏻", "backhand_index_pointing_left_medium_dark_skin_tone": "👈🏾", "backhand_index_pointing_left_medium_light_skin_tone": "👈🏼", "backhand_index_pointing_left_medium_skin_tone": "👈🏽", "backhand_index_pointing_right": "👉", "backhand_index_pointing_right_dark_skin_tone": "👉🏿", "backhand_index_pointing_right_light_skin_tone": "👉🏻", "backhand_index_pointing_right_medium_dark_skin_tone": "👉🏾", "backhand_index_pointing_right_medium_light_skin_tone": "👉🏼", "backhand_index_pointing_right_medium_skin_tone": "👉🏽", "backhand_index_pointing_up": "👆", "backhand_index_pointing_up_dark_skin_tone": "👆🏿", "backhand_index_pointing_up_light_skin_tone": "👆🏻", "backhand_index_pointing_up_medium_dark_skin_tone": "👆🏾", "backhand_index_pointing_up_medium_light_skin_tone": "👆🏼", "backhand_index_pointing_up_medium_skin_tone": "👆🏽", "backpack": "🎒", "bacon": "🥓", "badger": "🦡", "badminton": "🏸", "bagel": "🥯", "baggage_claim": "🛄", "baguette_bread": "🥖", "balance_scale": "⚖️", "ballet_dancer": "🧑🩰", "ballet_dancer_dark_skin_tone": "🧑🏿🩰", "ballet_dancer_light_skin_tone": "🧑🏻🩰", "ballet_dancer_medium_dark_skin_tone": "🧑🏾🩰", "ballet_dancer_medium_light_skin_tone": "🧑🏼🩰", "ballet_dancer_medium_skin_tone": "🧑🏽🩰", "ballet_shoes": "🩰", "balloon": "🎈", "ballot_box_with_ballot": "🗳️", "banana": "🍌", "banjo": "🪕", "bank": "🏦", "bar_chart": "📊", "barber_pole": "💈", "baseball": "⚾", "basket": "🧺", "basketball": "🏀", "bat": "🦇", "bathtub": "🛁", "battery": "🔋", "beach_with_umbrella": "🏖️", "beaming_face_with_smiling_eyes": "😁", "beans": "🫘", "bear": "🐻", "beating_heart": "💓", "beaver": "🦫", "bed": "🛏️", "beer_mug": "🍺", "beetle": "🪲", "bell": "🔔", "bell_pepper": "🫑", "bell_with_slash": "🔕", "bellhop_bell": "🛎️", "bento_box": "🍱", "beverage_box": "🧃", "bicycle": "🚲", "bikini": "👙", "billed_cap": "🧢", "biohazard": "☣️", "bird": "🐦", "birthday_cake": "🎂", "bison": "🦬", "biting_lip": "🫦", "black_bird": "🐦⬛", "black_cat": "🐈⬛", "black_circle": "⚫", "black_flag": "🏴", "black_heart": "🖤", "black_larLine truncated
|
||||
@@ -7,7 +7,7 @@
|
||||
* See LICENSE file in repository root for details.
|
||||
*/
|
||||
|
||||
import { EMOJI_SHORTCODES } from "@rustpad/emoji-data";
|
||||
import { EMOJI_SHORTCODES } from "@rustpad/emoji-shortcodes";
|
||||
import { t } from "@rustpad/i18n";
|
||||
import { parseImageAlias } from "@rustpad/image-alias";
|
||||
|
||||
|
||||
+49
-14
@@ -17,10 +17,8 @@ import { CollaborationRevisionGapError, CollaborationSession } from "@rustpad/co
|
||||
import { copyText } from "@rustpad/clipboard";
|
||||
import { lineFromHash, lineLink, lineStartOffset } from "@rustpad/line-links";
|
||||
import { applyFormat, bindFormatShortcuts, bindIndentationShortcuts } from "@rustpad/editor-format";
|
||||
import { bindEmojiPicker } from "@rustpad/emoji-picker";
|
||||
import { updateImageAliasInLineBySource } from "@rustpad/image-alias";
|
||||
import { previewEditingHost } from "@rustpad/preview-edit";
|
||||
import { bindPdfExport } from "@rustpad/pdf-export";
|
||||
import { createRenderQueue } from "@rustpad/render-queue";
|
||||
import { alignPreviewLineNumbers, renderMarkdown, setMarkdownFiles, unresolvedMarkdownFileAliases } from "@rustpad/markdown";
|
||||
import { getNickname, getGuestId, getAuthToken, getAccessToken, setAccessToken } from "@rustpad/session";
|
||||
@@ -270,12 +268,7 @@ export function startNoteEditor(adapter) {
|
||||
documentTitle.textContent = info.title;
|
||||
}
|
||||
globalColor = info.global_color || ""; noteColor = info.note_color || "";
|
||||
if (getAuthToken()) {
|
||||
const colors = await adapter.loadColor(accountHeaders());
|
||||
globalColor = colors.global_color || ""; noteColor = colors.note_color || "";
|
||||
} else {
|
||||
noteColor = readGuestColor();
|
||||
}
|
||||
if (!getAuthToken()) noteColor = readGuestColor();
|
||||
updateMarkdownFiles(info.files || []);
|
||||
if (info.personal_editor_settings) {
|
||||
compactToggle.checked = info.compact_view !== false;
|
||||
@@ -1633,7 +1626,7 @@ export function startNoteEditor(adapter) {
|
||||
});
|
||||
socket.connect();
|
||||
}
|
||||
bindIdentityDialog({ dialog: identityDialog, onIdentity: async (value, session) => { nickname = value; accountSession = session || await validateCurrentSession(); accessToken = shareToken || getAccessToken(adapter.access.kind, adapter.access.key); identityDialog.close(); updateCurrentUser(); await loadNoteInfo(); await syncFavoriteButton(); if (info.protected && info.access_level === "none") passwordDialog.showModal(); else { loadFiles(); connect(); } } });
|
||||
bindIdentityDialog({ dialog: identityDialog, onIdentity: async (value, session) => { nickname = value; accountSession = session || await validateCurrentSession(); accessToken = shareToken || getAccessToken(adapter.access.kind, adapter.access.key); identityDialog.close(); updateCurrentUser(); await loadNoteInfo(); if (info.protected && info.access_level === "none") passwordDialog.showModal(); else { loadFiles(); connect(); } } });
|
||||
identityDialog.addEventListener("close", () => { if (!nickname) queueMicrotask(() => { if (!identityDialog.open) identityDialog.showModal(); }); });
|
||||
async function showSystemNotFound() {
|
||||
try {
|
||||
@@ -1667,7 +1660,6 @@ export function startNoteEditor(adapter) {
|
||||
adapter.configureView?.(info);
|
||||
applyUi({ write: true, replace: true });
|
||||
updateCurrentUser();
|
||||
await syncFavoriteButton();
|
||||
if (info.protected && info.access_level === "none") passwordDialog.showModal();
|
||||
else { loadFiles(); connect(); }
|
||||
} catch (e) {
|
||||
@@ -2074,14 +2066,57 @@ export function startNoteEditor(adapter) {
|
||||
});
|
||||
bindFormatShortcuts(editor);
|
||||
bindIndentationShortcuts(editor, { size: 2 });
|
||||
bindPdfExport({
|
||||
const pdfExportArgs = {
|
||||
button: document.querySelector("#export-pdf"),
|
||||
dialog: document.querySelector("#pdf-export-dialog"),
|
||||
form: document.querySelector("#pdf-export-form"),
|
||||
preview,
|
||||
title: () => document.querySelector("#document-title")?.textContent?.trim() || document.title,
|
||||
};
|
||||
let pdfExportBound = false;
|
||||
let pdfExportLoad = null;
|
||||
pdfExportArgs.button?.addEventListener("click", async event => {
|
||||
if (pdfExportBound) return;
|
||||
event.stopImmediatePropagation();
|
||||
pdfExportLoad ||= import("@rustpad/pdf-export").then(({ bindPdfExport }) => {
|
||||
bindPdfExport(pdfExportArgs);
|
||||
pdfExportBound = true;
|
||||
});
|
||||
try {
|
||||
await pdfExportLoad;
|
||||
if (!pdfExportArgs.dialog.open) pdfExportArgs.dialog.showModal();
|
||||
} catch (error) {
|
||||
pdfExportLoad = null;
|
||||
console.error("Failed to load PDF export", error);
|
||||
toast.danger(t("editor.pdfExportFailed", {}, "Could not prepare the PDF."), {
|
||||
title: t("editor.exportPdf", {}, "Export PDF"),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const emojiPickerArgs = {
|
||||
editor,
|
||||
details: document.querySelector("#emoji-picker"),
|
||||
search: document.querySelector("#emoji-search"),
|
||||
categories: document.querySelector("#emoji-categories"),
|
||||
grid: document.querySelector("#emoji-grid"),
|
||||
empty: document.querySelector("#emoji-empty"),
|
||||
};
|
||||
let emojiPickerLoad = null;
|
||||
const loadEmojiPicker = async () => {
|
||||
if (emojiPickerLoad) return emojiPickerLoad;
|
||||
emojiPickerLoad = import("@rustpad/emoji-picker").then(({ bindEmojiPicker }) => {
|
||||
bindEmojiPicker(emojiPickerArgs);
|
||||
}).catch(error => {
|
||||
emojiPickerLoad = null;
|
||||
throw error;
|
||||
});
|
||||
return emojiPickerLoad;
|
||||
};
|
||||
emojiPickerArgs.details?.addEventListener("toggle", () => {
|
||||
if (!emojiPickerArgs.details.open) return;
|
||||
void loadEmojiPicker().catch(error => console.error("Failed to load emoji picker", error));
|
||||
});
|
||||
bindEmojiPicker({ editor, details: document.querySelector("#emoji-picker"), search: document.querySelector("#emoji-search"), categories: document.querySelector("#emoji-categories"), grid: document.querySelector("#emoji-grid"), empty: document.querySelector("#emoji-empty") });
|
||||
document.querySelector("#shortcuts-button").addEventListener("click", () => document.querySelector("#shortcuts-dialog").showModal());
|
||||
document.querySelector("#close-shortcuts").addEventListener("click", () => document.querySelector("#shortcuts-dialog").close());
|
||||
|
||||
@@ -2259,7 +2294,7 @@ export function startNoteEditor(adapter) {
|
||||
password = "";
|
||||
setPagePasswordInput.value = "";
|
||||
await loadNoteInfo();
|
||||
await syncFavoriteButton();
|
||||
void syncFavoriteButton();
|
||||
resourceUnlocked = false;
|
||||
socket?.stop();
|
||||
loadFiles();
|
||||
@@ -2357,7 +2392,7 @@ export function startNoteEditor(adapter) {
|
||||
document.querySelector("#open-password")?.focus();
|
||||
}
|
||||
});
|
||||
document.querySelector("#password-form").addEventListener("submit", async e => { e.preventDefault(); try { password = document.querySelector("#open-password").value; const result = await adapter.requestAccess(password); setAccessToken(adapter.access.kind, adapter.access.key, result.granted); accessToken = getAccessToken(adapter.access.kind, adapter.access.key); password = ""; document.querySelector("#open-password").value = ""; document.querySelector("#password-error").textContent = ""; await loadNoteInfo(); await syncFavoriteButton(); loadFiles(); connect(); toast.success("Editing access has been unlocked.", { title: "Note unlocked" }); } catch (error) { document.querySelector("#password-error").textContent = error.message; toast.danger(error.message, { title: "Could not unlock note" }); } });
|
||||
document.querySelector("#password-form").addEventListener("submit", async e => { e.preventDefault(); try { password = document.querySelector("#open-password").value; const result = await adapter.requestAccess(password); setAccessToken(adapter.access.kind, adapter.access.key, result.granted); accessToken = getAccessToken(adapter.access.kind, adapter.access.key); password = ""; document.querySelector("#open-password").value = ""; document.querySelector("#password-error").textContent = ""; await loadNoteInfo(); void syncFavoriteButton(); loadFiles(); connect(); toast.success("Editing access has been unlocked.", { title: "Note unlocked" }); } catch (error) { document.querySelector("#password-error").textContent = error.message; toast.danger(error.message, { title: "Could not unlock note" }); } });
|
||||
const historyPanel = document.querySelector("#history-panel"); document.querySelector("#history-button").addEventListener("click", async () => { if (info?.protected && !resourceUnlocked) { if (!passwordDialog.open) passwordDialog.showModal(); document.querySelector("#open-password")?.focus(); return; } historyPanel.classList.add("open"); historyPanel.setAttribute("aria-hidden", "false"); document.body.classList.add("history-open"); const list = document.querySelector("#history-list"); list.innerHTML = '<p class="empty">Loading…</p>'; try { const revisions = await adapter.loadHistory(accessToken); list.innerHTML = revisions.length ? revisions.map((r, i) => { const snippet = escapeHtml(r.content.trim().split("\n").slice(0, 3).join(" · ").slice(0, 150) || "Empty note"); const author = r.author || "Unknown author"; return `<article class="revision"><span class="revision__marker" style="--owner:${colorFor(author)}"></span><div><div class="revision__meta"><strong>${escapeHtml(author)}</strong><time>${formatDate(r.created_at)}</time></div><p class="revision__snippet">${snippet}</p><button data-preview="${r.id}">Preview</button><button data-revision="${r.id}">Restore</button><div class="revision__preview" id="preview-${r.id}" hidden></div></div></article>`; }).join("") : '<p class="empty">No history yet.</p>'; for (const r of revisions) { list.querySelector(`[data-preview="${r.id}"]`)?.addEventListener("click", () => { const el = list.querySelector(`#preview-${r.id}`); el.hidden = !el.hidden; el.textContent = r.content; }); list.querySelector(`[data-revision="${r.id}"]`)?.addEventListener("click", async () => { await adapter.restoreRevision(r.id, accessToken); toast.success("The selected revision is now the current version.", { title: "Version restored" }); }); } } catch (e) { list.innerHTML = `<p class="error">${escapeHtml(e.message)}</p>`; toast.danger(e.message, { title: "Could not load version history" }); } }); document.querySelector("#close-history").addEventListener("click", () => { historyPanel.classList.remove("open"); historyPanel.setAttribute("aria-hidden", "true"); document.body.classList.remove("history-open"); });
|
||||
|
||||
const deleteNoteButton = document.querySelector("#delete-note"); if (deleteNoteButton && adapter.deleteNote) deleteNoteButton.addEventListener("click", async () => { try { await adapter.deleteNote(info, accessToken); } catch (error) { toast.danger(error.message, { title: "Could not delete note" }); } });
|
||||
|
||||
Reference in new issue
Block a user