Fix enter causing collapse in chromium

This commit is contained in:
kwaroran
2024-09-24 09:08:32 +09:00
parent 71d575ebfe
commit e42776cd29
2 changed files with 6 additions and 5 deletions

View File

@@ -34,7 +34,7 @@
export let marginBottom = false
export let fullwidth = false
export let fullh = false
export let onChange:ChangeEventHandler<HTMLInputElement>
export let onChange:ChangeEventHandler<HTMLInputElement> = () => {}
export let className = ''
export let disabled = false
</script>

View File

@@ -40,7 +40,7 @@
>
{#if !highlight}
<textarea
class="w-full h-full bg-transparent focus-within:outline-none resize-none absolute top-0 left-0 z-10 overflow-y-auto"
class="w-full h-full bg-transparent focus-within:outline-none resize-none absolute top-0 left-0 z-50 overflow-y-auto"
class:px-4={padding}
class:py-2={padding}
{autocomplete}
@@ -69,7 +69,7 @@
/>
{:else if isFirefox}
<div
class="w-full h-full bg-transparent focus-within:outline-none resize-none absolute top-0 left-0 z-10 overflow-y-auto px-4 py-2 break-words whitespace-pre-wrap"
class="w-full h-full bg-transparent focus-within:outline-none resize-none absolute top-0 left-0 z-50 overflow-y-auto px-4 py-2 break-words whitespace-pre-wrap"
contenteditable="true"
bind:textContent={value}
on:keydown={(e) => {
@@ -91,9 +91,9 @@
>{value ?? ''}</div>
{:else}
<div
class="w-full h-full bg-transparent focus-within:outline-none resize-none absolute top-0 left-0 z-10 overflow-y-auto px-4 py-2 break-words whitespace-pre-wrap"
class="w-full h-full bg-transparent focus-within:outline-none resize-none absolute top-0 left-0 z-50 overflow-y-auto px-4 py-2 break-words whitespace-pre-wrap"
contenteditable="plaintext-only"
bind:textContent={value}
bind:innerText={value}
on:keydown={(e) => {
handleKeyDown(e)
onInput()
@@ -185,6 +185,7 @@
}
const insertContent = (insertContent:string, type:'autoComplete'|'paste' = 'autoComplete') => {
console.log(insertContent)
const sel = window.getSelection()
if(sel){
const range = sel.getRangeAt(0)