diff --git a/Gemfile.lock b/Gemfile.lock index 0f465b0b6..db2dffc10 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,7 +163,7 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - date (3.3.3) + date (3.3.4) declarative (0.0.20) devise (4.8.1) bcrypt (~> 3.0) @@ -208,8 +208,8 @@ GEM formtastic_i18n (0.7.0) friendly_id (5.4.2) activerecord (>= 4.0.0) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) google-apis-core (0.7.0) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) @@ -281,7 +281,7 @@ GEM listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -295,24 +295,24 @@ GEM method_source (1.0.0) mini_magick (4.11.0) mini_mime (1.1.5) - mini_portile2 (2.8.4) - minitest (5.19.0) + mini_portile2 (2.8.5) + minitest (5.21.1) msgpack (1.5.3) multi_json (1.15.0) - net-imap (0.3.7) + net-imap (0.4.9.1) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout net-scp (1.2.1) net-ssh (>= 2.6.5) - net-smtp (0.3.3) + net-smtp (0.4.0.1) net-protocol net-ssh (7.0.1) - nio4r (2.5.9) - nokogiri (1.15.4) + nio4r (2.7.0) + nokogiri (1.16.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) optimist (3.0.1) @@ -338,7 +338,7 @@ GEM public_suffix (4.0.7) puma (5.6.7) nio4r (~> 2.0) - racc (1.7.1) + racc (1.7.3) rack (2.2.8) rack-cors (1.1.1) rack (>= 2.0.0) @@ -379,7 +379,7 @@ GEM rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) ransack (2.6.0) activerecord (>= 6.0.4) activesupport (>= 6.0.4) @@ -487,7 +487,7 @@ GEM spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.2.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) @@ -502,10 +502,10 @@ GEM diff-lcs patience_diff test-prof (1.0.9) - thor (1.2.2) + thor (1.3.0) tilt (2.0.10) timecop (0.9.5) - timeout (0.4.0) + timeout (0.4.1) trailblazer-option (0.1.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) @@ -543,7 +543,7 @@ GEM rails (>= 3.2.16) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.11) + zeitwerk (2.6.12) PLATFORMS ruby diff --git a/app/assets/stylesheets/admin/trix.scss b/app/assets/stylesheets/admin/trix.scss index 7799bb54d..153cf5f25 100644 --- a/app/assets/stylesheets/admin/trix.scss +++ b/app/assets/stylesheets/admin/trix.scss @@ -15,3 +15,29 @@ trix-toolbar { } } } + +.trix-editor, .trix-content { + font-size: 1rem; + + .attachment { + &__caption { + display: none; + } + } + + .attachment--preview { + //position: relative; + //float: left; + //width: auto; + //margin: 10px 10px 10px 0; + text-align: center; + max-width: 100%; + padding: 0; + } + + &:after { + content: ''; + display: block; + clear: both; + } +} diff --git a/app/assets/stylesheets/tpi/_pages.scss b/app/assets/stylesheets/tpi/_pages.scss index 3678e66f7..144a4860e 100644 --- a/app/assets/stylesheets/tpi/_pages.scss +++ b/app/assets/stylesheets/tpi/_pages.scss @@ -47,6 +47,25 @@ $margin-between-list-items: 20px; margin-top: 30px; margin-bottom: 30px; } + + .attachment { + &--preview { + //position: relative; + //float: left; + //margin: 10px 10px 10px 0; + text-align: center; + max-width: 100%; + padding: 0; + + img { + margin: 0; + } + } + + &__caption { + display: none; + } + } } .pages__content { diff --git a/app/decorators/news_article_decorator.rb b/app/decorators/news_article_decorator.rb index 14ea5f497..068870b93 100644 --- a/app/decorators/news_article_decorator.rb +++ b/app/decorators/news_article_decorator.rb @@ -15,8 +15,6 @@ def tpi_sector_links end def preview_url - h.tpi_publication_url( - model, {type: 'NewsArticle', host: Rails.configuration.try(:tpi_domain)}.compact - ) + h.show_news_article_tpi_publication_path(model, {host: Rails.configuration.try(:tpi_domain)}.compact) end end diff --git a/app/inputs/trix_input.rb b/app/inputs/trix_input.rb index 66d1a9d81..cafeae800 100644 --- a/app/inputs/trix_input.rb +++ b/app/inputs/trix_input.rb @@ -3,6 +3,8 @@ def to_html input_wrapping do editor_tag_params = { input: input_html_options[:id], + 'data-direct-upload-url': Rails.application.routes.url_helpers.rails_direct_uploads_path, + 'data-blob-url-template': Rails.application.routes.url_helpers.rails_service_blob_path(':signed_id', ':filename'), class: 'trix-content' } diff --git a/app/javascript/packs/admin.js b/app/javascript/packs/admin.js index e8f5a70b9..a64fb43c0 100644 --- a/app/javascript/packs/admin.js +++ b/app/javascript/packs/admin.js @@ -1 +1,4 @@ import 'admin'; + +require('@rails/activestorage'); +require('@rails/actiontext'); diff --git a/bin/yarn b/bin/yarn index 4700a9e63..9fab2c350 100755 --- a/bin/yarn +++ b/bin/yarn @@ -3,7 +3,7 @@ APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do yarn = ENV["PATH"].split(File::PATH_SEPARATOR). select { |dir| File.expand_path(dir) != __dir__ }. - product(["yarn", "yarn.exe"]). + product(["yarn", "yarn.cmd", "yarn.ps1"]). map { |dir, file| File.expand_path(file, dir) }. find { |file| File.executable?(file) } diff --git a/package.json b/package.json index 8709a5afd..f0dc15c65 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "@hotwired/stimulus": "^3.1.0", "@hotwired/stimulus-webpack-helpers": "^1.0.1", "@rails/actioncable": "^6.0.3-3", + "@rails/actiontext": "^6.1.7-6", "@rails/activestorage": "^6.0.3-3", "@rails/ujs": "^6.0.3-3", "@rails/webpacker": "^5.2.1", @@ -63,7 +64,7 @@ "react_ujs": "^2.6.0", "simple-statistics": "^7.1.0", "tiny-slider": "^2.9.3", - "trix": "^1.2.4", + "trix": "^1.2.0", "turbolinks": "^5.2.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 897b2ba39..f44d0df65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1241,6 +1241,20 @@ resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-6.0.5.tgz#a889f25b0c13ea0215d747e32fa3d1a52967f17b" integrity sha512-79sIsTpIoHnJ6pRHKaC6h5NMRpY+VZD4mqOKN/035X1ehxHgToDWvgMZ4jV5y1qeObg4enmNESmgeKoImYGzOw== +"@rails/actiontext@^6.1.7-6": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@rails/actiontext/-/actiontext-6.1.7.tgz#62997bda1d938743ed36bb802885592b01bc6782" + integrity sha512-o3TYFeFzDQKR22EGqE9qqJ6SD4DM+cATw8nioPtrRkIlAsBIHeaV0h4Kok1sDXyNjXiJztCr89CsfV7YXnYFmw== + dependencies: + "@rails/activestorage" "^6.0.0" + +"@rails/activestorage@^6.0.0": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-6.1.7.tgz#5aaae9f4d10800fdb4fd6fe26fd8b4218579c6e3" + integrity sha512-h++k8LBLns4O8AqzdaFp1TsCLP9VSc2hgWI37bjzJ+4D995X7Rd8kdkRmXRaNAUlHDJgy6RpnbhBJ5oiIgWTDw== + dependencies: + spark-md5 "^3.0.0" + "@rails/activestorage@^6.0.3-3": version "6.0.5" resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-6.0.5.tgz#446e4b3f45bf1d4e1c6fd0b8b6e2566cb70c2b18" @@ -8724,7 +8738,7 @@ topojson-client@^3.0.0: dependencies: commander "2" -trix@^1.2.4: +trix@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/trix/-/trix-1.3.1.tgz#ccce8d9e72bf0fe70c8c019ff558c70266f8d857" integrity sha512-BbH6mb6gk+AV4f2as38mP6Ucc1LE3OD6XxkZnAgPIduWXYtvg2mI3cZhIZSLqmMh9OITEpOBCCk88IVmyjU7bA==