Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(skills): support unicode currency symbols as skill aliases #12098

MergedWilgotM(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/12098/headmerged by maria-rcks View on GitHub

Showing 24 changed files with 6 additions and 5 deletions (loading 21).

x
0 of 24 viewed, 24 left
2 additions and 2 deletionsapps/mobile/modules/t3-markdown-text/src/nativeMarkdownText.tsModified
View file
@@ -319,7 +319,7 @@
​
const SKILL_TOKEN_REGEX =
- /(^|\s)\$(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/g;
+ /(^|\s)\p{Sc}(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/gu;
​
function formatSkillLabel(skill: SelectableMarkdownSkill): string {
const displayName = skill.displayName?.trim();
@@ -359,7 +359,7 @@
continue;
const start = (match.index ?? 0) + prefix.length;
- const end = start + name.length + 1;
+ const end = (match.index ?? 0) + match[0].length;
if (start > cursor) {
decorated.push({ ...run, text: run.text.slice(cursor, start) });
3 additions and 2 deletionsapps/mobile/src/components/ComposerEditor.tsxModified
View file
@@ -155,8 +155,9 @@
const selectedReference = selected
? collectComposerContextReferences(selected.source)[0]
: undefined;
- const selectedSkill = selected?.source.startsWith("$")
- ? props.skills?.find((skill) => skill.name === selected.source.slice(1))
+ const selectedSkillName = selected?.source.match(/^\p{Sc}(.+)$/u)?.[1];