-
Notifications
You must be signed in to change notification settings - Fork 138
Auto-expanding textarea for frontpage text in event settings #1340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: enext
Are you sure you want to change the base?
Changes from all commits
b1f942e
95da794
b49d2b2
f6c4896
2b51180
37cf1db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -165,42 +165,57 @@ def format_output(self, rendered_widgets, id_) -> str: | |||||
| ) | ||||||
| rendered_widgets.append(f'<div class="i18n-field-markdown-note">{markdown_note}</div>') | ||||||
| return super().format_output(rendered_widgets, id_) | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
| class I18nAutoExpandingTextarea(i18nfield.forms.I18nTextarea): | ||||||
|
|
||||||
| def __init__(self, attrs=None, **kwargs): | ||||||
| default_attrs = { | ||||||
| 'class': 'form-control auto-expanding-textarea', | ||||||
| 'data-auto-expand': 'true', | ||||||
| 'style': 'min-height: 80px; max-height: 300px; overflow-y: auto; resize: vertical; transition: height 0.2s ease-in-out;' | ||||||
|
||||||
| 'style': 'min-height: 80px; max-height: 300px; overflow-y: auto; resize: vertical; transition: height 0.2s ease-in-out;' | |
| 'style': 'min-height: 80px; max-height: 300px; overflow-y: hidden; resize: vertical; transition: height 0.2s ease-in-out;' |
jevinjojo marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected on this line. According to PEP 8 style guidelines, lines should not have trailing whitespace. Remove the trailing spaces from this line.
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Blank lines have been removed from the docstring of the I18nURLFormField class. These formatting changes appear to be unintentional as they're unrelated to the auto-expanding textarea feature being added. The removed blank lines served to improve readability by separating sections of the docstring.
Consider restoring the original formatting of this docstring to keep changes focused on the feature being implemented.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||||||||||||||||||||||||||
| (function() { | ||||||||||||||||||||||||||||||
| 'use strict'; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (window.autoExpandTextareaInitialized) { | ||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| window.autoExpandTextareaInitialized = true; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| function autoExpandTextarea(textarea) { | ||||||||||||||||||||||||||||||
| if (!textarea || textarea.hasAttribute('data-auto-expand-init')) return; | ||||||||||||||||||||||||||||||
| textarea.setAttribute('data-auto-expand-init', 'true'); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| function adjustHeight() { | ||||||||||||||||||||||||||||||
| textarea.style.height = 'auto'; | ||||||||||||||||||||||||||||||
| var computedStyle = window.getComputedStyle(textarea); | ||||||||||||||||||||||||||||||
| var minHeight = parseInt(computedStyle.minHeight, 10) || 80; | ||||||||||||||||||||||||||||||
| var maxHeight = parseInt(computedStyle.maxHeight, 10) || 300; | ||||||||||||||||||||||||||||||
| var newHeight = Math.max(minHeight, Math.min(textarea.scrollHeight, maxHeight)); | ||||||||||||||||||||||||||||||
| textarea.style.height = newHeight + 'px'; | ||||||||||||||||||||||||||||||
| textarea.style.overflowY = (textarea.scrollHeight > maxHeight) ? 'auto' : 'hidden'; | ||||||||||||||||||||||||||||||
|
Comment on lines
+15
to
+20
|
||||||||||||||||||||||||||||||
| var computedStyle = window.getComputedStyle(textarea); | |
| var minHeight = parseInt(computedStyle.minHeight, 10) || 80; | |
| var maxHeight = parseInt(computedStyle.maxHeight, 10) || 300; | |
| var newHeight = Math.max(minHeight, Math.min(textarea.scrollHeight, maxHeight)); | |
| textarea.style.height = newHeight + 'px'; | |
| textarea.style.overflowY = (textarea.scrollHeight > maxHeight) ? 'auto' : 'hidden'; | |
| requestAnimationFrame(function() { | |
| var computedStyle = window.getComputedStyle(textarea); | |
| var minHeight = parseInt(computedStyle.minHeight, 10) || 80; | |
| var maxHeight = parseInt(computedStyle.maxHeight, 10) || 300; | |
| var newHeight = Math.max(minHeight, Math.min(textarea.scrollHeight, maxHeight)); | |
| textarea.style.height = newHeight + 'px'; | |
| textarea.style.overflowY = (textarea.scrollHeight > maxHeight) ? 'auto' : 'hidden'; | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected on this line. According to PEP 8 style guidelines, lines should not have trailing whitespace. Remove the trailing spaces from this line.