File tree 3 files changed +8
-3
lines changed 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 17
17
"TextareaName" "content"
18
18
"TextareaPlaceholder" ($.locale.Tr "repo.diff.comment.placeholder")
19
19
"DropzoneParentContainer" "form"
20
+ "DisableAutosize" "true"
20
21
)}}
21
22
22
23
<div class="field footer gt-mx-3">
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Template Attributes:
10
10
* TextareaPlaceholder: placeholder attribute for the textarea
11
11
* TextareaAriaLabel: aria-label attribute for the textarea
12
12
* DropzoneParentContainer: container for file upload (leave it empty if no upload)
13
+ * DisableAutosize: whether to disable automatic height resizing
13
14
*/}}
14
15
<div {{if .ContainerId}}id="{{.ContainerId}}"{{end}} class="combo-markdown-editor {{.ContainerClasses}}" data-dropzone-parent-container="{{.DropzoneParentContainer}}">
15
16
{{if .MarkdownPreviewUrl}}
@@ -45,7 +46,7 @@ Template Attributes:
45
46
</div>
46
47
</markdown-toolbar>
47
48
<text-expander keys=": @" suffix="">
48
- <textarea class="markdown-text-editor js-quick-submit"{{if .TextareaName}} name="{{.TextareaName}}"{{end}}{{if .TextareaPlaceholder}} placeholder="{{.TextareaPlaceholder}}"{{end}}{{if .TextareaAriaLabel}} aria-label="{{.TextareaAriaLabel}}"{{end}}>{{.TextareaContent}}</textarea>
49
+ <textarea class="markdown-text-editor js-quick-submit"{{if .TextareaName}} name="{{.TextareaName}}"{{end}}{{if .TextareaPlaceholder}} placeholder="{{.TextareaPlaceholder}}"{{end}}{{if .TextareaAriaLabel}} aria-label="{{.TextareaAriaLabel}}"{{end}}{{if .DisableAutosize}} data-disable-autosize="{{.DisableAutosize}}"{{end}} >{{.TextareaContent}}</textarea>
49
50
</text-expander>
50
51
<script>
51
52
if (localStorage?.getItem('markdown-editor-monospace') === 'true') {
Original file line number Diff line number Diff line change @@ -69,7 +69,10 @@ class ComboMarkdownEditor {
69
69
this . textarea . id = `_combo_markdown_editor_${ String ( elementIdCounter ++ ) } ` ;
70
70
this . textarea . addEventListener ( 'input' , ( e ) => this . options ?. onContentChanged ?. ( this , e ) ) ;
71
71
this . applyEditorHeights ( this . textarea , this . options . editorHeights ) ;
72
- this . textareaAutosize = autosize ( this . textarea , { viewportMarginBottom : 130 } ) ;
72
+
73
+ if ( this . textarea . getAttribute ( 'data-disable-autosize' ) !== 'true' ) {
74
+ this . textareaAutosize = autosize ( this . textarea , { viewportMarginBottom : 130 } ) ;
75
+ }
73
76
74
77
this . textareaMarkdownToolbar = this . container . querySelector ( 'markdown-toolbar' ) ;
75
78
this . textareaMarkdownToolbar . setAttribute ( 'for' , this . textarea . id ) ;
@@ -247,7 +250,7 @@ class ComboMarkdownEditor {
247
250
} else {
248
251
this . textarea . value = v ;
249
252
}
250
- this . textareaAutosize . resizeToFit ( ) ;
253
+ this . textareaAutosize ? .resizeToFit ( ) ;
251
254
}
252
255
253
256
focus ( ) {
You can’t perform that action at this time.
0 commit comments