Skip to content

Conversation

@seanpdoyle
Copy link
Collaborator

Depends on #1263

Proposal

In an effort to absorb responsibilities from @rails/actiontext (namely
the app/javascript/actiontext/index.js and
app/javascript/actiontext/attachment_upload.js files), this commit
introduces a new trix/actiontext file that the build process will
output to be consumable from the action_text-trix engine's asset
directory.

The trix/actiontext module will depend on two in-browser dependencies:

  • trix expected to be imported separately
  • @rails/activestorage expected to available for import. Since there
    is a direct dependency on @rails/activestorage through the
    @rails/acitontext package, the dependency will dependably (😉) be
    present.

In support of this change, this commit also expands the system test
coverage introduced by #1258 to also account for
direct-upload:-prefixed events dispatched during file uploads.

Release strategy

This change should not be part of a release until the corresponding event listener in app/javascript/actiontext/index.js (as part of rails/rails) is removed.

I defer on the rest of the maintenance team to coordinate the switch with the rails/rails maintenance team. I suggest that this package introduce the change and rails/rails add conditional logic or guidance to include constraints on the package version, rather than the other way around. I suspect that this package is more regularly release and has more flexibility than its upstream counterpart.

Once introduced, this trix/actiontext module (and the corresponding test/system/**/*_test.rb coverage could serve as a replacement for CI's upstream git checkout and code coverage.

The changes proposed to
`action_text-trix/app/assets/javascripts/trix.js` were generated by
executing the following:

```sh
yarn build
```

To reduce the risk of future commits' outputs being excluded from the
commits that introduce them, this commit introduces some `git` commands
to the `.github/workflows/ci.yml` file to fail CI builds when `yarn
build` creates changes that are not already checked into the git commit.
The commands are lifted directly from the [hotwired/turbo-rails][]
version of this file.

[hotwired/turbo-rails]: https://github.com/hotwired/turbo-rails/blob/v2.0.20/.github/workflows/ci.yml#L48-L51
@seanpdoyle seanpdoyle force-pushed the trix-actiontext branch 3 times, most recently from 6cdaebb to 3fe165a Compare November 2, 2025 01:10
@seanpdoyle seanpdoyle force-pushed the trix-actiontext branch 3 times, most recently from e9343a1 to 1f65f1d Compare November 2, 2025 01:49
In an effort to absorb responsibilities from `@rails/actiontext` (namely
the [app/javascript/actiontext/index.js][] and
[app/javascript/actiontext/attachment_upload.js][] files), this commit
introduces a new `trix/actiontext` file that the build process will
output to be consumable from the `action_text-trix` engine's asset
directory.

The `trix/actiontext` module will depend on two in-browser dependencies:

* `trix` expected to be imported separately
* `@rails/activestorage` expected to available for import. Since there
  is a direct dependency on `@rails/activestorage` through the
  `@rails/acitontext` package, the dependency will dependably (😉) be
  present.

In support of this change, this commit also expands the system test
coverage introduced by [basecamp#1258][] to also account for
`direct-upload:`-prefixed events dispatched during file uploads.

[app/javascript/actiontext/index.js]: https://github.com/rails/rails/blob/v8.0.3/actiontext/app/javascript/actiontext/index.js
[app/javascript/actiontext/attachment_upload.js]: https://github.com/rails/rails/blob/v8.0.3/actiontext/app/javascript/actiontext/attachment_upload.js
[basecamp#1258]: basecamp#1258
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.

1 participant