actiontext 7.0.8.2 → 7.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -151
- data/MIT-LICENSE +1 -1
- data/README.md +2 -2
- data/app/assets/javascripts/actiontext.js +781 -766
- data/app/assets/javascripts/trix.js +13077 -19
- data/app/assets/stylesheets/trix.css +410 -21
- data/app/helpers/action_text/content_helper.rb +17 -4
- data/app/helpers/action_text/tag_helper.rb +9 -1
- data/app/models/action_text/encrypted_rich_text.rb +2 -0
- data/app/models/action_text/rich_text.rb +29 -1
- data/app/views/action_text/attachables/_content_attachment.html.erb +3 -0
- data/lib/action_text/attachable.rb +57 -1
- data/lib/action_text/attachables/content_attachment.rb +20 -18
- data/lib/action_text/attachables/missing_attachable.rb +17 -3
- data/lib/action_text/attachment.rb +43 -2
- data/lib/action_text/attribute.rb +10 -5
- data/lib/action_text/content.rb +43 -2
- data/lib/action_text/deprecator.rb +7 -0
- data/lib/action_text/engine.rb +14 -8
- data/lib/action_text/fixture_set.rb +2 -0
- data/lib/action_text/fragment.rb +4 -3
- data/lib/action_text/gem_version.rb +4 -4
- data/lib/action_text/html_conversion.rb +1 -1
- data/lib/action_text/rendering.rb +5 -2
- data/lib/action_text/trix_attachment.rb +2 -2
- data/lib/action_text/version.rb +1 -1
- data/lib/action_text.rb +19 -0
- data/lib/generators/action_text/install/install_generator.rb +20 -3
- data/lib/generators/action_text/install/templates/actiontext.css +0 -4
- data/package.json +5 -4
- metadata +18 -16
@@ -39,10 +39,10 @@ module ActionText
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def typecast_attribute_values(attributes)
|
42
|
-
attributes.
|
42
|
+
attributes.to_h do |key, value|
|
43
43
|
typecast = ATTRIBUTE_TYPES[key] || ATTRIBUTE_TYPES[:default]
|
44
44
|
[key, typecast.call(value)]
|
45
|
-
end
|
45
|
+
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
data/lib/action_text/version.rb
CHANGED
data/lib/action_text.rb
CHANGED
@@ -3,8 +3,13 @@
|
|
3
3
|
require "active_support"
|
4
4
|
require "active_support/rails"
|
5
5
|
|
6
|
+
require "action_text/version"
|
7
|
+
require "action_text/deprecator"
|
8
|
+
|
6
9
|
require "nokogiri"
|
7
10
|
|
11
|
+
# :markup: markdown
|
12
|
+
# :include: actiontext/README.md
|
8
13
|
module ActionText
|
9
14
|
extend ActiveSupport::Autoload
|
10
15
|
|
@@ -37,4 +42,18 @@ module ActionText
|
|
37
42
|
autoload :Minification
|
38
43
|
autoload :TrixConversion
|
39
44
|
end
|
45
|
+
|
46
|
+
class << self
|
47
|
+
def html_document_class
|
48
|
+
return @html_document_class if defined?(@html_document_class)
|
49
|
+
@html_document_class =
|
50
|
+
defined?(Nokogiri::HTML5) ? Nokogiri::HTML5::Document : Nokogiri::HTML4::Document
|
51
|
+
end
|
52
|
+
|
53
|
+
def html_document_fragment_class
|
54
|
+
return @html_document_fragment_class if defined?(@html_document_fragment_class)
|
55
|
+
@html_document_fragment_class =
|
56
|
+
defined?(Nokogiri::HTML5) ? Nokogiri::HTML5::DocumentFragment : Nokogiri::HTML4::DocumentFragment
|
57
|
+
end
|
58
|
+
end
|
40
59
|
end
|
@@ -9,8 +9,10 @@ module ActionText
|
|
9
9
|
source_root File.expand_path("templates", __dir__)
|
10
10
|
|
11
11
|
def install_javascript_dependencies
|
12
|
-
|
13
|
-
|
12
|
+
say "Installing JavaScript dependencies", :green
|
13
|
+
if using_bun?
|
14
|
+
run "bun add @rails/actiontext trix"
|
15
|
+
elsif using_node?
|
14
16
|
run "yarn add @rails/actiontext trix"
|
15
17
|
end
|
16
18
|
end
|
@@ -19,7 +21,7 @@ module ActionText
|
|
19
21
|
destination = Pathname(destination_root)
|
20
22
|
|
21
23
|
if (application_javascript_path = destination.join("app/javascript/application.js")).exist?
|
22
|
-
insert_into_file application_javascript_path.to_s, %(
|
24
|
+
insert_into_file application_javascript_path.to_s, %(\nimport "trix"\nimport "@rails/actiontext"\n)
|
23
25
|
else
|
24
26
|
say <<~INSTRUCTIONS, :green
|
25
27
|
You must import the @rails/actiontext and trix JavaScript modules in your application entrypoint.
|
@@ -66,6 +68,21 @@ module ActionText
|
|
66
68
|
rails_command "railties:install:migrations FROM=active_storage,action_text", inline: true
|
67
69
|
end
|
68
70
|
|
71
|
+
def using_js_runtime?
|
72
|
+
@using_js_runtime ||= Pathname(destination_root).join("package.json").exist?
|
73
|
+
end
|
74
|
+
|
75
|
+
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
|
78
|
+
@using_bun ||= using_js_runtime? && Pathname(destination_root).join("bun.config.js").exist?
|
79
|
+
end
|
80
|
+
|
81
|
+
def using_node?
|
82
|
+
# Bun is the only runtime that _isn't_ node.
|
83
|
+
@using_node ||= using_js_runtime? && !Pathname(destination_root).join("bun.config.js").exist?
|
84
|
+
end
|
85
|
+
|
69
86
|
hook_for :test_framework
|
70
87
|
end
|
71
88
|
end
|
@@ -3,11 +3,7 @@
|
|
3
3
|
* the trix-editor content (whether displayed or under editing). Feel free to incorporate this
|
4
4
|
* inclusion directly in any other asset bundle and remove this file.
|
5
5
|
*
|
6
|
-
<%- if defined?(Webpacker::Engine) -%>
|
7
|
-
*= require trix/dist/trix
|
8
|
-
<%- else -%>
|
9
6
|
*= require trix
|
10
|
-
<% end -%>
|
11
7
|
*/
|
12
8
|
|
13
9
|
/*
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rails/actiontext",
|
3
|
-
"version": "7.0
|
3
|
+
"version": "7.1.0-beta1",
|
4
4
|
"description": "Edit and display rich text in Rails applications",
|
5
5
|
"main": "app/assets/javascripts/actiontext.js",
|
6
6
|
"type": "module",
|
@@ -15,21 +15,22 @@
|
|
15
15
|
"bugs": {
|
16
16
|
"url": "https://github.com/rails/rails/issues"
|
17
17
|
},
|
18
|
-
"author": "
|
18
|
+
"author": "37signals LLC",
|
19
19
|
"contributors": [
|
20
20
|
"Javan Makhmali <javan@javan.us>",
|
21
21
|
"Sam Stephenson <sstephenson@gmail.com>"
|
22
22
|
],
|
23
23
|
"license": "MIT",
|
24
24
|
"dependencies": {
|
25
|
-
"@rails/activestorage": ">= 7.
|
25
|
+
"@rails/activestorage": ">= 7.1.0-alpha",
|
26
|
+
"webpack": "^4.17.1"
|
26
27
|
},
|
27
28
|
"peerDependencies": {
|
28
29
|
"trix": "^2.0.0"
|
29
30
|
},
|
30
31
|
"devDependencies": {
|
31
|
-
"@rollup/plugin-node-resolve": "^11.0.1",
|
32
32
|
"@rollup/plugin-commonjs": "^19.0.1",
|
33
|
+
"@rollup/plugin-node-resolve": "^11.0.1",
|
33
34
|
"rollup": "^2.35.1",
|
34
35
|
"trix": "^2.0.0"
|
35
36
|
},
|
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.0.
|
4
|
+
version: 7.1.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:
|
13
|
+
date: 2023-09-13 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.0.
|
21
|
+
version: 7.1.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.0.
|
28
|
+
version: 7.1.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.0.
|
35
|
+
version: 7.1.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.0.
|
42
|
+
version: 7.1.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.0.
|
49
|
+
version: 7.1.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.0.
|
56
|
+
version: 7.1.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.0.
|
63
|
+
version: 7.1.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.0.
|
70
|
+
version: 7.1.0.beta1
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: nokogiri
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- app/models/action_text/encrypted_rich_text.rb
|
119
119
|
- app/models/action_text/record.rb
|
120
120
|
- app/models/action_text/rich_text.rb
|
121
|
+
- app/views/action_text/attachables/_content_attachment.html.erb
|
121
122
|
- app/views/action_text/attachables/_missing_attachable.html.erb
|
122
123
|
- app/views/action_text/attachables/_remote_image.html.erb
|
123
124
|
- app/views/action_text/attachment_galleries/_attachment_gallery.html.erb
|
@@ -137,6 +138,7 @@ files:
|
|
137
138
|
- lib/action_text/attachments/trix_conversion.rb
|
138
139
|
- lib/action_text/attribute.rb
|
139
140
|
- lib/action_text/content.rb
|
141
|
+
- lib/action_text/deprecator.rb
|
140
142
|
- lib/action_text/encryption.rb
|
141
143
|
- lib/action_text/engine.rb
|
142
144
|
- lib/action_text/fixture_set.rb
|
@@ -160,10 +162,10 @@ licenses:
|
|
160
162
|
- MIT
|
161
163
|
metadata:
|
162
164
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
163
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.0.
|
164
|
-
documentation_uri: https://api.rubyonrails.org/v7.0.
|
165
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.0.beta1/actiontext/CHANGELOG.md
|
166
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.0.beta1/
|
165
167
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
166
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.0.
|
168
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.0.beta1/actiontext
|
167
169
|
rubygems_mfa_required: 'true'
|
168
170
|
post_install_message:
|
169
171
|
rdoc_options: []
|
@@ -176,11 +178,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
176
178
|
version: 2.7.0
|
177
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
180
|
requirements:
|
179
|
-
- - "
|
181
|
+
- - ">"
|
180
182
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
183
|
+
version: 1.3.1
|
182
184
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.4.18
|
184
186
|
signing_key:
|
185
187
|
specification_version: 4
|
186
188
|
summary: Rich text framework.
|