Skip to content

Commit 5a4c4c0

Browse files
CoveMBericglau
andauthored
Fix safari rendering issue for Cairo, Stellar,Stylus (#495)
Co-authored-by: Eric Lau <[email protected]>
1 parent 197b8c5 commit 5a4c4c0

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

packages/ui/src/cairo/App.svelte

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { createEventDispatcher } from 'svelte';
2+
import { createEventDispatcher, tick } from 'svelte';
33
44
import hljs from './highlightjs';
55
@@ -27,12 +27,20 @@
2727
2828
const dispatch = createEventDispatcher();
2929
30+
let showCode = true;
31+
async function allowRendering() {
32+
showCode = false;
33+
await tick();
34+
showCode = true;
35+
}
36+
3037
export let initialTab: string | undefined = 'ERC20';
3138
3239
export let tab: Kind = sanitizeKind(initialTab);
3340
$: {
3441
tab = sanitizeKind(tab);
3542
dispatch('tab-change', tab);
43+
allowRendering();
3644
};
3745
3846
export let initialOpts: InitialOptions = {};
@@ -73,6 +81,7 @@
7381
throw e;
7482
}
7583
}
84+
allowRendering();
7685
}
7786
}
7887
@@ -183,7 +192,13 @@
183192
</div>
184193
</div>
185194
<div class="output rounded-r-3xl flex flex-col grow overflow-auto h-[calc(100vh-84px)]">
186-
<pre class="flex flex-col grow basis-0 overflow-auto"><code class="hljs -cairo grow overflow-auto p-4">{@html highlightedCode}</code></pre>
195+
<pre class="flex flex-col grow basis-0 overflow-auto">
196+
{#if showCode}
197+
<code class="hljs -cairo grow overflow-auto p-4">
198+
{@html highlightedCode}
199+
</code>
200+
{/if}
201+
</pre>
187202
</div>
188203
</div>
189204
</div>

packages/ui/src/stellar/App.svelte

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { createEventDispatcher } from 'svelte';
2+
import { createEventDispatcher, tick } from 'svelte';
33
44
import hljs from './highlightjs';
55
@@ -20,13 +20,21 @@
2020
import { InitialOptions } from '../common/initial-options';
2121
2222
const dispatch = createEventDispatcher();
23+
24+
let showCode = true;
25+
async function allowRendering() {
26+
showCode = false;
27+
await tick();
28+
showCode = true;
29+
}
2330
2431
export let initialTab: string | undefined = 'Fungible';
2532
2633
export let tab: Kind = sanitizeKind(initialTab);
2734
$: {
2835
tab = sanitizeKind(tab);
2936
dispatch('tab-change', tab);
37+
allowRendering();
3038
};
3139
3240
export let initialOpts: InitialOptions = {};
@@ -59,6 +67,7 @@
5967
throw e;
6068
}
6169
}
70+
allowRendering();
6271
}
6372
}
6473
@@ -133,7 +142,12 @@
133142
</div>
134143
</div>
135144
<div class="output rounded-r-3xl flex flex-col grow overflow-auto h-[calc(100vh-84px)]">
136-
<pre class="flex flex-col grow basis-0 overflow-auto"><code class="hljs -stellar grow overflow-auto p-4">{@html highlightedCode}</code></pre>
145+
<pre class="flex flex-col grow basis-0 overflow-auto">
146+
{#if showCode}
147+
<code class="hljs -stellar grow overflow-auto p-4">
148+
{@html highlightedCode}
149+
</code>
150+
{/if}
137151
</div>
138152
</div>
139153
</div>

packages/ui/src/stylus/App.svelte

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { createEventDispatcher } from 'svelte';
2+
import { createEventDispatcher, tick } from 'svelte';
33
44
import hljs from './highlightjs';
55
@@ -23,12 +23,20 @@
2323
2424
const dispatch = createEventDispatcher();
2525
26+
let showCode = true;
27+
async function allowRendering() {
28+
showCode = false;
29+
await tick();
30+
showCode = true;
31+
}
32+
2633
export let initialTab: string | undefined = 'ERC20';
2734
2835
export let tab: Kind = sanitizeKind(initialTab);
2936
$: {
3037
tab = sanitizeKind(tab);
3138
dispatch('tab-change', tab);
39+
allowRendering();
3240
};
3341
3442
export let initialOpts: InitialOptions = {};
@@ -67,6 +75,7 @@
6775
throw e;
6876
}
6977
}
78+
allowRendering();
7079
}
7180
}
7281
@@ -153,7 +162,13 @@
153162
</div>
154163
</div>
155164
<div class="output rounded-r-3xl flex flex-col grow overflow-auto h-[calc(100vh-84px)]">
156-
<pre class="flex flex-col grow basis-0 overflow-auto"><code class="hljs -stylus grow overflow-auto p-4">{@html highlightedCode}</code></pre>
165+
<pre class="flex flex-col grow basis-0 overflow-auto">
166+
{#if showCode}
167+
<code class="hljs -stylus grow overflow-auto p-4">
168+
{@html highlightedCode}
169+
</code>
170+
{/if}
171+
</pre>
157172
</div>
158173
</div>
159174
</div>

0 commit comments

Comments
 (0)