Possibly need useLayoutEffect

This commit is contained in:
Lim Chee Aun 2024-09-25 18:27:40 +08:00
parent 65bd6fb1ef
commit c0abfb203e
2 changed files with 135 additions and 134 deletions

View file

@ -20,6 +20,7 @@ import {
useCallback,
useContext,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
@ -131,7 +132,7 @@ const PostContent =
const { content, emojis, language, mentions, url } = post;
const divRef = useRef();
useEffect(() => {
useLayoutEffect(() => {
if (!divRef.current) return;
const dom = enhanceContent(content, {
emojis,

266
src/locales/en.po generated
View file

@ -32,7 +32,7 @@ msgstr ""
#: src/components/account-block.jsx:168
#: src/components/account-info.jsx:639
#: src/components/status.jsx:460
#: src/components/status.jsx:461
#: src/pages/catchup.jsx:1471
msgid "Group"
msgstr ""
@ -108,11 +108,11 @@ msgstr ""
#: src/components/compose.jsx:2463
#: src/components/media-alt-modal.jsx:45
#: src/components/media-modal.jsx:283
#: src/components/status.jsx:1656
#: src/components/status.jsx:1673
#: src/components/status.jsx:1797
#: src/components/status.jsx:2395
#: src/components/status.jsx:2398
#: src/components/status.jsx:1657
#: src/components/status.jsx:1674
#: src/components/status.jsx:1798
#: src/components/status.jsx:2396
#: src/components/status.jsx:2399
#: src/pages/account-statuses.jsx:528
#: src/pages/accounts.jsx:109
#: src/pages/hashtag.jsx:199
@ -181,7 +181,7 @@ msgid "Original"
msgstr ""
#: src/components/account-info.jsx:859
#: src/components/status.jsx:2186
#: src/components/status.jsx:2187
#: src/pages/catchup.jsx:71
#: src/pages/catchup.jsx:1445
#: src/pages/catchup.jsx:2056
@ -277,30 +277,30 @@ msgid "Add/Remove from Lists"
msgstr ""
#: src/components/account-info.jsx:1299
#: src/components/status.jsx:1099
#: src/components/status.jsx:1100
msgid "Link copied"
msgstr ""
#: src/components/account-info.jsx:1302
#: src/components/status.jsx:1102
#: src/components/status.jsx:1103
msgid "Unable to copy link"
msgstr ""
#: src/components/account-info.jsx:1308
#: src/components/shortcuts-settings.jsx:1056
#: src/components/status.jsx:1108
#: src/components/status.jsx:3170
#: src/components/status.jsx:1109
#: src/components/status.jsx:3171
msgid "Copy"
msgstr ""
#: src/components/account-info.jsx:1323
#: src/components/shortcuts-settings.jsx:1074
#: src/components/status.jsx:1124
#: src/components/status.jsx:1125
msgid "Sharing doesn't seem to work."
msgstr ""
#: src/components/account-info.jsx:1329
#: src/components/status.jsx:1130
#: src/components/status.jsx:1131
msgid "Share…"
msgstr ""
@ -417,9 +417,9 @@ msgstr ""
#: src/components/shortcuts-settings.jsx:227
#: src/components/shortcuts-settings.jsx:580
#: src/components/shortcuts-settings.jsx:780
#: src/components/status.jsx:2895
#: src/components/status.jsx:3134
#: src/components/status.jsx:3632
#: src/components/status.jsx:2896
#: src/components/status.jsx:3135
#: src/components/status.jsx:3633
#: src/pages/accounts.jsx:36
#: src/pages/catchup.jsx:1581
#: src/pages/filters.jsx:224
@ -605,7 +605,7 @@ msgid "Attachment #{i} failed"
msgstr ""
#: src/components/compose.jsx:1118
#: src/components/status.jsx:1982
#: src/components/status.jsx:1983
#: src/components/timeline.jsx:984
msgid "Content warning"
msgstr ""
@ -615,7 +615,7 @@ msgid "Content warning or sensitive media"
msgstr ""
#: src/components/compose.jsx:1170
#: src/components/status.jsx:92
#: src/components/status.jsx:93
#: src/pages/settings.jsx:297
msgid "Public"
msgstr ""
@ -623,25 +623,25 @@ msgstr ""
#: src/components/compose.jsx:1175
#: src/components/nav-menu.jsx:386
#: src/components/shortcuts-settings.jsx:162
#: src/components/status.jsx:93
#: src/components/status.jsx:94
msgid "Local"
msgstr ""
#: src/components/compose.jsx:1179
#: src/components/status.jsx:94
#: src/components/status.jsx:95
#: src/pages/settings.jsx:300
msgid "Unlisted"
msgstr ""
#: src/components/compose.jsx:1182
#: src/components/status.jsx:95
#: src/components/status.jsx:96
#: src/pages/settings.jsx:303
msgid "Followers only"
msgstr ""
#: src/components/compose.jsx:1185
#: src/components/status.jsx:96
#: src/components/status.jsx:1860
#: src/components/status.jsx:97
#: src/components/status.jsx:1861
msgid "Private mention"
msgstr ""
@ -671,10 +671,10 @@ msgstr ""
#: src/components/compose.jsx:1479
#: src/components/keyboard-shortcuts-help.jsx:143
#: src/components/status.jsx:851
#: src/components/status.jsx:1636
#: src/components/status.jsx:852
#: src/components/status.jsx:1637
#: src/components/status.jsx:2291
#: src/components/status.jsx:1638
#: src/components/status.jsx:2292
msgid "Reply"
msgstr ""
@ -889,7 +889,7 @@ msgstr ""
#: src/components/drafts.jsx:127
#: src/components/list-add-edit.jsx:183
#: src/components/status.jsx:1271
#: src/components/status.jsx:1272
#: src/pages/filters.jsx:587
msgid "Delete…"
msgstr ""
@ -1089,10 +1089,10 @@ msgid "<0>l</0> or <1>f</1>"
msgstr ""
#: src/components/keyboard-shortcuts-help.jsx:164
#: src/components/status.jsx:859
#: src/components/status.jsx:2317
#: src/components/status.jsx:2349
#: src/components/status.jsx:860
#: src/components/status.jsx:2318
#: src/components/status.jsx:2350
#: src/components/status.jsx:2351
msgid "Boost"
msgstr ""
@ -1101,9 +1101,9 @@ msgid "<0>Shift</0> + <1>b</1>"
msgstr ""
#: src/components/keyboard-shortcuts-help.jsx:172
#: src/components/status.jsx:944
#: src/components/status.jsx:2374
#: src/components/status.jsx:945
#: src/components/status.jsx:2375
#: src/components/status.jsx:2376
msgid "Bookmark"
msgstr ""
@ -1162,15 +1162,15 @@ msgid "Media description"
msgstr ""
#: src/components/media-alt-modal.jsx:57
#: src/components/status.jsx:988
#: src/components/status.jsx:1015
#: src/components/status.jsx:989
#: src/components/status.jsx:1016
#: src/components/translation-block.jsx:195
msgid "Translate"
msgstr ""
#: src/components/media-alt-modal.jsx:68
#: src/components/status.jsx:1002
#: src/components/status.jsx:1029
#: src/components/status.jsx:1003
#: src/components/status.jsx:1030
msgid "Speak"
msgstr ""
@ -1207,9 +1207,9 @@ msgid "Filtered: {filterTitleStr}"
msgstr ""
#: src/components/media-post.jsx:133
#: src/components/status.jsx:3462
#: src/components/status.jsx:3558
#: src/components/status.jsx:3636
#: src/components/status.jsx:3463
#: src/components/status.jsx:3559
#: src/components/status.jsx:3637
#: src/components/timeline.jsx:973
#: src/pages/catchup.jsx:75
#: src/pages/catchup.jsx:1876
@ -1489,8 +1489,8 @@ msgid "[Unknown notification type: {type}]"
msgstr ""
#: src/components/notification.jsx:433
#: src/components/status.jsx:958
#: src/components/status.jsx:968
#: src/components/status.jsx:959
#: src/components/status.jsx:969
msgid "Boosted/Liked by…"
msgstr ""
@ -1512,7 +1512,7 @@ msgid "Learn more <0/>"
msgstr ""
#: src/components/notification.jsx:745
#: src/components/status.jsx:210
#: src/components/status.jsx:211
msgid "Read more →"
msgstr ""
@ -1805,7 +1805,7 @@ msgid "Move down"
msgstr ""
#: src/components/shortcuts-settings.jsx:376
#: src/components/status.jsx:1236
#: src/components/status.jsx:1237
#: src/pages/list.jsx:170
msgid "Edit"
msgstr ""
@ -2003,297 +2003,297 @@ msgstr ""
msgid "Import/export settings from/to instance server (Very experimental)"
msgstr ""
#: src/components/status.jsx:484
#: src/components/status.jsx:485
msgid "<0/> <1>boosted</1>"
msgstr ""
#: src/components/status.jsx:583
#: src/components/status.jsx:584
msgid "Sorry, your current logged-in instance can't interact with this post from another instance."
msgstr ""
#: src/components/status.jsx:736
#: src/components/status.jsx:737
msgid "Unliked @{0}'s post"
msgstr "Unliked @{0}'s post"
#: src/components/status.jsx:737
#: src/components/status.jsx:738
msgid "Liked @{0}'s post"
msgstr "Liked @{0}'s post"
#: src/components/status.jsx:776
#: src/components/status.jsx:777
msgid "Unbookmarked @{0}'s post"
msgstr ""
#: src/components/status.jsx:777
#: src/components/status.jsx:778
msgid "Bookmarked @{0}'s post"
msgstr ""
#: src/components/status.jsx:859
#: src/components/status.jsx:921
#: src/components/status.jsx:2317
#: src/components/status.jsx:2349
#: src/components/status.jsx:860
#: src/components/status.jsx:922
#: src/components/status.jsx:2318
#: src/components/status.jsx:2350
msgid "Unboost"
msgstr ""
#: src/components/status.jsx:875
#: src/components/status.jsx:2332
#: src/components/status.jsx:876
#: src/components/status.jsx:2333
msgid "Quote"
msgstr ""
#: src/components/status.jsx:883
#: src/components/status.jsx:2341
#: src/components/status.jsx:884
#: src/components/status.jsx:2342
msgid "Some media have no descriptions."
msgstr ""
#: src/components/status.jsx:890
#: src/components/status.jsx:891
msgid "Old post (<0>{0}</0>)"
msgstr ""
#: src/components/status.jsx:909
#: src/components/status.jsx:1361
msgid "Unboosted @{0}'s post"
msgstr ""
#: src/components/status.jsx:910
#: src/components/status.jsx:1362
msgid "Unboosted @{0}'s post"
msgstr ""
#: src/components/status.jsx:911
#: src/components/status.jsx:1363
msgid "Boosted @{0}'s post"
msgstr ""
#: src/components/status.jsx:922
#: src/components/status.jsx:923
msgid "Boost…"
msgstr ""
#: src/components/status.jsx:934
#: src/components/status.jsx:1646
#: src/components/status.jsx:2362
#: src/components/status.jsx:935
#: src/components/status.jsx:1647
#: src/components/status.jsx:2363
msgid "Unlike"
msgstr ""
#: src/components/status.jsx:935
#: src/components/status.jsx:1646
#: src/components/status.jsx:936
#: src/components/status.jsx:1647
#: src/components/status.jsx:2362
#: src/components/status.jsx:1648
#: src/components/status.jsx:2363
#: src/components/status.jsx:2364
msgid "Like"
msgstr ""
#: src/components/status.jsx:944
#: src/components/status.jsx:2374
#: src/components/status.jsx:945
#: src/components/status.jsx:2375
msgid "Unbookmark"
msgstr ""
#: src/components/status.jsx:1052
#: src/components/status.jsx:1053
msgid "View post by <0>@{0}</0>"
msgstr ""
#: src/components/status.jsx:1073
#: src/components/status.jsx:1074
msgid "Show Edit History"
msgstr ""
#: src/components/status.jsx:1076
#: src/components/status.jsx:1077
msgid "Edited: {editedDateText}"
msgstr ""
#: src/components/status.jsx:1143
#: src/components/status.jsx:3139
#: src/components/status.jsx:1144
#: src/components/status.jsx:3140
msgid "Embed post"
msgstr ""
#: src/components/status.jsx:1157
#: src/components/status.jsx:1158
msgid "Conversation unmuted"
msgstr ""
#: src/components/status.jsx:1157
#: src/components/status.jsx:1158
msgid "Conversation muted"
msgstr ""
#: src/components/status.jsx:1163
#: src/components/status.jsx:1164
msgid "Unable to unmute conversation"
msgstr ""
#: src/components/status.jsx:1164
#: src/components/status.jsx:1165
msgid "Unable to mute conversation"
msgstr ""
#: src/components/status.jsx:1173
#: src/components/status.jsx:1174
msgid "Unmute conversation"
msgstr ""
#: src/components/status.jsx:1180
#: src/components/status.jsx:1181
msgid "Mute conversation"
msgstr ""
#: src/components/status.jsx:1196
#: src/components/status.jsx:1197
msgid "Post unpinned from profile"
msgstr ""
#: src/components/status.jsx:1197
#: src/components/status.jsx:1198
msgid "Post pinned to profile"
msgstr ""
#: src/components/status.jsx:1202
#: src/components/status.jsx:1203
msgid "Unable to unpin post"
msgstr ""
#: src/components/status.jsx:1202
#: src/components/status.jsx:1203
msgid "Unable to pin post"
msgstr ""
#: src/components/status.jsx:1211
#: src/components/status.jsx:1212
msgid "Unpin from profile"
msgstr ""
#: src/components/status.jsx:1218
#: src/components/status.jsx:1219
msgid "Pin to profile"
msgstr ""
#: src/components/status.jsx:1247
#: src/components/status.jsx:1248
msgid "Delete this post?"
msgstr ""
#: src/components/status.jsx:1260
#: src/components/status.jsx:1261
msgid "Post deleted"
msgstr ""
#: src/components/status.jsx:1263
#: src/components/status.jsx:1264
msgid "Unable to delete post"
msgstr ""
#: src/components/status.jsx:1291
#: src/components/status.jsx:1292
msgid "Report post…"
msgstr ""
#: src/components/status.jsx:1647
#: src/components/status.jsx:1683
#: src/components/status.jsx:2363
#: src/components/status.jsx:1648
#: src/components/status.jsx:1684
#: src/components/status.jsx:2364
msgid "Liked"
msgstr ""
#: src/components/status.jsx:1680
#: src/components/status.jsx:2350
#: src/components/status.jsx:1681
#: src/components/status.jsx:2351
msgid "Boosted"
msgstr ""
#: src/components/status.jsx:1690
#: src/components/status.jsx:2375
#: src/components/status.jsx:1691
#: src/components/status.jsx:2376
msgid "Bookmarked"
msgstr ""
#: src/components/status.jsx:1694
#: src/components/status.jsx:1695
msgid "Pinned"
msgstr ""
#: src/components/status.jsx:1739
#: src/components/status.jsx:2194
#: src/components/status.jsx:1740
#: src/components/status.jsx:2195
msgid "Deleted"
msgstr ""
#: src/components/status.jsx:1780
#: src/components/status.jsx:1781
msgid "{repliesCount, plural, one {# reply} other {# replies}}"
msgstr ""
#: src/components/status.jsx:1869
#: src/components/status.jsx:1870
msgid "Thread{0}"
msgstr ""
#: src/components/status.jsx:1945
#: src/components/status.jsx:2007
#: src/components/status.jsx:2092
#: src/components/status.jsx:1946
#: src/components/status.jsx:2008
#: src/components/status.jsx:2093
msgid "Show less"
msgstr ""
#: src/components/status.jsx:1945
#: src/components/status.jsx:2007
#: src/components/status.jsx:1946
#: src/components/status.jsx:2008
msgid "Show content"
msgstr ""
#: src/components/status.jsx:2092
#: src/components/status.jsx:2093
msgid "Show media"
msgstr ""
#: src/components/status.jsx:2215
#: src/components/status.jsx:2216
msgid "Edited"
msgstr ""
#: src/components/status.jsx:2292
#: src/components/status.jsx:2293
msgid "Comments"
msgstr ""
#. More from [Author]
#: src/components/status.jsx:2601
#: src/components/status.jsx:2602
msgid "More from <0/>"
msgstr "More from <0/>"
#: src/components/status.jsx:2900
#: src/components/status.jsx:2901
msgid "Edit History"
msgstr ""
#: src/components/status.jsx:2904
#: src/components/status.jsx:2905
msgid "Failed to load history"
msgstr ""
#: src/components/status.jsx:2909
#: src/components/status.jsx:2910
msgid "Loading…"
msgstr ""
#: src/components/status.jsx:3144
#: src/components/status.jsx:3145
msgid "HTML Code"
msgstr ""
#: src/components/status.jsx:3161
#: src/components/status.jsx:3162
msgid "HTML code copied"
msgstr ""
#: src/components/status.jsx:3164
#: src/components/status.jsx:3165
msgid "Unable to copy HTML code"
msgstr ""
#: src/components/status.jsx:3176
#: src/components/status.jsx:3177
msgid "Media attachments:"
msgstr ""
#: src/components/status.jsx:3198
#: src/components/status.jsx:3199
msgid "Account Emojis:"
msgstr ""
#: src/components/status.jsx:3229
#: src/components/status.jsx:3274
#: src/components/status.jsx:3230
#: src/components/status.jsx:3275
msgid "static URL"
msgstr ""
#: src/components/status.jsx:3243
#: src/components/status.jsx:3244
msgid "Emojis:"
msgstr ""
#: src/components/status.jsx:3288
#: src/components/status.jsx:3289
msgid "Notes:"
msgstr ""
#: src/components/status.jsx:3292
#: src/components/status.jsx:3293
msgid "This is static, unstyled and scriptless. You may need to apply your own styles and edit as needed."
msgstr ""
#: src/components/status.jsx:3298
#: src/components/status.jsx:3299
msgid "Polls are not interactive, becomes a list with vote counts."
msgstr ""
#: src/components/status.jsx:3303
#: src/components/status.jsx:3304
msgid "Media attachments can be images, videos, audios or any file types."
msgstr ""
#: src/components/status.jsx:3309
#: src/components/status.jsx:3310
msgid "Post could be edited or deleted later."
msgstr ""
#: src/components/status.jsx:3315
#: src/components/status.jsx:3316
msgid "Preview"
msgstr ""
#: src/components/status.jsx:3324
#: src/components/status.jsx:3325
msgid "Note: This preview is lightly styled."
msgstr ""
#. [Name] [Visibility icon] boosted
#: src/components/status.jsx:3566
#: src/components/status.jsx:3567
msgid "<0/> <1/> boosted"
msgstr ""