1- import { Notice , PluginSettingTab , Setting , debounce } from 'obsidian' ;
1+ import { Notice , PluginSettingTab , Setting , TextAreaComponent , debounce } from 'obsidian' ;
22import { StatusConfiguration , StatusType } from '../Statuses/StatusConfiguration' ;
33import type TasksPlugin from '../main' ;
44import { StatusRegistry } from '../Statuses/StatusRegistry' ;
@@ -686,17 +686,7 @@ export class SettingsTab extends PluginSettingTab {
686686 textArea . inputEl . addClass ( 'tasks-includes-value' ) ;
687687 textArea . setPlaceholder ( 'Query or filter text...' ) . setValue ( value ) ;
688688
689- // Resize to fit content
690- const resize = ( ) => {
691- textArea . inputEl . style . height = 'auto' ; // reset first
692- textArea . inputEl . style . height = `${ textArea . inputEl . scrollHeight } px` ;
693- } ;
694-
695- // Initial resize
696- resize ( ) ;
697-
698- // Resize on input
699- textArea . inputEl . addEventListener ( 'input' , resize ) ;
689+ this . setupAutoResizingTextarea ( textArea ) ;
700690
701691 return textArea . onChange ( async ( newValue ) => {
702692 settings . includes [ key ] = newValue ;
@@ -718,6 +708,19 @@ export class SettingsTab extends PluginSettingTab {
718708 } ) ;
719709 }
720710
711+ private setupAutoResizingTextarea ( textArea : TextAreaComponent ) {
712+ const resize = ( ) => {
713+ textArea . inputEl . style . height = 'auto' ; // reset first
714+ textArea . inputEl . style . height = `${ textArea . inputEl . scrollHeight } px` ;
715+ } ;
716+
717+ // Initial resize
718+ resize ( ) ;
719+
720+ // Resize on input
721+ textArea . inputEl . addEventListener ( 'input' , resize ) ;
722+ }
723+
721724 private createAddNewIncludeButton ( containerEl : HTMLElement , settings : Settings , renderIncludes : ( ) => void ) {
722725 new Setting ( containerEl ) . addButton ( ( btn ) => {
723726 btn . setButtonText ( 'Add new include' )
0 commit comments