Skip to content

Allow multiple dialogs by using the default dialog mechanism in trix#1409

Closed
simmerz wants to merge 12 commits intoSpinaCMS:mainfrom
simmerz:multiple_trix_dialogs
Closed

Allow multiple dialogs by using the default dialog mechanism in trix#1409
simmerz wants to merge 12 commits intoSpinaCMS:mainfrom
simmerz:multiple_trix_dialogs

Conversation

@simmerz
Copy link
Member

@simmerz simmerz commented Oct 14, 2025

Slight design change in the link modal to stop it overlapping other editors.

Primary focus of this PR is to allow multiple buttons to have dialogs by reverting back to the native mechanism in trix.

I've had to add a comment with some tw classes, to force the tailwind builder to see them. Happy to remove, but didn't know a better way to handle that whilst still on older versions of tailwind-ruby/rails and not using the new engine features in importmaps.

@Bramjetten
Copy link
Contributor

Great!

I believe the original RevealController was also written by you, no?

@simmerz
Copy link
Member Author

simmerz commented Oct 15, 2025

It was indeed! It just doesn't fit this purpose, and Trix has its own dialog management, so why tinker :)

spina.gemspec Outdated
gem.add_dependency "jsonapi-serializer"
gem.add_dependency "browser"
gem.add_dependency "tailwindcss-ruby"
gem.add_dependency "tailwindcss-ruby", '< 4.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, but it does break projects using Tailwind v4. I should probably upgrade Spina to use Tailwind v4 as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't CI properly unless that's added in at the moment. It does break, and I don't like it being there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the right solution here is to remove this actually, and to upgrade TW in a separate PR, then rebase this and confirm all works and merge.

@simmerz simmerz force-pushed the multiple_trix_dialogs branch from 95a4b9f to 98521be Compare October 21, 2025 08:19
@simmerz simmerz force-pushed the multiple_trix_dialogs branch from 93d8366 to d02597d Compare November 10, 2025 08:59
@stale
Copy link

stale bot commented Jan 9, 2026

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Trix editor's dialog system to support multiple dialogs by reverting to Trix's native dialog mechanism. The main change replaces the custom reveal controller-based dialog with Trix's built-in dialog attributes and styling.

Changes:

  • Replaced custom dialog implementation with Trix's native dialog mechanism in the toolbar component
  • Added CSS styling for Trix dialogs with proper positioning and visibility control
  • Removed max-width constraint from modal windows
  • Added generated Tailwind CSS file to .gitignore
  • Fixed trailing whitespace and formatting issues across multiple files

Reviewed changes

Copilot reviewed 3 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/components/spina/forms/trix_toolbar_component.html.erb Refactored link dialog to use Trix's native dialog attributes instead of custom reveal controller
lib/generators/spina/templates/app/assets/stylesheets/spina/application.tailwind.css.tt Added Trix dialog styling with positioning, visibility rules, and updated modal-window class
app/assets/builds/spina/tailwind.css Compiled Tailwind CSS output (auto-generated file)
.gitignore Added generated CSS file to ignore list
.github/workflows/ruby.yml Fixed YAML formatting and added package update to apt-get
Other ERB files Removed trailing whitespace

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
@apply w-full max-w-lg overflow-hidden relative;
@apply w-full overflow-hidden relative;
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The max-width constraint has been removed from the modal-window class, which could cause modals to become excessively wide on large screens. Consider adding a max-width value (e.g., max-w-2xl or max-w-3xl) to maintain reasonable dialog proportions across different screen sizes.

Suggested change
@apply w-full overflow-hidden relative;
@apply w-full max-w-3xl overflow-hidden relative;

Copilot uses AI. Check for mistakes.

.btn-primary:hover {
@apply bg-spina-dark;
}
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment listing multiple Tailwind classes appears to be a workaround to force the Tailwind JIT compiler to include these classes in the build. Consider documenting why these specific classes are needed and where they're used, as this is non-obvious and could lead to confusion. A better approach would be to use Tailwind's safelist configuration if this is truly necessary.

Copilot uses AI. Check for mistakes.
@Bramjetten
Copy link
Contributor

Continued in #1418

@Bramjetten Bramjetten closed this Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants