actiontext 8.0.2 → 8.1.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -69
- data/app/assets/javascripts/actiontext.esm.js +76 -2
- data/app/assets/javascripts/actiontext.js +76 -2
- data/app/javascript/actiontext/attachment_upload.js +50 -1
- data/app/models/action_text/rich_text.rb +5 -2
- data/lib/action_text/content.rb +4 -3
- data/lib/action_text/engine.rb +2 -1
- data/lib/action_text/fixture_set.rb +1 -1
- data/lib/action_text/gem_version.rb +3 -3
- data/lib/action_text/plain_text_conversion.rb +6 -0
- data/lib/action_text/rendering.rb +0 -1
- data/lib/action_text/system_test_helper.rb +4 -2
- data/package.json +3 -2
- metadata +28 -16
- data/app/assets/javascripts/trix.js +0 -13743
- data/app/assets/stylesheets/trix.css +0 -470
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56212aa1ae96d6d13c6ed5e92259b100dcfdf2b8547f224458e7c4dcd763ad49
|
4
|
+
data.tar.gz: 8da839fef7a4ecf0889705929429ab2fc40b89527e5e9a97a7803c8c32806f3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec1b6d10b4b38e06e0cc36e99ea293b12344233f1d5291eeb0655f1f828726b46ca0d4e4c0cf5dfb27f3f4ba88752d32d197c614ba561b29bdda944174ad93ec
|
7
|
+
data.tar.gz: fdae5de429bea12f1054e08f7c524cd89b1397b03d73d57485f9ec7a1a839bb278b85392b1c6b1961ad23cf08eaa2e1934fd60eea2e473c178cbb896341c0ac9
|
data/CHANGELOG.md
CHANGED
@@ -1,81 +1,25 @@
|
|
1
|
-
## Rails 8.0.
|
1
|
+
## Rails 8.1.0.beta1 (September 04, 2025) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
## Rails 8.0.2 (March 12, 2025) ##
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 8.0.1 (December 13, 2024) ##
|
12
|
-
|
13
|
-
* No changes.
|
14
|
-
|
15
|
-
|
16
|
-
## Rails 8.0.0.1 (December 10, 2024) ##
|
17
|
-
|
18
|
-
* Update vendored trix version to 2.1.10
|
19
|
-
|
20
|
-
*John Hawthorn*
|
21
|
-
|
22
|
-
|
23
|
-
## Rails 8.0.0 (November 07, 2024) ##
|
24
|
-
|
25
|
-
* No changes.
|
26
|
-
|
27
|
-
|
28
|
-
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
29
|
-
|
30
|
-
* No changes.
|
31
|
-
|
32
|
-
|
33
|
-
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
34
|
-
|
35
|
-
* No changes.
|
36
|
-
|
37
|
-
|
38
|
-
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
39
|
-
|
40
|
-
* Dispatch direct-upload events on attachment uploads
|
41
|
-
|
42
|
-
When using Action Text's rich textarea, it's possible to attach files to the
|
43
|
-
editor. Previously, that action didn't dispatch any events, which made it hard
|
44
|
-
to react to the file uploads. For instance, if an upload failed, there was no
|
45
|
-
way to notify the user about it, or remove the attachment from the editor.
|
46
|
-
|
47
|
-
This commits adds new events - `direct-upload:start`, `direct-upload:progress`,
|
48
|
-
and `direct-upload:end` - similar to how Active Storage's direct uploads work.
|
49
|
-
|
50
|
-
*Matheus Richard*, *Brad Rees*
|
51
|
-
|
52
|
-
* Add `store_if_blank` option to `has_rich_text`
|
53
|
-
|
54
|
-
Pass `store_if_blank: false` to not create `ActionText::RichText` records when saving with a blank attribute, such as from an optional form parameter.
|
3
|
+
* Forward `fill_in_rich_text_area` options to Capybara
|
55
4
|
|
56
5
|
```ruby
|
57
|
-
|
58
|
-
has_rich_text :content, store_if_blank: false
|
59
|
-
end
|
60
|
-
|
61
|
-
Message.create(content: "hi") # creates an ActionText::RichText
|
62
|
-
Message.create(content: "") # does not create an ActionText::RichText
|
6
|
+
fill_in_rich_textarea "Rich text editor", id: "trix_editor_1", with: "Hello world!"
|
63
7
|
```
|
64
8
|
|
65
|
-
*
|
66
|
-
|
67
|
-
* Strip `content` attribute if the key is present but the value is empty
|
9
|
+
*Sean Doyle*
|
68
10
|
|
69
|
-
|
11
|
+
* Attachment upload progress accounts for server processing time.
|
70
12
|
|
71
|
-
*
|
13
|
+
*Jeremy Daer*
|
72
14
|
|
73
|
-
|
15
|
+
* The Trix dependency is now satisfied by a gem, `action_text-trix`, rather than vendored
|
16
|
+
files. This allows applications to bump Trix versions independently of Rails
|
17
|
+
releases. Effectively this also upgrades Trix to `>= 2.1.15`.
|
74
18
|
|
75
|
-
*
|
19
|
+
*Mike Dalessio*
|
76
20
|
|
77
|
-
*
|
21
|
+
* Change `ActionText::RichText#embeds` assignment from `before_save` to `before_validation`
|
78
22
|
|
79
|
-
*
|
23
|
+
*Sean Doyle*
|
80
24
|
|
81
|
-
Please check [
|
25
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actiontext/CHANGELOG.md) for previous changes.
|
@@ -672,7 +672,7 @@ class DirectUploadController {
|
|
672
672
|
}));
|
673
673
|
}
|
674
674
|
uploadRequestDidProgress(event) {
|
675
|
-
const progress = event.loaded / event.total *
|
675
|
+
const progress = event.loaded / event.total * 90;
|
676
676
|
if (progress) {
|
677
677
|
this.dispatch("progress", {
|
678
678
|
progress: progress
|
@@ -707,6 +707,42 @@ class DirectUploadController {
|
|
707
707
|
xhr: xhr
|
708
708
|
});
|
709
709
|
xhr.upload.addEventListener("progress", (event => this.uploadRequestDidProgress(event)));
|
710
|
+
xhr.upload.addEventListener("loadend", (() => {
|
711
|
+
this.simulateResponseProgress(xhr);
|
712
|
+
}));
|
713
|
+
}
|
714
|
+
simulateResponseProgress(xhr) {
|
715
|
+
let progress = 90;
|
716
|
+
const startTime = Date.now();
|
717
|
+
const updateProgress = () => {
|
718
|
+
const elapsed = Date.now() - startTime;
|
719
|
+
const estimatedResponseTime = this.estimateResponseTime();
|
720
|
+
const responseProgress = Math.min(elapsed / estimatedResponseTime, 1);
|
721
|
+
progress = 90 + responseProgress * 9;
|
722
|
+
this.dispatch("progress", {
|
723
|
+
progress: progress
|
724
|
+
});
|
725
|
+
if (xhr.readyState !== XMLHttpRequest.DONE && progress < 99) {
|
726
|
+
requestAnimationFrame(updateProgress);
|
727
|
+
}
|
728
|
+
};
|
729
|
+
xhr.addEventListener("loadend", (() => {
|
730
|
+
this.dispatch("progress", {
|
731
|
+
progress: 100
|
732
|
+
});
|
733
|
+
}));
|
734
|
+
requestAnimationFrame(updateProgress);
|
735
|
+
}
|
736
|
+
estimateResponseTime() {
|
737
|
+
const fileSize = this.file.size;
|
738
|
+
const MB = 1024 * 1024;
|
739
|
+
if (fileSize < MB) {
|
740
|
+
return 1e3;
|
741
|
+
} else if (fileSize < 10 * MB) {
|
742
|
+
return 2e3;
|
743
|
+
} else {
|
744
|
+
return 3e3 + fileSize / MB * 50;
|
745
|
+
}
|
710
746
|
}
|
711
747
|
}
|
712
748
|
|
@@ -857,7 +893,7 @@ class AttachmentUpload {
|
|
857
893
|
}
|
858
894
|
directUploadWillStoreFileWithXHR(xhr) {
|
859
895
|
xhr.upload.addEventListener("progress", (event => {
|
860
|
-
const progress = event.loaded / event.total *
|
896
|
+
const progress = event.loaded / event.total * 90;
|
861
897
|
this.attachment.setUploadProgress(progress);
|
862
898
|
if (progress) {
|
863
899
|
this.dispatch("progress", {
|
@@ -865,6 +901,44 @@ class AttachmentUpload {
|
|
865
901
|
});
|
866
902
|
}
|
867
903
|
}));
|
904
|
+
xhr.upload.addEventListener("loadend", (() => {
|
905
|
+
this.simulateResponseProgress(xhr);
|
906
|
+
}));
|
907
|
+
}
|
908
|
+
simulateResponseProgress(xhr) {
|
909
|
+
let progress = 90;
|
910
|
+
const startTime = Date.now();
|
911
|
+
const updateProgress = () => {
|
912
|
+
const elapsed = Date.now() - startTime;
|
913
|
+
const estimatedResponseTime = this.estimateResponseTime();
|
914
|
+
const responseProgress = Math.min(elapsed / estimatedResponseTime, 1);
|
915
|
+
progress = 90 + responseProgress * 9;
|
916
|
+
this.attachment.setUploadProgress(progress);
|
917
|
+
this.dispatch("progress", {
|
918
|
+
progress: progress
|
919
|
+
});
|
920
|
+
if (xhr.readyState !== XMLHttpRequest.DONE && progress < 99) {
|
921
|
+
requestAnimationFrame(updateProgress);
|
922
|
+
}
|
923
|
+
};
|
924
|
+
xhr.addEventListener("loadend", (() => {
|
925
|
+
this.attachment.setUploadProgress(100);
|
926
|
+
this.dispatch("progress", {
|
927
|
+
progress: 100
|
928
|
+
});
|
929
|
+
}));
|
930
|
+
requestAnimationFrame(updateProgress);
|
931
|
+
}
|
932
|
+
estimateResponseTime() {
|
933
|
+
const fileSize = this.attachment.file.size;
|
934
|
+
const MB = 1024 * 1024;
|
935
|
+
if (fileSize < MB) {
|
936
|
+
return 1e3;
|
937
|
+
} else if (fileSize < 10 * MB) {
|
938
|
+
return 2e3;
|
939
|
+
} else {
|
940
|
+
return 3e3 + fileSize / MB * 50;
|
941
|
+
}
|
868
942
|
}
|
869
943
|
directUploadDidComplete(error, attributes) {
|
870
944
|
if (error) {
|
@@ -661,7 +661,7 @@
|
|
661
661
|
}));
|
662
662
|
}
|
663
663
|
uploadRequestDidProgress(event) {
|
664
|
-
const progress = event.loaded / event.total *
|
664
|
+
const progress = event.loaded / event.total * 90;
|
665
665
|
if (progress) {
|
666
666
|
this.dispatch("progress", {
|
667
667
|
progress: progress
|
@@ -696,6 +696,42 @@
|
|
696
696
|
xhr: xhr
|
697
697
|
});
|
698
698
|
xhr.upload.addEventListener("progress", (event => this.uploadRequestDidProgress(event)));
|
699
|
+
xhr.upload.addEventListener("loadend", (() => {
|
700
|
+
this.simulateResponseProgress(xhr);
|
701
|
+
}));
|
702
|
+
}
|
703
|
+
simulateResponseProgress(xhr) {
|
704
|
+
let progress = 90;
|
705
|
+
const startTime = Date.now();
|
706
|
+
const updateProgress = () => {
|
707
|
+
const elapsed = Date.now() - startTime;
|
708
|
+
const estimatedResponseTime = this.estimateResponseTime();
|
709
|
+
const responseProgress = Math.min(elapsed / estimatedResponseTime, 1);
|
710
|
+
progress = 90 + responseProgress * 9;
|
711
|
+
this.dispatch("progress", {
|
712
|
+
progress: progress
|
713
|
+
});
|
714
|
+
if (xhr.readyState !== XMLHttpRequest.DONE && progress < 99) {
|
715
|
+
requestAnimationFrame(updateProgress);
|
716
|
+
}
|
717
|
+
};
|
718
|
+
xhr.addEventListener("loadend", (() => {
|
719
|
+
this.dispatch("progress", {
|
720
|
+
progress: 100
|
721
|
+
});
|
722
|
+
}));
|
723
|
+
requestAnimationFrame(updateProgress);
|
724
|
+
}
|
725
|
+
estimateResponseTime() {
|
726
|
+
const fileSize = this.file.size;
|
727
|
+
const MB = 1024 * 1024;
|
728
|
+
if (fileSize < MB) {
|
729
|
+
return 1e3;
|
730
|
+
} else if (fileSize < 10 * MB) {
|
731
|
+
return 2e3;
|
732
|
+
} else {
|
733
|
+
return 3e3 + fileSize / MB * 50;
|
734
|
+
}
|
699
735
|
}
|
700
736
|
}
|
701
737
|
const inputSelector = "input[type=file][data-direct-upload-url]:not([disabled])";
|
@@ -830,7 +866,7 @@
|
|
830
866
|
}
|
831
867
|
directUploadWillStoreFileWithXHR(xhr) {
|
832
868
|
xhr.upload.addEventListener("progress", (event => {
|
833
|
-
const progress = event.loaded / event.total *
|
869
|
+
const progress = event.loaded / event.total * 90;
|
834
870
|
this.attachment.setUploadProgress(progress);
|
835
871
|
if (progress) {
|
836
872
|
this.dispatch("progress", {
|
@@ -838,6 +874,44 @@
|
|
838
874
|
});
|
839
875
|
}
|
840
876
|
}));
|
877
|
+
xhr.upload.addEventListener("loadend", (() => {
|
878
|
+
this.simulateResponseProgress(xhr);
|
879
|
+
}));
|
880
|
+
}
|
881
|
+
simulateResponseProgress(xhr) {
|
882
|
+
let progress = 90;
|
883
|
+
const startTime = Date.now();
|
884
|
+
const updateProgress = () => {
|
885
|
+
const elapsed = Date.now() - startTime;
|
886
|
+
const estimatedResponseTime = this.estimateResponseTime();
|
887
|
+
const responseProgress = Math.min(elapsed / estimatedResponseTime, 1);
|
888
|
+
progress = 90 + responseProgress * 9;
|
889
|
+
this.attachment.setUploadProgress(progress);
|
890
|
+
this.dispatch("progress", {
|
891
|
+
progress: progress
|
892
|
+
});
|
893
|
+
if (xhr.readyState !== XMLHttpRequest.DONE && progress < 99) {
|
894
|
+
requestAnimationFrame(updateProgress);
|
895
|
+
}
|
896
|
+
};
|
897
|
+
xhr.addEventListener("loadend", (() => {
|
898
|
+
this.attachment.setUploadProgress(100);
|
899
|
+
this.dispatch("progress", {
|
900
|
+
progress: 100
|
901
|
+
});
|
902
|
+
}));
|
903
|
+
requestAnimationFrame(updateProgress);
|
904
|
+
}
|
905
|
+
estimateResponseTime() {
|
906
|
+
const fileSize = this.attachment.file.size;
|
907
|
+
const MB = 1024 * 1024;
|
908
|
+
if (fileSize < MB) {
|
909
|
+
return 1e3;
|
910
|
+
} else if (fileSize < 10 * MB) {
|
911
|
+
return 2e3;
|
912
|
+
} else {
|
913
|
+
return 3e3 + fileSize / MB * 50;
|
914
|
+
}
|
841
915
|
}
|
842
916
|
directUploadDidComplete(error, attributes) {
|
843
917
|
if (error) {
|
@@ -14,12 +14,61 @@ export class AttachmentUpload {
|
|
14
14
|
|
15
15
|
directUploadWillStoreFileWithXHR(xhr) {
|
16
16
|
xhr.upload.addEventListener("progress", event => {
|
17
|
-
|
17
|
+
// Scale upload progress to 0-90% range
|
18
|
+
const progress = (event.loaded / event.total) * 90
|
18
19
|
this.attachment.setUploadProgress(progress)
|
19
20
|
if (progress) {
|
20
21
|
this.dispatch("progress", { progress: progress })
|
21
22
|
}
|
22
23
|
})
|
24
|
+
|
25
|
+
// Start simulating progress after upload completes
|
26
|
+
xhr.upload.addEventListener("loadend", () => {
|
27
|
+
this.simulateResponseProgress(xhr)
|
28
|
+
})
|
29
|
+
}
|
30
|
+
|
31
|
+
simulateResponseProgress(xhr) {
|
32
|
+
let progress = 90
|
33
|
+
const startTime = Date.now()
|
34
|
+
|
35
|
+
const updateProgress = () => {
|
36
|
+
// Simulate progress from 90% to 99% over estimated time
|
37
|
+
const elapsed = Date.now() - startTime
|
38
|
+
const estimatedResponseTime = this.estimateResponseTime()
|
39
|
+
const responseProgress = Math.min(elapsed / estimatedResponseTime, 1)
|
40
|
+
progress = 90 + (responseProgress * 9) // 90% to 99%
|
41
|
+
|
42
|
+
this.attachment.setUploadProgress(progress)
|
43
|
+
this.dispatch("progress", { progress })
|
44
|
+
|
45
|
+
// Continue until response arrives or we hit 99%
|
46
|
+
if (xhr.readyState !== XMLHttpRequest.DONE && progress < 99) {
|
47
|
+
requestAnimationFrame(updateProgress)
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
// Stop simulation when response arrives
|
52
|
+
xhr.addEventListener("loadend", () => {
|
53
|
+
this.attachment.setUploadProgress(100)
|
54
|
+
this.dispatch("progress", { progress: 100 })
|
55
|
+
})
|
56
|
+
|
57
|
+
requestAnimationFrame(updateProgress)
|
58
|
+
}
|
59
|
+
|
60
|
+
estimateResponseTime() {
|
61
|
+
// Base estimate: 1 second for small files, scaling up for larger files
|
62
|
+
const fileSize = this.attachment.file.size
|
63
|
+
const MB = 1024 * 1024
|
64
|
+
|
65
|
+
if (fileSize < MB) {
|
66
|
+
return 1000 // 1 second for files under 1MB
|
67
|
+
} else if (fileSize < 10 * MB) {
|
68
|
+
return 2000 // 2 seconds for files 1-10MB
|
69
|
+
} else {
|
70
|
+
return 3000 + (fileSize / MB * 50) // 3+ seconds for larger files
|
71
|
+
}
|
23
72
|
}
|
24
73
|
|
25
74
|
directUploadDidComplete(error, attributes) {
|
@@ -48,10 +48,13 @@ module ActionText
|
|
48
48
|
##
|
49
49
|
# :method: embeds
|
50
50
|
#
|
51
|
-
# Returns the
|
51
|
+
# Returns the ActiveStorage::Attachment records from the embedded files.
|
52
|
+
#
|
53
|
+
# Attached ActiveStorage::Blob records are extracted from the `body`
|
54
|
+
# in a {before_validation}[rdoc-ref:ActiveModel::Validations::Callbacks::ClassMethods#before_validation] callback.
|
52
55
|
has_many_attached :embeds
|
53
56
|
|
54
|
-
|
57
|
+
before_validation do
|
55
58
|
self.embeds = body.attachables.grep(ActiveStorage::Blob).uniq if body.present?
|
56
59
|
end
|
57
60
|
|
data/lib/action_text/content.rb
CHANGED
@@ -56,7 +56,7 @@ module ActionText
|
|
56
56
|
@links ||= fragment.find_all("a[href]").map { |a| a["href"] }.uniq
|
57
57
|
end
|
58
58
|
|
59
|
-
# Extracts
|
59
|
+
# Extracts ActionText::Attachment objects from the HTML fragment:
|
60
60
|
#
|
61
61
|
# attachable = ActiveStorage::Blob.first
|
62
62
|
# html = %Q(<action-text-attachment sgid="#{attachable.attachable_sgid}" caption="Captioned"></action-text-attachment>)
|
@@ -78,7 +78,7 @@ module ActionText
|
|
78
78
|
@gallery_attachments ||= attachment_galleries.flat_map(&:attachments)
|
79
79
|
end
|
80
80
|
|
81
|
-
# Extracts
|
81
|
+
# Extracts ActionText::Attachable objects from the HTML fragment:
|
82
82
|
#
|
83
83
|
# attachable = ActiveStorage::Blob.first
|
84
84
|
# html = %Q(<action-text-attachment sgid="#{attachable.attachable_sgid}" caption="Captioned"></action-text-attachment>)
|
@@ -123,10 +123,11 @@ module ActionText
|
|
123
123
|
# content.to_plain_text # => "safeunsafe"
|
124
124
|
#
|
125
125
|
# NOTE: that the returned string is not HTML safe and should not be rendered in
|
126
|
-
# browsers.
|
126
|
+
# browsers without additional sanitization.
|
127
127
|
#
|
128
128
|
# content = ActionText::Content.new("<script>alert()</script>")
|
129
129
|
# content.to_plain_text # => "<script>alert()</script>"
|
130
|
+
# ActionText::ContentHelper.sanitizer.sanitize(content.to_plain_text) # => ""
|
130
131
|
def to_plain_text
|
131
132
|
render_attachments(with_full_attributes: false, &:to_plain_text).fragment.to_plain_text
|
132
133
|
end
|
data/lib/action_text/engine.rb
CHANGED
@@ -8,6 +8,7 @@ require "active_record/railtie"
|
|
8
8
|
require "active_storage/engine"
|
9
9
|
|
10
10
|
require "action_text"
|
11
|
+
require "action_text/trix"
|
11
12
|
|
12
13
|
module ActionText
|
13
14
|
class Engine < Rails::Engine
|
@@ -34,7 +35,7 @@ module ActionText
|
|
34
35
|
|
35
36
|
initializer "action_text.asset" do
|
36
37
|
if Rails.application.config.respond_to?(:assets)
|
37
|
-
Rails.application.config.assets.precompile += %w( actiontext.js actiontext.esm.js
|
38
|
+
Rails.application.config.assets.precompile += %w( actiontext.js actiontext.esm.js )
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
@@ -62,7 +62,7 @@ module ActionText
|
|
62
62
|
signed_global_id = ActiveRecord::FixtureSet.signed_global_id fixture_set_name, label,
|
63
63
|
column_type: column_type, for: ActionText::Attachable::LOCATOR_NAME
|
64
64
|
|
65
|
-
%(
|
65
|
+
%(<#{Attachment.tag_name} sgid="#{signed_global_id}"></#{Attachment.tag_name}>)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -22,11 +22,17 @@ module ActionText
|
|
22
22
|
def plain_text_for_node_children(node)
|
23
23
|
texts = []
|
24
24
|
node.children.each_with_index do |child, index|
|
25
|
+
next if skippable?(child)
|
26
|
+
|
25
27
|
texts << plain_text_for_node(child, index)
|
26
28
|
end
|
27
29
|
texts.join
|
28
30
|
end
|
29
31
|
|
32
|
+
def skippable?(node)
|
33
|
+
node.name == "script" || node.name == "style"
|
34
|
+
end
|
35
|
+
|
30
36
|
def plain_text_method_for_node(node)
|
31
37
|
:"plain_text_for_#{node.name}_node"
|
32
38
|
end
|
@@ -7,12 +7,14 @@ module ActionText
|
|
7
7
|
# Locates a Trix editor and fills it in with the given HTML.
|
8
8
|
#
|
9
9
|
# The editor can be found by:
|
10
|
+
#
|
10
11
|
# * its `id`
|
11
12
|
# * its `placeholder`
|
12
13
|
# * the text from its `label` element
|
13
14
|
# * its `aria-label`
|
14
15
|
# * the `name` of its input
|
15
16
|
#
|
17
|
+
# Additional options are forwarded to Capybara as filters
|
16
18
|
#
|
17
19
|
# Examples:
|
18
20
|
#
|
@@ -32,8 +34,8 @@ module ActionText
|
|
32
34
|
# # <input id="trix_input_1" name="message[content]" type="hidden">
|
33
35
|
# # <trix-editor input="trix_input_1"></trix-editor>
|
34
36
|
# fill_in_rich_textarea "message[content]", with: "Hello <em>world!</em>"
|
35
|
-
def fill_in_rich_textarea(locator = nil, with
|
36
|
-
find(:rich_textarea, locator).execute_script("this.editor.loadHTML(arguments[0])", with.to_s)
|
37
|
+
def fill_in_rich_textarea(locator = nil, with:, **)
|
38
|
+
find(:rich_textarea, locator, **).execute_script("this.editor.loadHTML(arguments[0])", with.to_s)
|
37
39
|
end
|
38
40
|
alias_method :fill_in_rich_text_area, :fill_in_rich_textarea
|
39
41
|
end
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rails/actiontext",
|
3
|
-
"version": "8.0
|
3
|
+
"version": "8.1.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",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
],
|
23
23
|
"license": "MIT",
|
24
24
|
"dependencies": {
|
25
|
-
"@rails/activestorage": ">= 8.
|
25
|
+
"@rails/activestorage": ">= 8.1.0-alpha"
|
26
26
|
},
|
27
27
|
"peerDependencies": {
|
28
28
|
"trix": "^2.0.0"
|
@@ -31,6 +31,7 @@
|
|
31
31
|
"@rollup/plugin-commonjs": "^19.0.1",
|
32
32
|
"@rollup/plugin-node-resolve": "^11.0.1",
|
33
33
|
"rollup": "^2.35.1",
|
34
|
+
"rollup-plugin-terser": "^7.0.2",
|
34
35
|
"trix": "^2.0.0"
|
35
36
|
},
|
36
37
|
"scripts": {
|