compat(ios): avoid lookbehind assertions for iOS older than 16.4 (#2553)
This commit is contained in:
@@ -46,7 +46,8 @@
|
||||
"update-metadata": "bash ./scripts/sync-release-notes.sh release-notes.json ../../data/metainfo/appdata.xml",
|
||||
"check:optional-chaining": "count=$(grep -rno '\\?\\.[a-zA-Z_$]' .next/static/chunks/* out/_next/static/chunks/* | wc -l); if [ \"$count\" -gt 0 ]; then echo '❌ Optional chaining found in output!'; exit 1; else echo '✅ No optional chaining found.'; fi",
|
||||
"check:translations": "count=$(grep -rno '__STRING_NOT_TRANSLATED__' public/locales/* | wc -l); if [ \"$count\" -gt 0 ]; then echo '❌ Untranslated strings found!'; exit 1; else echo '✅ All strings translated.'; fi",
|
||||
"check:all": "pnpm check:translations",
|
||||
"check:lookbehind-regex": "count=$(grep -rnoE '\\(\\?<[!=]' .next/static/chunks/* out/_next/static/chunks/* | wc -l); if [ \"$count\" -gt 0 ]; then echo '❌ Lookbehind regex found in output!'; exit 1; else echo '✅ No lookbehind regex found.'; fi",
|
||||
"check:all": "pnpm check:translations && pnpm check:lookbehind-regex",
|
||||
"build-check": "pnpm build && pnpm build-web && pnpm check:all"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -54,17 +54,27 @@ export default function Error({ error, reset }: ErrorPageProps) {
|
||||
)}
|
||||
</p>
|
||||
|
||||
<div className='alert alert-error mb-8'>
|
||||
<div className='flex-col items-start text-left'>
|
||||
<div className='alert alert-error mb-8 overflow-hidden'>
|
||||
<div className='w-full min-w-0 flex-col items-start text-left'>
|
||||
<h3 className='mb-2 font-bold'>{_('Error Details:')}</h3>
|
||||
<p className='break-words font-mono text-sm'>{error.message}</p>
|
||||
{browserInfo && <p className='mt-2 font-mono text-sm'>Browser: {browserInfo}</p>}
|
||||
<p className='overflow-wrap-anywhere w-full break-words font-mono text-sm'>
|
||||
{error.message}
|
||||
</p>
|
||||
{browserInfo && (
|
||||
<p className='overflow-wrap-anywhere mt-2 w-full break-words font-mono text-sm'>
|
||||
Browser: {browserInfo}
|
||||
</p>
|
||||
)}
|
||||
{error.stack && (
|
||||
<p className='mt-2 whitespace-pre-wrap break-all font-mono text-sm'>
|
||||
<p className='overflow-wrap-anywhere mt-2 w-full whitespace-pre-wrap break-words font-mono text-sm'>
|
||||
{error.stack.split('\n').slice(0, 3).join('\n')}
|
||||
</p>
|
||||
)}
|
||||
{error.digest && <p className='mt-2 text-xs opacity-70'>Error ID: {error.digest}</p>}
|
||||
{error.digest && (
|
||||
<p className='overflow-wrap-anywhere mt-2 w-full break-words text-xs opacity-70'>
|
||||
Error ID: {error.digest}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export const whitespaceTransformer: Transformer = {
|
||||
if (viewSettings.overrideLayout) {
|
||||
const cleaned = ctx.content
|
||||
// Replace but skip literal "&nbsp;"
|
||||
.replace(/(?<!&) /g, ' ')
|
||||
.replace(/(&)? /g, (match, amp) => (amp ? match : ' '))
|
||||
// Replace literal non-breaking space characters (U+00A0) with normal spaces
|
||||
.replace(/\u00A0/g, ' ')
|
||||
// Collapse consecutive spaces into one
|
||||
|
||||
@@ -36,15 +36,13 @@ export const localizeNumber = (num: number, language: string, isIndex = false):
|
||||
|
||||
if (!isIndex) {
|
||||
if (isTraditional) {
|
||||
result = result.replace(
|
||||
/^貳$|(?<![壹貳叁肆伍陸柒捌玖])貳(?![佰仟萬億壹貳叁肆伍陸柒捌玖])/g,
|
||||
'兩',
|
||||
);
|
||||
result = result
|
||||
.replace(/^貳$/, '兩')
|
||||
.replace(/(^|[^壹貳叁肆伍陸柒捌玖])貳([^佰仟萬億壹貳叁肆伍陸柒捌玖]|$)/g, '$1兩$2');
|
||||
} else {
|
||||
result = result.replace(
|
||||
/^二$|(?<![一二三四五六七八九])二(?![百千万亿一二三四五六七八九])/g,
|
||||
'两',
|
||||
);
|
||||
result = result
|
||||
.replace(/^二$/, '两')
|
||||
.replace(/(^|[^一二三四五六七八九])二([^百千万亿一二三四五六七八九]|$)/g, '$1两$2');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule packages/foliate-js updated: a97db3e9cf...a6b6252d7c
Reference in New Issue
Block a user