Skip to content

Commit

Permalink
workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
nitayneeman committed Jan 23, 2025
1 parent eb364ce commit 9c4b22b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/astro-blog-loader/src/loader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { posts } from "@wix/blog";
import { createClient, media, OAuthStrategy } from "@wix/sdk";
import type { Loader, LoaderContext } from "astro/loaders";
import { renameKeysFromSDKRequestToRESTRequest } from "@wix/sdk-runtime/rename-all-nested-keys";

const getWixClient = () => {
const { PUBLIC_WIX_CLIENT_ID } = import.meta.env;
Expand Down Expand Up @@ -46,6 +47,9 @@ export function wixBlogLoader(): Loader {
...(item.media?.wixMedia?.image && {
mediaUrl: media.getImageUrl(item.media?.wixMedia?.image).url,
}),
richContent: renameKeysFromSDKRequestToRESTRequest(
item.richContent
),
},
});

Expand Down
6 changes: 6 additions & 0 deletions packages/astro-blog-template/src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const { title, description, pubDate, updatedDate, heroImage } = Astro.props;

<html lang="en">
<head>
<script is:inline>
if (global === undefined) {
var global = window;
}
</script>
<BaseHead title={title} description={description} />
<style>
main {
Expand Down Expand Up @@ -55,6 +60,7 @@ const { title, description, pubDate, updatedDate, heroImage } = Astro.props;
</head>

<body>

<Header />
<main>
<article>
Expand Down
7 changes: 6 additions & 1 deletion packages/astro-blog-template/src/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type CollectionEntry, getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro';
// import { render } from 'astro:content';
import Ricos from '@wix/ricos';
// import {media} from '@wix/sdk'
import '@wix/ricos/css/all-plugins-viewer.css';
export async function getStaticPaths() {
Expand All @@ -20,5 +21,9 @@ const post = Astro.props;

<BlogPost {...post.data}>
<!-- <Content /> -->
<Ricos.RicosViewer content={post.data.richContent} plugins={Ricos.quickStartViewerPlugins()} />
<Ricos.RicosViewer client:load content={post.data.richContent} plugins={Ricos.quickStartViewerPlugins()} _rcProps={{
helpers: {
getImageUrl: (fileName) => `https://static.wixstatic.com/media/${fileName}`
}
}} />
</BlogPost>

0 comments on commit 9c4b22b

Please sign in to comment.