Update .gitignore and Edit.svelte

This commit is contained in:
Roger Veciana 2024-01-27 00:00:37 +01:00
parent d50f225317
commit 2b6a3d0023
2 changed files with 8 additions and 3 deletions

2
.gitignore vendored
View file

@ -11,7 +11,6 @@ node_modules
# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js
styles.css
# Exclude sourcemaps
*.map
@ -27,3 +26,4 @@ data.json
TODO
yarn.lock
yarn.lock
styles.css

View file

@ -2,12 +2,17 @@
export let data:string;
export let onChange: (newData: string) => void;
$: onChange(data)
$: console.log(data);
</script>
<div>
<div class="content" contenteditable="true" bind:textContent={data} >{data}</div>
<div class="content" contenteditable="true" bind:textContent={data} on:keydown={(e)=>{
if (e.key === 'Enter') {
document.execCommand('insertLineBreak')
e.preventDefault()
}}}>{data}</div>
</div>
@ -18,7 +23,7 @@
opacity: 0.6;
}
.content{
white-space: pre
white-space: pre-line;
}