Fix enter causing collapse in chromium
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user