diff --git a/Changelog.md b/Changelog.md index b28ad5c..2d5c35e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +# v0.6.1 +## Fixed +- Resetting of the code now works again +- destroying of the component resulted in an error +- add width of viewer/console layout back in + # v0.6.0 ## Changed Internal changes to how the iframes work and how messages are posted, should improve performance and future use diff --git a/example/App.svelte b/example/App.svelte index 08070d1..795245f 100644 --- a/example/App.svelte +++ b/example/App.svelte @@ -91,9 +91,24 @@ function changeLayout() { layout = (layout === 'default' ? 'view' : 'default'); } + function resetFiles() { + files = [ + { + name: 'index.html', + content: '

Test

', + type: 'html' + }, + { + name: 'index.js', + content: '', + type: 'js' + } + ]; + } Change Layout +Reset diff --git a/package.json b/package.json index 1b84869..7b988d7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "javascript-repl", "svelte": "src/Repl.svelte", "module": "index.mjs", - "version": "0.6.0", + "version": "0.6.1", "description": "", "main": "index.js", "author": "Mila Frerichs ", diff --git a/src/Repl.svelte b/src/Repl.svelte index e9170a8..b9c46c3 100644 --- a/src/Repl.svelte +++ b/src/Repl.svelte @@ -77,11 +77,15 @@ }); function handleSelect() { - editor.set($currentContent); + if(editor) { + editor.set($currentContent); + } } $: if(files) { + bundle.set({}); file_store.set(files); + handleSelect(); } $: if(injectedJS) { injectedJS_store.set(injectedJS); diff --git a/src/Result.svelte b/src/Result.svelte index 8fda08d..f7436d5 100644 --- a/src/Result.svelte +++ b/src/Result.svelte @@ -86,7 +86,6 @@ } }); onDestroy(() => { - iframeReady.setReady(false, name) iframe.removeEventListener('load', setReady); }); diff --git a/src/ViewerConsole.svelte b/src/ViewerConsole.svelte index 40c8a0f..33fd537 100644 --- a/src/ViewerConsole.svelte +++ b/src/ViewerConsole.svelte @@ -31,7 +31,7 @@
- +
diff --git a/src/stores.js b/src/stores.js index 82a751e..8236a61 100644 --- a/src/stores.js +++ b/src/stores.js @@ -25,6 +25,7 @@ const createBundle = () => { return { subscribe, + set, changeCode: (file, code) => { return update((n) => { n[file.name] = code;