actiontext 6.0.6.1 → 6.1.7.6
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +79 -49
- data/MIT-LICENSE +1 -1
- data/app/helpers/action_text/content_helper.rb +1 -1
- data/app/helpers/action_text/tag_helper.rb +9 -1
- data/app/models/action_text/record.rb +9 -0
- data/app/models/action_text/rich_text.rb +1 -1
- data/lib/action_text/attachables/remote_image.rb +1 -1
- data/lib/action_text/attachment.rb +2 -0
- data/lib/action_text/attachment_gallery.rb +1 -1
- data/lib/action_text/attachments/trix_conversion.rb +3 -1
- data/lib/action_text/attribute.rb +5 -0
- data/lib/action_text/content.rb +1 -1
- data/lib/action_text/engine.rb +12 -1
- data/lib/action_text/fixture_set.rb +12 -0
- data/lib/action_text/gem_version.rb +3 -3
- data/lib/action_text/plain_text_conversion.rb +5 -3
- data/lib/action_text/rendering.rb +2 -1
- data/lib/action_text/serialization.rb +2 -0
- data/lib/action_text/system_test_helper.rb +55 -0
- data/lib/action_text.rb +1 -0
- data/lib/generators/action_text/install/install_generator.rb +67 -0
- data/lib/rails/generators/test_unit/install_generator.rb +13 -0
- data/lib/tasks/actiontext.rake +3 -17
- data/package.json +2 -2
- metadata +21 -17
- data/lib/templates/installer.rb +0 -45
- /data/lib/{templates → generators/action_text/install/templates}/actiontext.scss +0 -0
- /data/lib/{templates → rails/generators/test_unit/templates}/fixtures.yml +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade2359f8361e07381d3d3222604819da052044bf4e908554aee999ddd4fbe4a
|
4
|
+
data.tar.gz: db49f4a5d9dbfcb621e69843700e23aa92106e647199f8856205ba584d8797cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac8817cc17b9d78b2c5c2c77920075e4291142799665d5e675696e8af1d3602d2254132e3e04fb9c36c15cdb2ea4c096ab6f3ebf476b8116b3ea5225315f3fc0
|
7
|
+
data.tar.gz: 999b41e6a5f09a823eeae2ee4f6930a3150a2d32a62c58f85920e7c34778b081dafab1756269b905459a2a91829b117c439ef98f09a82c1c54e4e7316f5949f8
|
data/CHANGELOG.md
CHANGED
@@ -1,163 +1,193 @@
|
|
1
|
-
## Rails 6.
|
1
|
+
## Rails 6.1.7.6 (August 22, 2023) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails 6.
|
6
|
+
## Rails 6.1.7.5 (August 22, 2023) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails 6.
|
11
|
+
## Rails 6.1.7.4 (June 26, 2023) ##
|
12
12
|
|
13
13
|
* No changes.
|
14
14
|
|
15
15
|
|
16
|
-
## Rails 6.
|
16
|
+
## Rails 6.1.7.3 (March 13, 2023) ##
|
17
17
|
|
18
|
-
*
|
19
|
-
|
20
|
-
Allow Action Text to be used without having an ApplicationController
|
21
|
-
defined.
|
22
|
-
This makes sure:
|
23
|
-
* Action Text attachments render the correct URL host in mailers.
|
24
|
-
* an ActionController::Renderer isn't allocated per request.
|
25
|
-
* Sidekiq doesn't hang with the "classic" autoloader.
|
18
|
+
* No changes.
|
26
19
|
|
27
|
-
*Jonathan Hefner*
|
28
20
|
|
29
|
-
## Rails 6.
|
21
|
+
## Rails 6.1.7.2 (January 24, 2023) ##
|
30
22
|
|
31
23
|
* No changes.
|
32
24
|
|
33
25
|
|
34
|
-
## Rails 6.
|
26
|
+
## Rails 6.1.7.1 (January 17, 2023) ##
|
35
27
|
|
36
28
|
* No changes.
|
37
29
|
|
38
30
|
|
39
|
-
## Rails 6.
|
31
|
+
## Rails 6.1.7 (September 09, 2022) ##
|
40
32
|
|
41
33
|
* No changes.
|
42
34
|
|
43
35
|
|
44
|
-
## Rails 6.
|
36
|
+
## Rails 6.1.6.1 (July 12, 2022) ##
|
45
37
|
|
46
38
|
* No changes.
|
47
39
|
|
48
40
|
|
49
|
-
## Rails 6.
|
41
|
+
## Rails 6.1.6 (May 09, 2022) ##
|
50
42
|
|
51
43
|
* No changes.
|
52
44
|
|
53
45
|
|
54
|
-
## Rails 6.
|
46
|
+
## Rails 6.1.5.1 (April 26, 2022) ##
|
55
47
|
|
56
48
|
* No changes.
|
57
49
|
|
58
50
|
|
59
|
-
## Rails 6.
|
51
|
+
## Rails 6.1.5 (March 09, 2022) ##
|
60
52
|
|
61
|
-
*
|
53
|
+
* Fix Action Text extra trix content wrapper.
|
54
|
+
|
55
|
+
*Alexandre Ruban*
|
62
56
|
|
63
57
|
|
64
|
-
## Rails 6.
|
58
|
+
## Rails 6.1.4.7 (March 08, 2022) ##
|
65
59
|
|
66
60
|
* No changes.
|
67
61
|
|
68
62
|
|
69
|
-
## Rails 6.
|
63
|
+
## Rails 6.1.4.6 (February 11, 2022) ##
|
70
64
|
|
71
65
|
* No changes.
|
72
66
|
|
73
67
|
|
74
|
-
## Rails 6.
|
68
|
+
## Rails 6.1.4.5 (February 11, 2022) ##
|
75
69
|
|
76
70
|
* No changes.
|
77
71
|
|
78
72
|
|
79
|
-
## Rails 6.
|
73
|
+
## Rails 6.1.4.4 (December 15, 2021) ##
|
80
74
|
|
81
75
|
* No changes.
|
82
76
|
|
83
77
|
|
84
|
-
## Rails 6.
|
78
|
+
## Rails 6.1.4.3 (December 14, 2021) ##
|
85
79
|
|
86
80
|
* No changes.
|
87
81
|
|
88
82
|
|
89
|
-
## Rails 6.
|
83
|
+
## Rails 6.1.4.2 (December 14, 2021) ##
|
90
84
|
|
91
85
|
* No changes.
|
92
86
|
|
93
87
|
|
94
|
-
## Rails 6.
|
88
|
+
## Rails 6.1.4.1 (August 19, 2021) ##
|
95
89
|
|
96
90
|
* No changes.
|
97
91
|
|
98
92
|
|
99
|
-
## Rails 6.
|
93
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
100
94
|
|
101
|
-
*
|
95
|
+
* Always render attachment partials as HTML with `:html` format inside trix editor.
|
96
|
+
|
97
|
+
*James Brooks*
|
102
98
|
|
103
99
|
|
104
|
-
## Rails 6.
|
100
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
105
101
|
|
106
102
|
* No changes.
|
107
103
|
|
108
104
|
|
109
|
-
## Rails 6.
|
105
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
110
106
|
|
111
107
|
* No changes.
|
112
108
|
|
113
109
|
|
114
|
-
## Rails 6.
|
110
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
115
111
|
|
116
112
|
* No changes.
|
117
113
|
|
118
114
|
|
119
|
-
## Rails 6.
|
115
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
120
116
|
|
121
117
|
* No changes.
|
122
118
|
|
123
119
|
|
124
|
-
## Rails 6.
|
120
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
125
121
|
|
126
122
|
* No changes.
|
127
123
|
|
128
124
|
|
129
|
-
## Rails 6.
|
125
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
130
126
|
|
131
127
|
* No changes.
|
132
128
|
|
133
129
|
|
134
|
-
## Rails 6.
|
130
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
135
131
|
|
136
|
-
*
|
132
|
+
* Declare `ActionText::FixtureSet.attachment` to generate an
|
133
|
+
`<action-text-attachment sgid="..."></action-text-attachment>` element with
|
134
|
+
a valid `sgid` attribute.
|
137
135
|
|
136
|
+
```ruby
|
137
|
+
hello_world_review_content:
|
138
|
+
record: hello_world (Review)
|
139
|
+
name: content
|
140
|
+
body: <p><%= ActionText::FixtureSet.attachment("messages", :hello_world) %> is great!</p>
|
141
|
+
```
|
138
142
|
|
139
|
-
|
143
|
+
*Sean Doyle*
|
140
144
|
|
141
|
-
*
|
145
|
+
* Locate `fill_in_rich_text_area` by `<label>` text
|
142
146
|
|
147
|
+
In addition to searching for `<trix-editor>` elements with the appropriate
|
148
|
+
`aria-label` attribute, also support locating elements that match the
|
149
|
+
corresponding `<label>` element's text.
|
143
150
|
|
144
|
-
|
151
|
+
*Sean Doyle*
|
145
152
|
|
146
|
-
*
|
153
|
+
* Be able to add a default value to `rich_text_area`.
|
147
154
|
|
155
|
+
```ruby
|
156
|
+
form.rich_text_area :content, value: "<h1>Hello world</h1>"
|
157
|
+
#=> <input type="hidden" name="message[content]" id="message_content_trix_input_message_1" value="<h1>Hello world</h1>">
|
158
|
+
```
|
148
159
|
|
149
|
-
|
160
|
+
*Paulo Ancheta*
|
150
161
|
|
151
|
-
*
|
162
|
+
* Add method to confirm rich text content existence by adding `?` after rich
|
163
|
+
text attribute.
|
152
164
|
|
165
|
+
```ruby
|
166
|
+
message = Message.create!(body: "<h1>Funny times!</h1>")
|
167
|
+
message.body? #=> true
|
168
|
+
```
|
153
169
|
|
154
|
-
|
170
|
+
*Kyohei Toyoda*
|
155
171
|
|
156
|
-
*
|
172
|
+
* The `fill_in_rich_text_area` system test helper locates a Trix editor
|
173
|
+
and fills it in with the given HTML.
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
# <trix-editor id="message_content" ...></trix-editor>
|
177
|
+
fill_in_rich_text_area "message_content", with: "Hello <em>world!</em>"
|
178
|
+
|
179
|
+
# <trix-editor placeholder="Your message here" ...></trix-editor>
|
180
|
+
fill_in_rich_text_area "Your message here", with: "Hello <em>world!</em>"
|
181
|
+
|
182
|
+
# <trix-editor aria-label="Message content" ...></trix-editor>
|
183
|
+
fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
|
157
184
|
|
185
|
+
# <input id="trix_input_1" name="message[content]" type="hidden">
|
186
|
+
# <trix-editor input="trix_input_1"></trix-editor>
|
187
|
+
fill_in_rich_text_area "message[content]", with: "Hello <em>world!</em>"
|
188
|
+
```
|
158
189
|
|
159
|
-
|
190
|
+
*George Claghorn*
|
160
191
|
|
161
|
-
* Added to Rails.
|
162
192
|
|
163
|
-
|
193
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actiontext/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support/core_ext/object/try"
|
3
4
|
require "action_view/helpers/tags/placeholderable"
|
4
5
|
|
5
6
|
module ActionText
|
@@ -45,7 +46,7 @@ module ActionView::Helpers
|
|
45
46
|
options = @options.stringify_keys
|
46
47
|
add_default_name_and_id(options)
|
47
48
|
options["input"] ||= dom_id(object, [options["id"], :trix_input].compact.join("_")) if object
|
48
|
-
@template_object.rich_text_area_tag(options.delete("name"), editable_value, options)
|
49
|
+
@template_object.rich_text_area_tag(options.delete("name"), options.fetch("value") { editable_value }, options.except("value"))
|
49
50
|
end
|
50
51
|
|
51
52
|
def editable_value
|
@@ -59,6 +60,7 @@ module ActionView::Helpers
|
|
59
60
|
#
|
60
61
|
# ==== Options
|
61
62
|
# * <tt>:class</tt> - Defaults to "trix-content" which ensures default styling is applied.
|
63
|
+
# * <tt>:value</tt> - Adds a default value to the HTML input tag.
|
62
64
|
#
|
63
65
|
# ==== Example
|
64
66
|
# form_with(model: @message) do |form|
|
@@ -66,6 +68,12 @@ module ActionView::Helpers
|
|
66
68
|
# end
|
67
69
|
# # <input type="hidden" name="message[content]" id="message_content_trix_input_message_1">
|
68
70
|
# # <trix-editor id="content" input="message_content_trix_input_message_1" class="trix-content" ...></trix-editor>
|
71
|
+
#
|
72
|
+
# form_with(model: @message) do |form|
|
73
|
+
# form.rich_text_area :content, value: "<h1>Default message</h1>"
|
74
|
+
# end
|
75
|
+
# # <input type="hidden" name="message[content]" id="message_content_trix_input_message_1" value="<h1>Default message</h1>">
|
76
|
+
# # <trix-editor id="content" input="message_content_trix_input_message_1" class="trix-content" ...></trix-editor>
|
69
77
|
def rich_text_area(object_name, method, options = {})
|
70
78
|
Tags::ActionText.new(object_name, method, self, options).render
|
71
79
|
end
|
@@ -5,7 +5,7 @@ module ActionText
|
|
5
5
|
# It also holds all the references to the embedded files, which are stored using Active Storage.
|
6
6
|
# This record is then associated with the Active Record model the application desires to have
|
7
7
|
# rich text content using the +has_rich_text+ class method.
|
8
|
-
class RichText <
|
8
|
+
class RichText < Record
|
9
9
|
self.table_name = "action_text_rich_texts"
|
10
10
|
|
11
11
|
serialize :body, ActionText::Content
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support/core_ext/object/try"
|
4
|
+
|
3
5
|
module ActionText
|
4
6
|
module Attachments
|
5
7
|
module TrixConversion
|
@@ -26,7 +28,7 @@ module ActionText
|
|
26
28
|
private
|
27
29
|
def trix_attachment_content
|
28
30
|
if partial_path = attachable.try(:to_trix_content_attachment_partial_path)
|
29
|
-
ActionText::Content.render(partial: partial_path, object: self, as: model_name.element)
|
31
|
+
ActionText::Content.render(partial: partial_path, formats: :html, object: self, as: model_name.element)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -13,6 +13,7 @@ module ActionText
|
|
13
13
|
# end
|
14
14
|
#
|
15
15
|
# message = Message.create!(content: "<h1>Funny times!</h1>")
|
16
|
+
# message.content? #=> true
|
16
17
|
# message.content.to_s # => "<h1>Funny times!</h1>"
|
17
18
|
# message.content.to_plain_text # => "Funny times!"
|
18
19
|
#
|
@@ -29,6 +30,10 @@ module ActionText
|
|
29
30
|
rich_text_#{name} || build_rich_text_#{name}
|
30
31
|
end
|
31
32
|
|
33
|
+
def #{name}?
|
34
|
+
rich_text_#{name}.present?
|
35
|
+
end
|
36
|
+
|
32
37
|
def #{name}=(body)
|
33
38
|
self.#{name}.body = body
|
34
39
|
end
|
data/lib/action_text/content.rb
CHANGED
data/lib/action_text/engine.rb
CHANGED
@@ -11,6 +11,10 @@ module ActionText
|
|
11
11
|
class Engine < Rails::Engine
|
12
12
|
isolate_namespace ActionText
|
13
13
|
config.eager_load_namespaces << ActionText
|
14
|
+
config.autoload_once_paths = %W(
|
15
|
+
#{root}/app/helpers
|
16
|
+
#{root}/app/models
|
17
|
+
)
|
14
18
|
|
15
19
|
initializer "action_text.attribute" do
|
16
20
|
ActiveSupport.on_load(:active_record) do
|
@@ -46,7 +50,7 @@ module ActionText
|
|
46
50
|
|
47
51
|
initializer "action_text.renderer" do
|
48
52
|
ActiveSupport.on_load(:action_text_content) do
|
49
|
-
self.
|
53
|
+
self.default_renderer = Class.new(ActionController::Base).renderer
|
50
54
|
end
|
51
55
|
|
52
56
|
%i[action_controller_base action_mailer].each do |abstract_controller|
|
@@ -57,5 +61,12 @@ module ActionText
|
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
64
|
+
|
65
|
+
initializer "action_text.system_test_helper" do
|
66
|
+
ActiveSupport.on_load(:action_dispatch_system_test_case) do
|
67
|
+
require "action_text/system_test_helper"
|
68
|
+
include ActionText::SystemTestHelper
|
69
|
+
end
|
70
|
+
end
|
60
71
|
end
|
61
72
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionText
|
4
|
+
class FixtureSet
|
5
|
+
def self.attachment(fixture_set_name, label, column_type: :integer)
|
6
|
+
signed_global_id = ActiveRecord::FixtureSet.signed_global_id fixture_set_name, label,
|
7
|
+
column_type: column_type, for: ActionText::Attachable::LOCATOR_NAME
|
8
|
+
|
9
|
+
%(<action-text-attachment sgid="#{signed_global_id}"></action-text-attachment>)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -18,9 +18,11 @@ module ActionText
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def plain_text_for_node_children(node)
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
texts = []
|
22
|
+
node.children.each_with_index do |child, index|
|
23
|
+
texts << plain_text_for_node(child, index)
|
24
|
+
end
|
25
|
+
texts.join
|
24
26
|
end
|
25
27
|
|
26
28
|
def plain_text_method_for_node(node)
|
@@ -8,6 +8,7 @@ module ActionText
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
|
+
cattr_accessor :default_renderer, instance_accessor: false
|
11
12
|
thread_cattr_accessor :renderer, instance_accessor: false
|
12
13
|
delegate :render, to: :class
|
13
14
|
end
|
@@ -22,7 +23,7 @@ module ActionText
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def render(*args, &block)
|
25
|
-
renderer.render_to_string(*args, &block)
|
26
|
+
(renderer || default_renderer).render_to_string(*args, &block)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionText
|
4
|
+
module SystemTestHelper
|
5
|
+
# Locates a Trix editor and fills it in with the given HTML.
|
6
|
+
#
|
7
|
+
# 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
|
13
|
+
#
|
14
|
+
# Examples:
|
15
|
+
#
|
16
|
+
# # <trix-editor id="message_content" ...></trix-editor>
|
17
|
+
# fill_in_rich_text_area "message_content", with: "Hello <em>world!</em>"
|
18
|
+
#
|
19
|
+
# # <trix-editor placeholder="Your message here" ...></trix-editor>
|
20
|
+
# fill_in_rich_text_area "Your message here", with: "Hello <em>world!</em>"
|
21
|
+
#
|
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
|
+
#
|
26
|
+
# # <trix-editor aria-label="Message content" ...></trix-editor>
|
27
|
+
# fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
|
28
|
+
#
|
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
|
+
def fill_in_rich_text_area(locator = nil, with:)
|
33
|
+
find(:rich_text_area, locator).execute_script("this.editor.loadHTML(arguments[0])", with.to_s)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Capybara.add_selector :rich_text_area do
|
39
|
+
label "rich-text area"
|
40
|
+
xpath do |locator|
|
41
|
+
if locator.nil?
|
42
|
+
XPath.descendant(:"trix-editor")
|
43
|
+
else
|
44
|
+
input_located_by_name = XPath.anywhere(:input).where(XPath.attr(:name) == locator).attr(:id)
|
45
|
+
input_located_by_label = XPath.anywhere(:label).where(XPath.string.n.is(locator)).attr(:for)
|
46
|
+
|
47
|
+
XPath.descendant(:"trix-editor").where \
|
48
|
+
XPath.attr(:id).equals(locator) |
|
49
|
+
XPath.attr(:placeholder).equals(locator) |
|
50
|
+
XPath.attr(:"aria-label").equals(locator) |
|
51
|
+
XPath.attr(:input).equals(input_located_by_name) |
|
52
|
+
XPath.attr(:id).equals(input_located_by_label)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/action_text.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module ActionText
|
7
|
+
module Generators
|
8
|
+
class InstallGenerator < ::Rails::Generators::Base
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
10
|
+
|
11
|
+
def install_javascript_dependencies
|
12
|
+
rails_command "app:binstub:yarn", inline: true
|
13
|
+
|
14
|
+
say "Installing JavaScript dependencies", :green
|
15
|
+
run "#{Thor::Util.ruby_command} bin/yarn add #{js_dependencies.map { |name, version| "#{name}@#{version}" }.join(" ")}",
|
16
|
+
abort_on_failure: true, capture: true
|
17
|
+
end
|
18
|
+
|
19
|
+
def append_dependencies_to_package_file
|
20
|
+
if (app_javascript_pack_path = Pathname.new("app/javascript/packs/application.js")).exist?
|
21
|
+
js_dependencies.each_key do |dependency|
|
22
|
+
line = %[require("#{dependency}")]
|
23
|
+
|
24
|
+
unless app_javascript_pack_path.read.include? line
|
25
|
+
say "Adding #{dependency} to #{app_javascript_pack_path}", :green
|
26
|
+
append_to_file app_javascript_pack_path, "\n#{line}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
else
|
30
|
+
say <<~WARNING, :red
|
31
|
+
WARNING: Action Text can't locate your JavaScript bundle to add its package dependencies.
|
32
|
+
|
33
|
+
Add these lines to any bundles:
|
34
|
+
|
35
|
+
require("trix")
|
36
|
+
require("@rails/actiontext")
|
37
|
+
|
38
|
+
Alternatively, install and setup the webpacker gem then rerun `bin/rails action_text:install`
|
39
|
+
to have these dependencies added automatically.
|
40
|
+
WARNING
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_actiontext_files
|
45
|
+
template "actiontext.scss", "app/assets/stylesheets/actiontext.scss"
|
46
|
+
|
47
|
+
copy_file "#{GEM_ROOT}/app/views/active_storage/blobs/_blob.html.erb",
|
48
|
+
"app/views/active_storage/blobs/_blob.html.erb"
|
49
|
+
end
|
50
|
+
|
51
|
+
def create_migrations
|
52
|
+
rails_command "railties:install:migrations FROM=active_storage,action_text", inline: true
|
53
|
+
end
|
54
|
+
|
55
|
+
hook_for :test_framework
|
56
|
+
|
57
|
+
private
|
58
|
+
GEM_ROOT = "#{__dir__}/../../../.."
|
59
|
+
|
60
|
+
def js_dependencies
|
61
|
+
js_package = JSON.load(Pathname.new("#{GEM_ROOT}/package.json"))
|
62
|
+
js_package["peerDependencies"].merge \
|
63
|
+
js_package["name"] => "^#{js_package["version"]}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TestUnit
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
def create_test_files
|
9
|
+
template "fixtures.yml", "test/fixtures/action_text/rich_texts.yml"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/tasks/actiontext.rake
CHANGED
@@ -1,20 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
desc "Copy over the migration, stylesheet, and JavaScript files"
|
8
|
-
task install: %w( environment run_installer copy_migrations )
|
9
|
-
|
10
|
-
task :run_installer do
|
11
|
-
installer_template = File.expand_path("../templates/installer.rb", __dir__)
|
12
|
-
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{installer_template}"
|
13
|
-
end
|
14
|
-
|
15
|
-
task :copy_migrations do
|
16
|
-
Rake::Task["active_storage:install:migrations"].invoke
|
17
|
-
Rake::Task["railties:install:migrations"].reenable # Otherwise you can't run 2 migration copy tasks in one invocation
|
18
|
-
Rake::Task["action_text:install:migrations"].invoke
|
19
|
-
end
|
3
|
+
desc "Copy over the migration, stylesheet, and JavaScript files"
|
4
|
+
task "action_text:install" do
|
5
|
+
Rails::Command.invoke :generate, ["action_text:install"]
|
20
6
|
end
|
data/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rails/actiontext",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.1.7-6",
|
4
4
|
"description": "Edit and display rich text in Rails applications",
|
5
5
|
"main": "app/javascript/actiontext/index.js",
|
6
6
|
"files": [
|
7
7
|
"app/javascript/actiontext/*.js"
|
8
8
|
],
|
9
|
-
"homepage": "
|
9
|
+
"homepage": "https://rubyonrails.org/",
|
10
10
|
"repository": {
|
11
11
|
"type": "git",
|
12
12
|
"url": "git+https://github.com/rails/rails.git"
|
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: 6.
|
4
|
+
version: 6.1.7.6
|
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: 2023-
|
13
|
+
date: 2023-08-22 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: 6.
|
21
|
+
version: 6.1.7.6
|
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: 6.
|
28
|
+
version: 6.1.7.6
|
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: 6.
|
35
|
+
version: 6.1.7.6
|
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: 6.
|
42
|
+
version: 6.1.7.6
|
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: 6.
|
49
|
+
version: 6.1.7.6
|
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: 6.
|
56
|
+
version: 6.1.7.6
|
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: 6.
|
63
|
+
version: 6.1.7.6
|
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: 6.
|
70
|
+
version: 6.1.7.6
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: nokogiri
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- app/helpers/action_text/tag_helper.rb
|
99
99
|
- app/javascript/actiontext/attachment_upload.js
|
100
100
|
- app/javascript/actiontext/index.js
|
101
|
+
- app/models/action_text/record.rb
|
101
102
|
- app/models/action_text/rich_text.rb
|
102
103
|
- app/views/action_text/attachables/_missing_attachable.html.erb
|
103
104
|
- app/views/action_text/attachables/_remote_image.html.erb
|
@@ -118,28 +119,31 @@ files:
|
|
118
119
|
- lib/action_text/attribute.rb
|
119
120
|
- lib/action_text/content.rb
|
120
121
|
- lib/action_text/engine.rb
|
122
|
+
- lib/action_text/fixture_set.rb
|
121
123
|
- lib/action_text/fragment.rb
|
122
124
|
- lib/action_text/gem_version.rb
|
123
125
|
- lib/action_text/html_conversion.rb
|
124
126
|
- lib/action_text/plain_text_conversion.rb
|
125
127
|
- lib/action_text/rendering.rb
|
126
128
|
- lib/action_text/serialization.rb
|
129
|
+
- lib/action_text/system_test_helper.rb
|
127
130
|
- lib/action_text/trix_attachment.rb
|
128
131
|
- lib/action_text/version.rb
|
132
|
+
- lib/generators/action_text/install/install_generator.rb
|
133
|
+
- lib/generators/action_text/install/templates/actiontext.scss
|
134
|
+
- lib/rails/generators/test_unit/install_generator.rb
|
135
|
+
- lib/rails/generators/test_unit/templates/fixtures.yml
|
129
136
|
- lib/tasks/actiontext.rake
|
130
|
-
- lib/templates/actiontext.scss
|
131
|
-
- lib/templates/fixtures.yml
|
132
|
-
- lib/templates/installer.rb
|
133
137
|
- package.json
|
134
138
|
homepage: https://rubyonrails.org
|
135
139
|
licenses:
|
136
140
|
- MIT
|
137
141
|
metadata:
|
138
142
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
139
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.
|
140
|
-
documentation_uri: https://api.rubyonrails.org/v6.
|
143
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.7.6/actiontext/CHANGELOG.md
|
144
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.7.6/
|
141
145
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
142
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.
|
146
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.7.6/actiontext
|
143
147
|
rubygems_mfa_required: 'true'
|
144
148
|
post_install_message:
|
145
149
|
rdoc_options: []
|
@@ -156,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
160
|
- !ruby/object:Gem::Version
|
157
161
|
version: '0'
|
158
162
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
163
|
+
rubygems_version: 3.3.3
|
160
164
|
signing_key:
|
161
165
|
specification_version: 4
|
162
166
|
summary: Rich text framework.
|
data/lib/templates/installer.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
require "json"
|
3
|
-
|
4
|
-
APPLICATION_PACK_PATH = Pathname.new("app/javascript/packs/application.js")
|
5
|
-
JS_PACKAGE_PATH = Pathname.new("#{__dir__}/../../package.json")
|
6
|
-
|
7
|
-
JS_PACKAGE = JSON.load(JS_PACKAGE_PATH)
|
8
|
-
JS_DEPENDENCIES = JS_PACKAGE["peerDependencies"].dup.merge \
|
9
|
-
JS_PACKAGE["name"] => "^#{JS_PACKAGE["version"]}"
|
10
|
-
|
11
|
-
say "Copying actiontext.scss to app/assets/stylesheets"
|
12
|
-
copy_file "#{__dir__}/actiontext.scss", "app/assets/stylesheets/actiontext.scss"
|
13
|
-
|
14
|
-
say "Copying fixtures to test/fixtures/action_text/rich_texts.yml"
|
15
|
-
copy_file "#{__dir__}/fixtures.yml", "test/fixtures/action_text/rich_texts.yml"
|
16
|
-
|
17
|
-
say "Copying blob rendering partial to app/views/active_storage/blobs/_blob.html.erb"
|
18
|
-
copy_file "#{__dir__}/../../app/views/active_storage/blobs/_blob.html.erb",
|
19
|
-
"app/views/active_storage/blobs/_blob.html.erb"
|
20
|
-
|
21
|
-
say "Installing JavaScript dependencies"
|
22
|
-
run "yarn add #{JS_DEPENDENCIES.map { |name, version| "#{name}@#{version}" }.join(" ")}"
|
23
|
-
|
24
|
-
if APPLICATION_PACK_PATH.exist?
|
25
|
-
JS_DEPENDENCIES.keys.each do |name|
|
26
|
-
line = %[require("#{name}")]
|
27
|
-
unless APPLICATION_PACK_PATH.read.include? line
|
28
|
-
say "Adding #{name} to #{APPLICATION_PACK_PATH}"
|
29
|
-
append_to_file APPLICATION_PACK_PATH, "\n#{line}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
else
|
33
|
-
warn <<~WARNING
|
34
|
-
WARNING: Action Text can't locate your JavaScript bundle to add its package dependencies.
|
35
|
-
|
36
|
-
Add these lines to any bundles:
|
37
|
-
|
38
|
-
require("trix")
|
39
|
-
require("@rails/actiontext")
|
40
|
-
|
41
|
-
Alternatively, install and setup the webpacker gem then rerun `bin/rails action_text:install`
|
42
|
-
to have these dependencies added automatically.
|
43
|
-
|
44
|
-
WARNING
|
45
|
-
end
|
File without changes
|
File without changes
|