diff options
Diffstat (limited to 'src/view/com/composer/state/composer.ts')
-rw-r--r-- | src/view/com/composer/state/composer.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/view/com/composer/state/composer.ts b/src/view/com/composer/state/composer.ts index 958718eaf..353600ef6 100644 --- a/src/view/com/composer/state/composer.ts +++ b/src/view/com/composer/state/composer.ts @@ -3,6 +3,7 @@ import {AppBskyFeedPostgate, RichText} from '@atproto/api' import {SelfLabel} from '#/lib/moderation' import {insertMentionAt} from '#/lib/strings/mention-manip' +import {shortenLinks} from '#/lib/strings/rich-text-manip' import { isBskyPostUrl, postUriToRelativePath, @@ -51,6 +52,7 @@ export type PostDraft = { richtext: RichText labels: SelfLabel[] embed: EmbedDraft + shortenedGraphemeLength: number } export type PostAction = @@ -137,6 +139,7 @@ function postReducer(state: PostDraft, action: PostAction): PostDraft { return { ...state, richtext: action.richtext, + shortenedGraphemeLength: shortenLinks(action.richtext).graphemeLength, } } case 'update_labels': { @@ -425,6 +428,7 @@ export function createComposerState({ posts: [ { richtext: initRichText, + shortenedGraphemeLength: 0, labels: [], embed: { quote, |