From 5e9a742d80584f2982fa9c1762e74dab5f85d29b Mon Sep 17 00:00:00 2001 From: Robert Reinhard Date: Mon, 7 Aug 2023 15:17:20 -0700 Subject: [PATCH 1/2] Use space indenting for js files --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 5bd1061..71f1ae0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,6 +13,9 @@ insert_final_newline = true trim_trailing_whitespace = false indent_style = space +[*.js] +indent_style = space + [*.php] indent_style = space indent_size = 4 From e48a7e6bdde4b9966c34a770de0fd1b22e97b5f2 Mon Sep 17 00:00:00 2001 From: Robert Reinhard Date: Mon, 7 Aug 2023 15:17:55 -0700 Subject: [PATCH 2/2] Expect videos to be de-referenced There should be a way to also support references but not spending time on that now --- adapters/globals/sanity-visual.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/adapters/globals/sanity-visual.js b/adapters/globals/sanity-visual.js index 519debe..83211fd 100644 --- a/adapters/globals/sanity-visual.js +++ b/adapters/globals/sanity-visual.js @@ -26,7 +26,7 @@ export default { // Pass along props that were extrapolated from Sanity objects image: getAssetRef(props.image), - video: getAssetRef(props.video), + video: getVideoUrl(props.video), aspect: props.aspect || props.image?.asset?.metadata?.dimensions?.aspectRatio, alt: props.alt || props.image?.alt, @@ -49,6 +49,13 @@ function getAssetRef(source) { return source?.asset?._id || source?.asset?._ref } +// Get the video URL assuming it's been derefernced. I didn't build support +// for ref support here but it should be technically possible +function getVideoUrl(source) { + const dereferencedUrl = source?.asset?.url + if (dereferencedUrl) return dereferencedUrl +} + // Make object-position values from the hotspot data export function makeObjectPosition(source) { if (!source?.hotspot) return