Skip to content

Commit

Permalink
use native autosize if support
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Jun 20, 2024
1 parent 0af5603 commit a43edc3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/behaviors/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { observe } from 'selector-observer'
// import { default as autosize } from '@github/textarea-autosize'
import { tabToIndentListener } from 'indent-textarea'
import { insert, wrapSelection } from 'text-field-edit'
import { insertTextIntoField as insert, wrapFieldSelection as wrapSelection } from 'text-field-edit'
import { stop } from '../helpers/dom'

interface Subscriber {
Expand Down Expand Up @@ -148,6 +148,10 @@ const oneKeyFormatting = onKeydown((event) => {

const autosize = function autosize(el: Element): Subscriber {
const textarea = el as HTMLTextAreaElement
if ('fieldSizing' in textarea.style) {
textarea.style.fieldSizing = 'content'
return { unsubscribe() {} }
}

function fitSize() {
textarea.style.height = '0'
Expand Down

0 comments on commit a43edc3

Please sign in to comment.