From eccecfda5d82d88dc120d37a27b5292bb2604bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl-Ian?= Date: Mon, 20 May 2024 23:39:50 +0200 Subject: [PATCH] Prepare 2.2.0 release (#67) * Update changelog * Increment version number * Update development environment --- CHANGELOG.md | 7 + Gemfile.lock | 199 +++++++++--------- lib/cocooned/version.rb | 2 +- .../cocooned/plugins/core/triggers/add.js | 1 + .../plugins/core/triggers/add/builder.js | 2 +- .../plugins/core/triggers/add/extractor.js | 1 + npm/src/cocooned/plugins/core.js | 8 +- .../plugins/core/triggers/add/extractor.js | 2 +- .../plugins/core/triggers/add/replacement.js | 4 +- 9 files changed, 119 insertions(+), 107 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8655419..a7885da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## Version 2.2.0 (2024-05-20) + +## Added + +* Compatibility with Trix (ActionText editor) (#65) +* Allow to setup custom replacements on newly built items before insert (#65) + ## Version 2.1.1 (2024-02-10) ### Fixed diff --git a/Gemfile.lock b/Gemfile.lock index 323fb0c..a2b8e0c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,41 +1,41 @@ PATH remote: . specs: - cocooned (2.1.1) + cocooned (2.2.0) rails (>= 6.0, <= 7.2) GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + actioncable (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actionmailbox (7.1.3.3) + actionpack (= 7.1.3.3) + activejob (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3) - actionpack (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activesupport (= 7.1.3) + actionmailer (7.1.3.3) + actionpack (= 7.1.3.3) + actionview (= 7.1.3.3) + activejob (= 7.1.3.3) + activesupport (= 7.1.3.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3) - actionview (= 7.1.3) - activesupport (= 7.1.3) + actionpack (7.1.3.3) + actionview (= 7.1.3.3) + activesupport (= 7.1.3.3) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -43,35 +43,35 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3) - actionpack (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actiontext (7.1.3.3) + actionpack (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3) - activesupport (= 7.1.3) + actionview (7.1.3.3) + activesupport (= 7.1.3.3) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3) - activesupport (= 7.1.3) + activejob (7.1.3.3) + activesupport (= 7.1.3.3) globalid (>= 0.3.6) - activemodel (7.1.3) - activesupport (= 7.1.3) - activerecord (7.1.3) - activemodel (= 7.1.3) - activesupport (= 7.1.3) + activemodel (7.1.3.3) + activesupport (= 7.1.3.3) + activerecord (7.1.3.3) + activemodel (= 7.1.3.3) + activesupport (= 7.1.3.3) timeout (>= 0.4.0) - activestorage (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activesupport (= 7.1.3) + activestorage (7.1.3.3) + actionpack (= 7.1.3.3) + activejob (= 7.1.3.3) + activerecord (= 7.1.3.3) + activesupport (= 7.1.3.3) marcel (~> 1.0) - activesupport (7.1.3) + activesupport (7.1.3.3) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -83,7 +83,7 @@ GEM tzinfo (~> 2.0) ast (2.4.2) base64 (0.2.0) - bigdecimal (3.1.6) + bigdecimal (3.1.8) builder (3.2.4) byebug (11.1.3) concurrent-ruby (1.2.3) @@ -92,20 +92,19 @@ GEM date (3.3.4) diff-lcs (1.5.1) docile (1.4.0) - drb (2.2.0) - ruby2_keywords + drb (2.2.1) erubi (1.12.0) formtastic (5.0.0) actionpack (>= 6.0.0) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.1) + i18n (1.14.5) concurrent-ruby (~> 1.0) io-console (0.7.2) - irb (1.11.2) - rdoc + irb (1.13.1) + rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.7.1) + json (2.7.2) language_server-protocol (3.17.0.3) loofah (2.22.0) crass (~> 1.0.2) @@ -115,37 +114,37 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) mini_mime (1.1.5) - mini_portile2 (2.8.5) - minitest (5.22.2) + mini_portile2 (2.8.6) + minitest (5.23.0) mutex_m (0.2.0) - net-imap (0.4.10) + net-imap (0.4.11) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) - nokogiri (1.16.2) + nio4r (2.7.3) + nokogiri (1.16.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.2-x86_64-linux) + nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) package_json (0.1.0) parallel (1.24.0) - parser (3.3.0.5) + parser (3.3.1.0) ast (~> 2.4.1) racc psych (5.1.2) stringio puma (6.4.2) nio4r (~> 2.0) - racc (1.7.3) - rack (3.0.9) + racc (1.8.0) + rack (3.0.11) rack-proxy (0.7.7) rack rack-session (2.0.0) @@ -155,20 +154,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3) - actioncable (= 7.1.3) - actionmailbox (= 7.1.3) - actionmailer (= 7.1.3) - actionpack (= 7.1.3) - actiontext (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activemodel (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + rails (7.1.3.3) + actioncable (= 7.1.3.3) + actionmailbox (= 7.1.3.3) + actionmailer (= 7.1.3.3) + actionpack (= 7.1.3.3) + actiontext (= 7.1.3.3) + actionview (= 7.1.3.3) + activejob (= 7.1.3.3) + activemodel (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) bundler (>= 1.15.0) - railties (= 7.1.3) + railties (= 7.1.3.3) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -176,22 +175,23 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + railties (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) irb rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.1.0) - rdoc (6.6.2) + rake (13.2.1) + rdoc (6.6.3.1) psych (>= 4.0.0) - regexp_parser (2.9.0) - reline (0.4.2) + regexp_parser (2.9.2) + reline (0.5.7) io-console (~> 0.5) - rexml (3.2.6) + rexml (3.2.8) + strscan (>= 3.0.9) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -201,19 +201,19 @@ GEM rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.1) + rspec-rails (6.1.2) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) - rspec-support (3.13.0) - rubocop (1.60.2) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.1) + rubocop (1.63.5) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -221,31 +221,33 @@ GEM rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.30.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) rubocop-capybara (2.20.0) rubocop (~> 1.41) rubocop-factory_bot (2.25.1) rubocop (~> 1.41) - rubocop-performance (1.20.2) + rubocop-performance (1.21.0) rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rails (2.23.1) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails (2.25.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.26.1) + rubocop-rspec (2.29.2) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.28.3) + rubocop (~> 1.40) ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) semantic_range (3.0.0) shakapacker (7.2.2) activesupport (>= 5.2) @@ -262,11 +264,12 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sqlite3 (1.7.2) + sqlite3 (1.7.3) mini_portile2 (~> 2.8.0) - sqlite3 (1.7.2-x86_64-linux) + sqlite3 (1.7.3-x86_64-linux) stringio (3.1.0) - thor (1.3.0) + strscan (3.1.0) + thor (1.3.1) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -275,7 +278,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.13) + zeitwerk (2.6.14) PLATFORMS ruby diff --git a/lib/cocooned/version.rb b/lib/cocooned/version.rb index 981fa68..9cc4540 100644 --- a/lib/cocooned/version.rb +++ b/lib/cocooned/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Cocooned - VERSION = '2.1.1' + VERSION = '2.2.0' end diff --git a/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js b/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js index ed0f915..d829534 100644 --- a/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js +++ b/npm/__tests__/unit/cocooned/plugins/core/triggers/add.js @@ -15,6 +15,7 @@ describe('Add', () => { beforeEach(() => { document.body.innerHTML = given.html }) given('extended', () => coreMixin(Base)) + // eslint-disable-next-line new-cap given('add', () => new Add(given.addTrigger, new given.extended(given.container), given.options)) given('addTrigger', () => getAddLink(given.container)) given('container', () => document.querySelector('[data-cocooned-container]')) diff --git a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js index 4ce9aad..9c7ee86 100644 --- a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js +++ b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/builder.js @@ -10,7 +10,7 @@ describe('Builder', () => { given('builder', () => { return new Builder( given.template.content, - given.extended.replacementsFor('new_person') + given.extended.replacementsFor('new_person') ) }) given('id', () => faker.string.numeric(5)) diff --git a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js index 9b2f158..ba1b189 100644 --- a/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js +++ b/npm/__tests__/unit/cocooned/plugins/core/triggers/add/extractor.js @@ -13,6 +13,7 @@ describe('Extractor', () => { beforeEach(() => { document.body.innerHTML = given.html }) given('extended', () => coreMixin(Base)) + // eslint-disable-next-line new-cap given('extractor', () => new Extractor(given.addTrigger, new given.extended(given.container))) given('container', () => document.querySelector('[data-cocooned-container]')) given('addTrigger', () => getAddLink(document)) diff --git a/npm/src/cocooned/plugins/core.js b/npm/src/cocooned/plugins/core.js index 145b2b4..d66b7fb 100644 --- a/npm/src/cocooned/plugins/core.js +++ b/npm/src/cocooned/plugins/core.js @@ -9,7 +9,7 @@ const coreMixin = (Base) => class extends Base { } static get replacements () { - return this.__replacements; + return this.__replacements } static replacementsFor (association) { @@ -46,7 +46,7 @@ const coreMixin = (Base) => class extends Base { } replacementsFor (association) { - return this.constructor.replacementsFor(association); + return this.constructor.replacementsFor(association) } /* Protected and private attributes and methods */ @@ -57,8 +57,8 @@ const coreMixin = (Base) => class extends Base { { tag: '*', attribute: 'name', delimiters: ['[', ']'] }, // Compatibility with Trix. See #65 on Github. - { tag: 'trix-editor', attribute: 'input', delimiters: ['_'] }, - ]; + { tag: 'trix-editor', attribute: 'input', delimiters: ['_'] } + ] } export { diff --git a/npm/src/cocooned/plugins/core/triggers/add/extractor.js b/npm/src/cocooned/plugins/core/triggers/add/extractor.js index 704f73c..fa12f78 100644 --- a/npm/src/cocooned/plugins/core/triggers/add/extractor.js +++ b/npm/src/cocooned/plugins/core/triggers/add/extractor.js @@ -42,7 +42,7 @@ class Extractor { return new Builder( template.content, this.#cocooned.replacementsFor(`new_${this.#dataset.association}`) - ); + ) } _extractCount () { diff --git a/npm/src/cocooned/plugins/core/triggers/add/replacement.js b/npm/src/cocooned/plugins/core/triggers/add/replacement.js index 0a57585..86e8a0b 100644 --- a/npm/src/cocooned/plugins/core/triggers/add/replacement.js +++ b/npm/src/cocooned/plugins/core/triggers/add/replacement.js @@ -43,8 +43,8 @@ class Replacement { #escape (string) { return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : (string || '') + ? string.replace(reRegExpChar, '\\$&') + : (string || '') } }