-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Table alignment config option #959
Conversation
6e82587
to
a15a930
Compare
@ptmkenny Would something like this work for you? |
@colinodell Yeah, this is great-- it will eliminate the error for me and others who need to pass W3C for one reason or another. Just a thought-- if we have the ability to inline CSS, is it also possible to add an option to supply the CSS classes for left/center/right align? This might complicate the config too much, but many design frameworks (Bootstrap and Bulma are the ones I am familiar with, but I would assume others as well) already provide classes for doing this alignment, so being able to specify the classes to use would be the optimal solution from the perspective of a framework user. |
Great question... 🤔 Ideally, I wish I could just point users toward the Default Attributes extension and have them configure the alignment attributes there. This would allow them to choose whether to use Perhaps instead of the approach I initially proposed here we should have three config options - something like this: $config = [
'table' => [
'alignment_attributes' => [
'left' => ['align' => 'left'],
'center' => ['align' => 'center'],
'right' => ['align' => 'right'],
],
],
]; It's not as tidy but it would let you easily switch to inline styles: $config = [
'table' => [
'alignment_attributes' => [
'left' => ['style' => 'text-align:left'],
'center' => ['style' => 'text-align:center'],
'right' => ['style' => 'text-align:right'],
],
],
]; Or to classes: $config = [
'table' => [
'alignment_attributes' => [
'left' => ['class' => 'text-start'],
'center' => ['class' => 'text-center'],
'right' => ['class' => 'text-end'],
],
],
]; What do you think about that approach? I'm also open to any alternative ideas you might have here :) |
@colinodell Wow, this looks great. I've been thinking about it for the past couple days, and it seems robust enough to cover all the use cases I could think of--
I definitely think the additional complexity is worth it because it empowers the user to make the extension compatible with whatever other systems they have in place. |
a15a930
to
15a6005
Compare
15a6005
to
8682624
Compare
@colinodell Thanks, I immediately installed and started testing this. One snag-- when I use In My understanding was that setting |
🤦 I forgot to instruct the configuration schema to replace (instead of merge) the default configs with the user-provided configs. This should be fixed in 8721df8 - sorry about that! |
@colinodell Thanks, with the latest version, it's working as expected! |
This PR introduces a new config option to control whether table cell alignment is rendered using
style
oralign
attributes. See #958 for more context.