Skip to content

Commit a43edc3

Browse files
committed
use native autosize if support
1 parent 0af5603 commit a43edc3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/behaviors/editor.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { observe } from 'selector-observer'
33
// import { default as autosize } from '@github/textarea-autosize'
44
import { tabToIndentListener } from 'indent-textarea'
5-
import { insert, wrapSelection } from 'text-field-edit'
5+
import { insertTextIntoField as insert, wrapFieldSelection as wrapSelection } from 'text-field-edit'
66
import { stop } from '../helpers/dom'
77

88
interface Subscriber {
@@ -148,6 +148,10 @@ const oneKeyFormatting = onKeydown((event) => {
148148

149149
const autosize = function autosize(el: Element): Subscriber {
150150
const textarea = el as HTMLTextAreaElement
151+
if ('fieldSizing' in textarea.style) {
152+
textarea.style.fieldSizing = 'content'
153+
return { unsubscribe() {} }
154+
}
151155

152156
function fitSize() {
153157
textarea.style.height = '0'

0 commit comments

Comments
 (0)