|
2 | 2 | /*eslint no-useless-escape: "off"*/
|
3 | 3 | import { tick } from 'svelte'
|
4 | 4 | import { SvelteToast, toast } from '../src'
|
5 |
| -import Prism from './Prism.svelte' |
| 5 | +//import Prism from './Prism.svelte' |
6 | 6 | import DummyComponent from './Dummy.svelte'
|
7 | 7 | import camelCase from 'camelcase'
|
| 8 | +import Prism from 'prismjs' |
8 | 9 |
|
9 | 10 | // Hoist to `window` for debug
|
10 | 11 | window.toast = toast
|
@@ -63,7 +64,9 @@ const buttons = [
|
63 | 64 | code: `toast.push(\`<strong>You won the jackpot!</strong><br>
|
64 | 65 | Click <a href="#" target="_blank">here</a> for details! 😛\`)`,
|
65 | 66 | run: () => {
|
66 |
| - toast.push('<strong>You won the jackpot!</strong><br>Click <a href="#" target="_blank">here</a> for details! 😛') |
| 67 | + toast.push( |
| 68 | + '<strong>You won the jackpot!</strong><br>Click <a href="#" target="_blank">here</a> for details! 😛' |
| 69 | + ) |
67 | 70 | }
|
68 | 71 | },
|
69 | 72 | {
|
@@ -296,7 +299,9 @@ toast.pop(0)`,
|
296 | 299 | run: () => {
|
297 | 300 | toast.push('Wait for it...', {
|
298 | 301 | onpop: () => {
|
299 |
| - toast.push(`<strong><tt>onpop()</tt></strong> callback has been executed.`, { target: 'new' }) |
| 302 | + toast.push(`<strong><tt>onpop()</tt></strong> callback has been executed.`, { |
| 303 | + target: 'new' |
| 304 | + }) |
300 | 305 | }
|
301 | 306 | })
|
302 | 307 | }
|
@@ -328,6 +333,9 @@ toast.pop(0)`,
|
328 | 333 | }
|
329 | 334 | }
|
330 | 335 | ]
|
| 336 | +
|
| 337 | +let formatted |
| 338 | +$: formatted = Prism.highlight(code, Prism.languages.javascript, 'javascript') |
331 | 339 | </script>
|
332 | 340 |
|
333 | 341 | <style>
|
@@ -367,9 +375,10 @@ toast.pop(0)`,
|
367 | 375 |
|
368 | 376 | <div class="container">
|
369 | 377 | <div class="w-full h-64 px-2 mt-4 mb-8">
|
370 |
| - <Prism classes="w-full h-full bg-gray-700 text-gray-200 font-mono shadow rounded-sm overflow-scroll p-4"> |
371 |
| - {code} |
372 |
| - </Prism> |
| 378 | + <pre |
| 379 | + class="w-full h-full bg-gray-700 text-gray-200 font-mono shadow rounded-sm overflow-scroll p-4"><code |
| 380 | + class="language-javascript">{@html formatted}</code |
| 381 | + ></pre> |
373 | 382 | </div>
|
374 | 383 | <div class="flex flex-row flex-wrap items-center justify-center">
|
375 | 384 | {#each buttons as btn}
|
|
0 commit comments