web: add markdown formatting keyboard shortcuts in composer
Some checks are pending
CI / test (push) Has started running
Some checks are pending
CI / test (push) Has started running
This commit is contained in:
@@ -28,7 +28,7 @@ Legend:
|
||||
19. Stickers - `PARTIAL` (web sticker picker with preset pack + favorites)
|
||||
20. GIF - `PARTIAL` (web GIF picker with Tenor search + preset fallback + favorites)
|
||||
21. Message History/Search - `DONE` (history/pagination/chat+global search)
|
||||
22. Text Formatting - `PARTIAL` (bold/italic/underline/spoiler/mono/links + strikethrough + quote/code block; toolbar still evolving)
|
||||
22. Text Formatting - `PARTIAL` (bold/italic/underline/spoiler/mono/links + strikethrough + quote/code block; web composer now supports keyboard shortcuts `Ctrl/Cmd+B/I/U/K`, `Ctrl/Cmd+Shift+X`, `Ctrl/Cmd+Shift+\``; toolbar still evolving)
|
||||
23. Groups - `PARTIAL` (create/add/remove/invite link; join-by-invite and invite permissions covered by integration tests; members API now returns profile fields (`username/name/avatar_url`) and web Chat Info consumes them to avoid extra per-member profile requests; add-member search also shows avatars; advanced moderation still partial)
|
||||
24. Roles - `DONE` (owner/admin/member)
|
||||
25. Admin Rights - `PARTIAL` (delete/pin/edit info + explicit ban APIs for groups/channels including ban list endpoint; web Chat Info now shows searchable `Banned users` with both inline and right-click `Unban` actions for owner/admin, member search, avatars in moderation lists, invite-link copy/regenerate actions, ban metadata (`who banned/when`), explicit member action button for touch/trackpad UX, `@username`-friendly moderation filters, and resilient profile hydration (`allSettled`) for partially missing users; add-member and banned-filters now show explicit empty-state hints; moderation actions (`add/remove/ban/unban/promote/demote/transfer owner`) now force full panel refresh to keep members/bans/counters in sync without manual reopen; integration tests cover channel member read-only, channel admin full-delete, channel message delete-for-all permissions, group profile edit permissions, owner-only role management rules, and admin-visible/member-forbidden ban-list access; remaining UX moderation tools limited)
|
||||
|
||||
@@ -525,6 +525,41 @@ export function MessageComposer() {
|
||||
}, [gifQuery, showGifMenu]);
|
||||
|
||||
function onComposerKeyDown(event: KeyboardEvent<HTMLTextAreaElement>) {
|
||||
const hasModifier = event.ctrlKey || event.metaKey;
|
||||
if (hasModifier) {
|
||||
const key = event.key.toLowerCase();
|
||||
if (key === "b") {
|
||||
event.preventDefault();
|
||||
insertFormatting("**", "**");
|
||||
return;
|
||||
}
|
||||
if (key === "i") {
|
||||
event.preventDefault();
|
||||
insertFormatting("*", "*");
|
||||
return;
|
||||
}
|
||||
if (key === "u") {
|
||||
event.preventDefault();
|
||||
insertFormatting("__", "__");
|
||||
return;
|
||||
}
|
||||
if (key === "k") {
|
||||
event.preventDefault();
|
||||
insertLink();
|
||||
return;
|
||||
}
|
||||
if (event.shiftKey && key === "x") {
|
||||
event.preventDefault();
|
||||
insertFormatting("~~", "~~");
|
||||
return;
|
||||
}
|
||||
if (event.shiftKey && (event.key === "`" || event.code === "Backquote")) {
|
||||
event.preventDefault();
|
||||
insertFormatting("`", "`");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key !== "Enter") {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user