actiontext 7.1.3.2 → 7.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actiontext might be problematic. Click here for more details.

Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -88
  3. data/app/assets/javascripts/actiontext.esm.js +3 -3
  4. data/app/assets/javascripts/actiontext.js +3 -3
  5. data/app/assets/javascripts/trix.js +92 -30
  6. data/app/assets/stylesheets/trix.css +3 -1
  7. data/app/helpers/action_text/content_helper.rb +2 -0
  8. data/app/helpers/action_text/tag_helper.rb +38 -28
  9. data/app/models/action_text/encrypted_rich_text.rb +2 -2
  10. data/app/models/action_text/record.rb +2 -0
  11. data/app/models/action_text/rich_text.rb +58 -26
  12. data/db/migrate/20180528164100_create_action_text_tables.rb +1 -1
  13. data/lib/action_text/attachable.rb +35 -33
  14. data/lib/action_text/attachables/content_attachment.rb +2 -0
  15. data/lib/action_text/attachables/missing_attachable.rb +2 -0
  16. data/lib/action_text/attachables/remote_image.rb +2 -0
  17. data/lib/action_text/attachment.rb +27 -25
  18. data/lib/action_text/attachment_gallery.rb +2 -0
  19. data/lib/action_text/attachments/caching.rb +2 -0
  20. data/lib/action_text/attachments/minification.rb +2 -0
  21. data/lib/action_text/attachments/trix_conversion.rb +2 -0
  22. data/lib/action_text/attribute.rb +36 -22
  23. data/lib/action_text/content.rb +46 -26
  24. data/lib/action_text/deprecator.rb +2 -0
  25. data/lib/action_text/encryption.rb +2 -0
  26. data/lib/action_text/engine.rb +2 -0
  27. data/lib/action_text/fixture_set.rb +34 -34
  28. data/lib/action_text/fragment.rb +4 -0
  29. data/lib/action_text/gem_version.rb +6 -4
  30. data/lib/action_text/html_conversion.rb +2 -0
  31. data/lib/action_text/plain_text_conversion.rb +2 -0
  32. data/lib/action_text/rendering.rb +2 -0
  33. data/lib/action_text/serialization.rb +2 -0
  34. data/lib/action_text/system_test_helper.rb +20 -17
  35. data/lib/action_text/trix_attachment.rb +2 -0
  36. data/lib/action_text/version.rb +3 -1
  37. data/lib/action_text.rb +1 -1
  38. data/lib/generators/action_text/install/install_generator.rb +10 -3
  39. data/lib/rails/generators/test_unit/install_generator.rb +2 -0
  40. data/package.json +1 -1
  41. metadata +15 -15
@@ -1,62 +1,62 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
- # = Action Text \FixtureSet
6
+ # # Action Text FixtureSet
5
7
  #
6
- # Fixtures are a way of organizing data that you want to test against; in
7
- # short, sample data.
8
+ # Fixtures are a way of organizing data that you want to test against; in short,
9
+ # sample data.
8
10
  #
9
11
  # To learn more about fixtures, read the ActiveRecord::FixtureSet documentation.
10
12
  #
11
- # === YAML
13
+ # ### YAML
12
14
  #
13
15
  # Like other Active Record-backed models, ActionText::RichText records inherit
14
- # from ActiveRecord::Base instances and can therefore be populated by
15
- # fixtures.
16
+ # from ActiveRecord::Base instances and can therefore be populated by fixtures.
16
17
  #
17
- # Consider an <tt>Article</tt> class:
18
+ # Consider an `Article` class:
18
19
  #
19
- # class Article < ApplicationRecord
20
- # has_rich_text :content
21
- # end
20
+ # class Article < ApplicationRecord
21
+ # has_rich_text :content
22
+ # end
22
23
  #
23
- # To declare fixture data for the related <tt>content</tt>, first declare fixture
24
- # data for <tt>Article</tt> instances in <tt>test/fixtures/articles.yml</tt>:
24
+ # To declare fixture data for the related `content`, first declare fixture data
25
+ # for `Article` instances in `test/fixtures/articles.yml`:
25
26
  #
26
- # first:
27
- # title: An Article
27
+ # first:
28
+ # title: An Article
28
29
  #
29
30
  # Then declare the ActionText::RichText fixture data in
30
- # <tt>test/fixtures/action_text/rich_texts.yml</tt>, making sure to declare
31
- # each entry's <tt>record:</tt> key as a polymorphic relationship:
31
+ # `test/fixtures/action_text/rich_texts.yml`, making sure to declare each
32
+ # entry's `record:` key as a polymorphic relationship:
32
33
  #
33
- # first:
34
- # record: first (Article)
35
- # name: content
36
- # body: <div>Hello, world.</div>
34
+ # first:
35
+ # record: first (Article)
36
+ # name: content
37
+ # body: <div>Hello, world.</div>
37
38
  #
38
39
  # When processed, Active Record will insert database records for each fixture
39
40
  # entry and will ensure the Action Text relationship is intact.
40
41
  class FixtureSet
41
- # Fixtures support Action Text attachments as part of their <tt>body</tt>
42
- # HTML.
42
+ # Fixtures support Action Text attachments as part of their `body` HTML.
43
43
  #
44
- # === Examples
44
+ # ### Examples
45
45
  #
46
- # For example, consider a second <tt>Article</tt> fixture declared in
47
- # <tt>test/fixtures/articles.yml</tt>:
46
+ # For example, consider a second `Article` fixture declared in
47
+ # `test/fixtures/articles.yml`:
48
48
  #
49
- # second:
50
- # title: Another Article
49
+ # second:
50
+ # title: Another Article
51
51
  #
52
- # You can attach a mention of <tt>articles(:first)</tt> to <tt>second</tt>'s
53
- # <tt>content</tt> by embedding a call to <tt>ActionText::FixtureSet.attachment</tt>
54
- # in the <tt>body:</tt> value in <tt>test/fixtures/action_text/rich_texts.yml</tt>:
52
+ # You can attach a mention of `articles(:first)` to `second`'s `content` by
53
+ # embedding a call to `ActionText::FixtureSet.attachment` in the `body:` value
54
+ # in `test/fixtures/action_text/rich_texts.yml`:
55
55
  #
56
- # second:
57
- # record: second (Article)
58
- # name: content
59
- # body: <div>Hello, <%= ActionText::FixtureSet.attachment("articles", :first) %></div>
56
+ # second:
57
+ # record: second (Article)
58
+ # name: content
59
+ # body: <div>Hello, <%= ActionText::FixtureSet.attachment("articles", :first) %></div>
60
60
  #
61
61
  def self.attachment(fixture_set_name, label, column_type: :integer)
62
62
  signed_global_id = ActiveRecord::FixtureSet.signed_global_id fixture_set_name, label,
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
6
  class Fragment
5
7
  class << self
@@ -21,6 +23,8 @@ module ActionText
21
23
 
22
24
  attr_reader :source
23
25
 
26
+ delegate :deconstruct, to: "source.elements"
27
+
24
28
  def initialize(source)
25
29
  @source = source
26
30
  end
@@ -1,16 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
- # Returns the currently loaded version of Action Text as a +Gem::Version+.
6
+ # Returns the currently loaded version of Action Text as a `Gem::Version`.
5
7
  def self.gem_version
6
8
  Gem::Version.new VERSION::STRING
7
9
  end
8
10
 
9
11
  module VERSION
10
12
  MAJOR = 7
11
- MINOR = 1
12
- TINY = 3
13
- PRE = "2"
13
+ MINOR = 2
14
+ TINY = 0
15
+ PRE = "beta1"
14
16
 
15
17
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
18
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
6
  module HtmlConversion
5
7
  extend self
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
6
  module PlainTextConversion
5
7
  extend self
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require "active_support/concern"
4
6
  require "active_support/core_ext/module/attribute_accessors_per_thread"
5
7
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
6
  module Serialization
5
7
  extend ActiveSupport::Concern
@@ -1,34 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
6
  module SystemTestHelper
5
7
  # Locates a Trix editor and fills it in with the given HTML.
6
8
  #
7
9
  # The editor can be found by:
8
- # * its +id+
9
- # * its +placeholder+
10
- # * the text from its +label+ element
11
- # * its +aria-label+
12
- # * the +name+ of its input
10
+ # * its `id`
11
+ # * its `placeholder`
12
+ # * the text from its `label` element
13
+ # * its `aria-label`
14
+ # * the `name` of its input
15
+ #
13
16
  #
14
17
  # Examples:
15
18
  #
16
- # # <trix-editor id="message_content" ...></trix-editor>
17
- # fill_in_rich_text_area "message_content", with: "Hello <em>world!</em>"
19
+ # # <trix-editor id="message_content" ...></trix-editor>
20
+ # fill_in_rich_text_area "message_content", with: "Hello <em>world!</em>"
18
21
  #
19
- # # <trix-editor placeholder="Your message here" ...></trix-editor>
20
- # fill_in_rich_text_area "Your message here", with: "Hello <em>world!</em>"
22
+ # # <trix-editor placeholder="Your message here" ...></trix-editor>
23
+ # fill_in_rich_text_area "Your message here", with: "Hello <em>world!</em>"
21
24
  #
22
- # # <label for="message_content">Message content</label>
23
- # # <trix-editor id="message_content" ...></trix-editor>
24
- # fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
25
+ # # <label for="message_content">Message content</label>
26
+ # # <trix-editor id="message_content" ...></trix-editor>
27
+ # fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
25
28
  #
26
- # # <trix-editor aria-label="Message content" ...></trix-editor>
27
- # fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
29
+ # # <trix-editor aria-label="Message content" ...></trix-editor>
30
+ # fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
28
31
  #
29
- # # <input id="trix_input_1" name="message[content]" type="hidden">
30
- # # <trix-editor input="trix_input_1"></trix-editor>
31
- # fill_in_rich_text_area "message[content]", with: "Hello <em>world!</em>"
32
+ # # <input id="trix_input_1" name="message[content]" type="hidden">
33
+ # # <trix-editor input="trix_input_1"></trix-editor>
34
+ # fill_in_rich_text_area "message[content]", with: "Hello <em>world!</em>"
32
35
  def fill_in_rich_text_area(locator = nil, with:)
33
36
  find(:rich_text_area, locator).execute_script("this.editor.loadHTML(arguments[0])", with.to_s)
34
37
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module ActionText
4
6
  class TrixAttachment
5
7
  TAG_NAME = "figure"
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require_relative "gem_version"
4
6
 
5
7
  module ActionText
6
- # Returns the currently loaded version of Action Text as a +Gem::Version+.
8
+ # Returns the currently loaded version of Action Text as a `Gem::Version`.
7
9
  def self.version
8
10
  gem_version
9
11
  end
data/lib/action_text.rb CHANGED
@@ -9,7 +9,7 @@ require "action_text/deprecator"
9
9
  require "nokogiri"
10
10
 
11
11
  # :markup: markdown
12
- # :include: actiontext/README.md
12
+ # :include: ../README.md
13
13
  module ActionText
14
14
  extend ActiveSupport::Autoload
15
15
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  require "pathname"
4
6
  require "json"
5
7
 
@@ -60,7 +62,12 @@ module ActionText
60
62
  def enable_image_processing_gem
61
63
  if (gemfile_path = Pathname(destination_root).join("Gemfile")).exist?
62
64
  say "Ensure image_processing gem has been enabled so image uploads will work (remember to bundle!)"
63
- uncomment_lines gemfile_path, /gem "image_processing"/
65
+ image_processing_regex = /gem ["']image_processing["']/
66
+ if File.readlines(gemfile_path).grep(image_processing_regex).any?
67
+ uncomment_lines gemfile_path, image_processing_regex
68
+ else
69
+ run "bundle add --skip-install image_processing"
70
+ end
64
71
  end
65
72
  end
66
73
 
@@ -73,8 +80,8 @@ module ActionText
73
80
  end
74
81
 
75
82
  def using_bun?
76
- # Cannot assume yarn.lock has been generated yet so we look for
77
- # a file known to be generated by the jsbundling-rails gem
83
+ # Cannot assume yarn.lock has been generated yet so we look for a file known to
84
+ # be generated by the jsbundling-rails gem
78
85
  @using_bun ||= using_js_runtime? && Pathname(destination_root).join("bun.config.js").exist?
79
86
  end
80
87
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :markup: markdown
4
+
3
5
  module TestUnit
4
6
  module Generators
5
7
  class InstallGenerator < ::Rails::Generators::Base
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rails/actiontext",
3
- "version": "7.1.3-2",
3
+ "version": "7.2.0-beta1",
4
4
  "description": "Edit and display rich text in Rails applications",
5
5
  "module": "app/assets/javascripts/actiontext.esm.js",
6
6
  "main": "app/assets/javascripts/actiontext.js",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actiontext
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.3.2
4
+ version: 7.2.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javan Makhmali
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-02-21 00:00:00.000000000 Z
13
+ date: 2024-05-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -18,56 +18,56 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 7.1.3.2
21
+ version: 7.2.0.beta1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 7.1.3.2
28
+ version: 7.2.0.beta1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: activerecord
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 7.1.3.2
35
+ version: 7.2.0.beta1
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 7.1.3.2
42
+ version: 7.2.0.beta1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: activestorage
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 7.1.3.2
49
+ version: 7.2.0.beta1
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 7.1.3.2
56
+ version: 7.2.0.beta1
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: actionpack
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 7.1.3.2
63
+ version: 7.2.0.beta1
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 7.1.3.2
70
+ version: 7.2.0.beta1
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: nokogiri
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -163,10 +163,10 @@ licenses:
163
163
  - MIT
164
164
  metadata:
165
165
  bug_tracker_uri: https://github.com/rails/rails/issues
166
- changelog_uri: https://github.com/rails/rails/blob/v7.1.3.2/actiontext/CHANGELOG.md
167
- documentation_uri: https://api.rubyonrails.org/v7.1.3.2/
166
+ changelog_uri: https://github.com/rails/rails/blob/v7.2.0.beta1/actiontext/CHANGELOG.md
167
+ documentation_uri: https://api.rubyonrails.org/v7.2.0.beta1/
168
168
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
169
- source_code_uri: https://github.com/rails/rails/tree/v7.1.3.2/actiontext
169
+ source_code_uri: https://github.com/rails/rails/tree/v7.2.0.beta1/actiontext
170
170
  rubygems_mfa_required: 'true'
171
171
  post_install_message:
172
172
  rdoc_options: []
@@ -176,14 +176,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - ">="
178
178
  - !ruby/object:Gem::Version
179
- version: 2.7.0
179
+ version: 3.1.0
180
180
  required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - ">="
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  requirements: []
186
- rubygems_version: 3.5.3
186
+ rubygems_version: 3.5.10
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Rich text framework.