From 4f5c863a83bf2a42f59d080ceae403489215f26a Mon Sep 17 00:00:00 2001 From: Stephen Nelson Date: Wed, 15 Nov 2023 10:19:13 +1030 Subject: [PATCH] Fix trix loading compatibility with 7.1.2 --- Gemfile | 2 +- Gemfile.lock | 135 +++++++++--------- .../content/editor/trix_controller.js | 7 +- 3 files changed, 74 insertions(+), 70 deletions(-) diff --git a/Gemfile b/Gemfile index c360a3b..2acc52f 100644 --- a/Gemfile +++ b/Gemfile @@ -8,10 +8,10 @@ gem "dartsass-rails" gem "image_processing" gem "importmap-rails" gem "katalyst-tables" +gem "propshaft" gem "rails" gem "rake" gem "rubocop-katalyst", require: false -gem "sprockets-rails" gem "sqlite3" gem "stimulus-rails" gem "turbo-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 06bed94..c9ae567 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/rubycdp/cuprite.git - revision: 39406967868a245543f04b5f1420fd62f5c69b81 + revision: ddc9cee5188d49b84712ba1a88f31abb456badae specs: cuprite (0.15) capybara (~> 3.0) @@ -15,75 +15,76 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.1.1) - actionpack (= 7.1.1) - activesupport (= 7.1.1) + actioncable (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.1) - actionpack (= 7.1.1) - activejob (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + actionmailbox (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.1) - actionpack (= 7.1.1) - actionview (= 7.1.1) - activejob (= 7.1.1) - activesupport (= 7.1.1) + actionmailer (7.1.2) + actionpack (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activesupport (= 7.1.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.1) - actionview (= 7.1.1) - activesupport (= 7.1.1) + actionpack (7.1.2) + actionview (= 7.1.2) + activesupport (= 7.1.2) nokogiri (>= 1.8.5) + racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.1) - actionpack (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + actiontext (7.1.2) + actionpack (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.1) - activesupport (= 7.1.1) + actionview (7.1.2) + activesupport (= 7.1.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - active_storage_validations (1.1.1) + active_storage_validations (1.1.2) activejob (>= 5.2.0) activemodel (>= 5.2.0) activestorage (>= 5.2.0) activesupport (>= 5.2.0) - activejob (7.1.1) - activesupport (= 7.1.1) + activejob (7.1.2) + activesupport (= 7.1.2) globalid (>= 0.3.6) - activemodel (7.1.1) - activesupport (= 7.1.1) - activerecord (7.1.1) - activemodel (= 7.1.1) - activesupport (= 7.1.1) + activemodel (7.1.2) + activesupport (= 7.1.2) + activerecord (7.1.2) + activemodel (= 7.1.2) + activesupport (= 7.1.2) timeout (>= 0.4.0) - activestorage (7.1.1) - actionpack (= 7.1.1) - activejob (= 7.1.1) - activerecord (= 7.1.1) - activesupport (= 7.1.1) + activestorage (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activesupport (= 7.1.2) marcel (~> 1.0) - activesupport (7.1.1) + activesupport (7.1.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -148,15 +149,15 @@ GEM activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.6.0) - irb (1.8.3) + irb (1.9.0) rdoc reline (>= 0.3.8) json (2.6.3) - katalyst-tables (2.2.9) + katalyst-tables (2.2.10) html-attributes-utils view_component language_server-protocol (3.17.0.3) - loofah (2.21.4) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -171,7 +172,7 @@ GEM mini_mime (1.1.5) minitest (5.20.0) mutex_m (0.2.0) - net-imap (0.4.4) + net-imap (0.4.5) date net-protocol net-pop (0.1.2) @@ -189,6 +190,11 @@ GEM parser (3.2.2.4) ast (~> 2.4.1) racc + propshaft (0.8.0) + actionpack (>= 7.0.0) + activesupport (>= 7.0.0) + rack + railties (>= 7.0.0) psych (5.1.1.1) stringio public_suffix (5.0.3) @@ -203,20 +209,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.1) - actioncable (= 7.1.1) - actionmailbox (= 7.1.1) - actionmailer (= 7.1.1) - actionpack (= 7.1.1) - actiontext (= 7.1.1) - actionview (= 7.1.1) - activejob (= 7.1.1) - activemodel (= 7.1.1) - activerecord (= 7.1.1) - activestorage (= 7.1.1) - activesupport (= 7.1.1) + rails (7.1.2) + actioncable (= 7.1.2) + actionmailbox (= 7.1.2) + actionmailer (= 7.1.2) + actionpack (= 7.1.2) + actiontext (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activemodel (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) bundler (>= 1.15.0) - railties (= 7.1.1) + railties (= 7.1.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -228,9 +234,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.1) - actionpack (= 7.1.1) - activesupport (= 7.1.1) + railties (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -307,13 +313,6 @@ GEM google-protobuf (~> 3.23) shoulda-matchers (5.3.0) activesupport (>= 5.2.0) - sprockets (4.2.1) - concurrent-ruby (~> 1.0) - rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) sqlite3 (1.6.8-arm64-darwin) sqlite3 (1.6.8-x86_64-linux) stimulus-rails (1.3.0) @@ -357,6 +356,7 @@ DEPENDENCIES importmap-rails katalyst-content! katalyst-tables + propshaft puma rails rails-controller-testing @@ -368,10 +368,9 @@ DEPENDENCIES rubocop-rake rubocop-rspec shoulda-matchers - sprockets-rails sqlite3 stimulus-rails turbo-rails BUNDLED WITH - 2.4.21 + 2.4.22 diff --git a/app/assets/javascripts/controllers/content/editor/trix_controller.js b/app/assets/javascripts/controllers/content/editor/trix_controller.js index 04d6abe..3bc1819 100644 --- a/app/assets/javascripts/controllers/content/editor/trix_controller.js +++ b/app/assets/javascripts/controllers/content/editor/trix_controller.js @@ -1,5 +1,10 @@ import { Controller } from "@hotwired/stimulus"; -import Trix from "trix"; +import "trix"; + +// Note, action_text 7.1.2 changes how Trix is bundled and loaded. This +// seems to have broken the default export from trix. This is a workaround +// that relies on the backwards compatibility of the old export to window.Trix. +const Trix = window.Trix; // Stimulus controller doesn't do anything, but having one ensures that trix // will be lazy loaded when a trix-editor is added to the dom.