✨ feat: enhance medialib image handling and add asset URL resolution
- Implemented `resolveApiAssetUrl` function to normalize asset URLs based on API base. - Updated `MedialibImage` component to utilize new asset URL resolution and added support for alt text and class properties. - Enhanced image loading behavior with improved width measurement and focal point handling. - Added placeholder image handling and improved accessibility with alt text. - Introduced new test script for auditing broken links in skill documentation. - Expanded seeded test content to include medialib entries and updated related tests for pagebuilder previews. - Improved global setup and teardown logging for clarity on seeded content management.
This commit is contained in:
+12
-1
@@ -1,4 +1,5 @@
|
||||
import { mount, unmount, type Component, type SvelteComponent } from "svelte"
|
||||
import { apiBaseOverride } from "./lib/store"
|
||||
import BlockRenderer from "./blocks/BlockRenderer.svelte"
|
||||
|
||||
const previewCssUrl = new URL("./index.css", import.meta.url).toString()
|
||||
@@ -86,6 +87,11 @@ function createContentBlockDefinition(presentation: BlockPresentation): BlockDef
|
||||
position: "relative",
|
||||
},
|
||||
render(container, row, context) {
|
||||
const previewApiBase = context?.projectBase || context?.apiBase
|
||||
if (previewApiBase) {
|
||||
apiBaseOverride.set(String(previewApiBase))
|
||||
}
|
||||
|
||||
const target = document.createElement("div")
|
||||
target.dataset.adminPreview = "true"
|
||||
container.appendChild(target)
|
||||
@@ -99,7 +105,12 @@ function createContentBlockDefinition(presentation: BlockPresentation): BlockDef
|
||||
})
|
||||
|
||||
return {
|
||||
update(nextRow) {
|
||||
update(nextRow, nextContext) {
|
||||
const nextPreviewApiBase = nextContext?.projectBase || nextContext?.apiBase
|
||||
if (nextPreviewApiBase) {
|
||||
apiBaseOverride.set(String(nextPreviewApiBase))
|
||||
}
|
||||
|
||||
unmount(mountedComponent)
|
||||
target.innerHTML = ""
|
||||
mountedComponent = mount(BlockRenderer as Component<any>, {
|
||||
|
||||
Reference in New Issue
Block a user