Fix character count with intent (#6056)

This commit is contained in:
dan
2024-11-01 16:21:10 +00:00
committed by GitHub
parent 21b82fa19c
commit 1c2186bc03
+6 -2
View File
@@ -224,7 +224,7 @@ function postReducer(state: PostDraft, action: PostAction): PostDraft {
return { return {
...state, ...state,
richtext: action.richtext, richtext: action.richtext,
shortenedGraphemeLength: shortenLinks(action.richtext).graphemeLength, shortenedGraphemeLength: getShortenedLength(action.richtext),
} }
} }
case 'update_labels': { case 'update_labels': {
@@ -516,7 +516,7 @@ export function createComposerState({
{ {
id: nanoid(), id: nanoid(),
richtext: initRichText, richtext: initRichText,
shortenedGraphemeLength: 0, shortenedGraphemeLength: getShortenedLength(initRichText),
labels: [], labels: [],
embed: { embed: {
quote, quote,
@@ -530,3 +530,7 @@ export function createComposerState({
}, },
} }
} }
function getShortenedLength(rt: RichText) {
return shortenLinks(rt).graphemeLength
}