svelte-ace icon indicating copy to clipboard operation
svelte-ace copied to clipboard

window is not defined error when using svelte-ace and trying to display json code

Open thegiantgod opened this issue 1 year ago • 3 comments

Hello, I have a svelte app using sveltekit and I am trying to display a js object as json code (just like GPT does when showing you code). But I always encounter this error :

ReferenceError: window is not defined

Here is my code, can you give me any tips ? Thank you very much !

`

export let entry;

`

<Card class="entry_card"> <Content class="card_content"> <h4>{entry.input}</h4> <p>Summary: {entry.summary}</p> <p>Query: {entry.sqlRequest}</p> <AceEditor lang="json" value={JSON.stringify(entry.data)}/> </Content> <Actions> <ActionButtons> <IconButton class="material-icons" style="flex-basis: 25%; color: orange;" >star_outlined</IconButton> </ActionButtons> </Actions> </Card>

(Sorry for the formating git editor was causing problems)

thegiantgod avatar Jan 16 '24 16:01 thegiantgod

Having the same issue.

lu-ne-va avatar Jan 31 '24 19:01 lu-ne-va

How did you guys solve this?

stormsc1 avatar May 02 '24 14:05 stormsc1

How did you guys solve this?

Hey, I tried but could not solve it, I did not need to display json in the end so I just let it go.

thegiantgod avatar May 16 '24 08:05 thegiantgod