Fix draft restore to calculate shortened grapheme length for links (#10103)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {resolveLink} from '#/lib/api/resolve'
|
|||||||
import {getDeviceName} from '#/lib/deviceName'
|
import {getDeviceName} from '#/lib/deviceName'
|
||||||
import {getImageDim} from '#/lib/media/manip'
|
import {getImageDim} from '#/lib/media/manip'
|
||||||
import {mimeToExt} from '#/lib/media/video/util'
|
import {mimeToExt} from '#/lib/media/video/util'
|
||||||
|
import {shortenLinks} from '#/lib/strings/rich-text-manip'
|
||||||
import {type ComposerImage} from '#/state/gallery'
|
import {type ComposerImage} from '#/state/gallery'
|
||||||
import {type Gif} from '#/state/queries/tenor'
|
import {type Gif} from '#/state/queries/tenor'
|
||||||
import {threadgateAllowUISettingToAllowRecordValue} from '#/state/queries/threadgate/util'
|
import {threadgateAllowUISettingToAllowRecordValue} from '#/state/queries/threadgate/util'
|
||||||
@@ -570,7 +571,7 @@ export async function draftToComposerPosts(
|
|||||||
return {
|
return {
|
||||||
id: `draft-post-${index}`,
|
id: `draft-post-${index}`,
|
||||||
richtext,
|
richtext,
|
||||||
shortenedGraphemeLength: richtext.graphemeLength,
|
shortenedGraphemeLength: shortenLinks(richtext).graphemeLength,
|
||||||
labels,
|
labels,
|
||||||
embed,
|
embed,
|
||||||
} as PostDraft
|
} as PostDraft
|
||||||
|
|||||||
Reference in New Issue
Block a user