Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit f727b64

Browse files
authored
Merge pull request #987 from storyblok/feature/985-inline-assets-as-opt-in
feat: 985-inline-assets-as-opt-in
2 parents 3adfcb5 + 58eb88a commit f727b64

File tree

6 files changed

+1101
-605
lines changed

6 files changed

+1101
-605
lines changed

playground/vanilla/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"devDependencies": {
12+
"pathe": "^1.1.2",
1213
"typescript": "^5.7.2",
1314
"vite": "^5.4.11",
1415
"vite-plugin-qrcode": "^0.2.3"

playground/vanilla/src/main.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import StoryblokClient from 'storyblok-js-client'
2-
import RichTextResolver from 'storyblok-js-client/richTextResolver'
32
import './style.css'
43

54
const headers = new Headers()
@@ -13,27 +12,15 @@ console.log(headers2.constructor.name)
1312
const Storyblok = new StoryblokClient({
1413
accessToken: import.meta.env.VITE_ACCESS_TOKEN as string,
1514
headers,
15+
inlineAssets: true,
1616
})
1717

1818
try {
1919
const result = await Storyblok.get('cdn/stories/', {
2020
version: 'draft',
2121
resolve_relations: 'root.author',
22+
resolve_assets: 1,
2223
})
23-
const resolver = new RichTextResolver()
24-
25-
const paragraph = {
26-
type: 'paragraph',
27-
content: [
28-
{
29-
text: 'Bold and italic',
30-
type: 'text',
31-
marks: [{ type: 'bold' }, { type: 'italic' }],
32-
},
33-
],
34-
}
35-
36-
const html = resolver.render(paragraph, {}, false)
3724

3825
document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
3926
<pre>

playground/vanilla/vite.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'vite'
22

3-
/* import { resolve } from 'pathe' */
3+
import { resolve } from 'pathe'
44

55
import { qrcode } from 'vite-plugin-qrcode'
66

@@ -9,9 +9,9 @@ export default defineConfig({
99
plugins: [
1010
qrcode(), // only applies in dev mode
1111
],
12-
/* resolve: {
12+
resolve: {
1313
alias: {
1414
'storyblok-js-client': resolve(__dirname, '../../src/index.ts'),
1515
},
16-
}, */
16+
},
1717
})

0 commit comments

Comments
 (0)