-
Notifications
You must be signed in to change notification settings - Fork 41
Add new align option hooks #2593
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: master
Are you sure you want to change the base?
Changes from all commits
8036909
fefdecc
41fa639
252e94a
3ace44c
46dcd15
220661b
a0154e3
62f5639
5ae0983
fa86fd5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
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.
Guard
data-alignfallback and use the selected option instead of the first matchThe new fallback assumes:
settingalways has anoption[data-align], andThis can cause issues:
Potential runtime error: If
settingis a text input (e.g.,.frm_classes) with an empty value, or a<select>without anyoption[data-align], thensetting.querySelector( 'option[data-align]' )returnsnulland.getAttribute( 'data-align' )will throw.Wrong alignment when multiple options have
data-align:querySelector( 'option[data-align]' )always returns the first matching option, not the selected one, so the applied class may not match the user’s current choice.Over‑broad application: The fallback should only apply to the align dropdown (
.field_options_align), not to every control wired throughchangeFieldClass.Recommend tightening the logic to:
data-alignfrom the selected option.data-alignis available.For example:
This keeps existing behavior for non‑align inputs, avoids exceptions when no
data-alignis present, and correctly respects the user’s selected alignment option.📝 Committable suggestion
🤖 Prompt for AI Agents