Better support RTL direction extracts in ReferencePreviews

When the user sets a different language than the projects content
language, ReferencePreviews were rendered LTR. By using the bdi
tag this behavior is fixed.

Note that PagePreviews gets language and direction from the
TextExtracts response and use them to achive the same. The latter
is not straight forward available for ReferencePreviews so I'm
using bdi to achieve the same.

Bug: T345833
Change-Id: I6554e6e1db3aac06c04c9185500e05de238adde2
This commit is contained in:
WMDE-Fisch 2023-09-26 11:32:25 +02:00
parent 8fa9b56518
commit 90a829179c
5 changed files with 5 additions and 4 deletions

View file

@ -71,7 +71,7 @@
"bundlesize": [
{
"path": "resources/dist/index.js",
"maxSize": "14.7kB"
"maxSize": "14.8kB"
}
]
}

Binary file not shown.

Binary file not shown.

View file

@ -13,7 +13,7 @@ const templateHTML = `
<span class="popups-icon"></span>
<span class="mwe-popups-title-placeholder"></span>
</strong>
<div class="mw-parser-output"></div>
<bdi><div class="mw-parser-output"></div></bdi>
</div>
<div class="mwe-popups-fade"></div>
</div>
@ -171,6 +171,7 @@ export function renderReferencePreview(
element.isScrolling = !scrolledToBottom;
extract.classList.toggle( 'mwe-popups-fade-out', element.isScrolling );
extract.setAttribute( 'lang', mw.config.get( 'wgPageContentLanguage' ) );
} );
return el;

View file

@ -118,8 +118,8 @@ module.exports = ( env, argv ) => ( {
// Minified uncompressed size limits for chunks / assets and entrypoints. Keep these numbers
// up-to-date and rounded to the nearest 10th of a kibibyte so that code sizing costs are
// well understood. Related to bundlesize minified, gzipped compressed file size tests.
maxAssetSize: 46.8 * 1024,
maxEntrypointSize: 46.8 * 1024,
maxAssetSize: 46.9 * 1024,
maxEntrypointSize: 46.9 * 1024,
// The default filter excludes map files but we rename ours.
assetFilter: ( filename ) => !filename.endsWith( srcMapExt )