actiontext 7.2.1.1 → 8.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -44
- data/app/assets/javascripts/actiontext.esm.js +27 -5
- data/app/assets/javascripts/actiontext.js +27 -5
- data/app/assets/javascripts/trix.js +377 -174
- data/app/helpers/action_text/tag_helper.rb +13 -10
- data/app/javascript/actiontext/attachment_upload.js +24 -7
- data/lib/action_text/attribute.rb +25 -5
- data/lib/action_text/gem_version.rb +4 -4
- data/lib/action_text/plain_text_conversion.rb +1 -6
- data/lib/action_text/system_test_helper.rb +24 -21
- data/lib/generators/action_text/install/install_generator.rb +0 -12
- data/lib/generators/action_text/install/templates/actiontext.css +414 -5
- data/package.json +2 -2
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b8e0bf08fc3ee2fc3232ae60d94ba99fd2a74bf10256a882b2aa22949a74b1f
|
4
|
+
data.tar.gz: 8408cf6c03443c952ea086c12efc4126d059c746ce95921e2c203af9a129aa33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 275f4aa614386fdb27f5addeeb62f2c200599434214364d5179e73c97dc23a97858a48a5031050e81da40dbb705c56575ecdcf8d2b88a5879bdaedcf5f85434d
|
7
|
+
data.tar.gz: b23c2dec4fa69d970efc554a08c962745f051c7a645a4273c28ee38e476b2565f9815d5871b7fb058d6dc47c2ca3e258acdd7ae86896bce4678692341f7641fe
|
data/CHANGELOG.md
CHANGED
@@ -1,66 +1,49 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* No changes.
|
4
4
|
|
5
|
-
[CVE-2024-47888]
|
6
5
|
|
7
|
-
## Rails
|
6
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
8
7
|
|
9
|
-
*
|
10
|
-
|
11
|
-
*Jeremy Green*
|
12
|
-
|
13
|
-
|
14
|
-
## Rails 7.2.0 (August 09, 2024) ##
|
15
|
-
* Only sanitize `content` attribute when present in attachments.
|
8
|
+
* Dispatch direct-upload events on attachment uploads
|
16
9
|
|
17
|
-
|
10
|
+
When using Action Text's rich textarea, it's possible to attach files to the
|
11
|
+
editor. Previously, that action didn't dispatch any events, which made it hard
|
12
|
+
to react to the file uploads. For instance, if an upload failed, there was no
|
13
|
+
way to notify the user about it, or remove the attachment from the editor.
|
18
14
|
|
19
|
-
|
20
|
-
|
15
|
+
This commits adds new events - `direct-upload:start`, `direct-upload:progress`,
|
16
|
+
and `direct-upload:end` - similar to how Active Storage's direct uploads work.
|
21
17
|
|
22
|
-
*
|
18
|
+
*Matheus Richard*, *Brad Rees*
|
23
19
|
|
24
|
-
*
|
20
|
+
* Add `store_if_blank` option to `has_rich_text`
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
* Delegate `ActionText::Content#deconstruct` to `Nokogiri::XML::DocumentFragment#elements`.
|
22
|
+
Pass `store_if_blank: false` to not create `ActionText::RichText` records when saving with a blank attribute, such as from an optional form parameter.
|
29
23
|
|
30
24
|
```ruby
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
<div>The body</div>
|
35
|
-
HTML
|
25
|
+
class Message
|
26
|
+
has_rich_text :content, store_if_blank: false
|
27
|
+
end
|
36
28
|
|
37
|
-
content
|
38
|
-
|
39
|
-
assert_pattern { h1 => { content: "Hello, world" } }
|
40
|
-
assert_pattern { div => { content: "The body" } }
|
29
|
+
Message.create(content: "hi") # creates an ActionText::RichText
|
30
|
+
Message.create(content: "") # does not create an ActionText::RichText
|
41
31
|
```
|
42
32
|
|
43
|
-
*
|
44
|
-
|
45
|
-
* Fix all Action Text database related models to respect
|
46
|
-
`ActiveRecord::Base.table_name_prefix` configuration.
|
47
|
-
|
48
|
-
*Chedli Bourguiba*
|
49
|
-
|
50
|
-
* Compile ESM package that can be used directly in the browser as actiontext.esm.js
|
33
|
+
*Alex Ghiculescu*
|
51
34
|
|
52
|
-
|
35
|
+
* Strip `content` attribute if the key is present but the value is empty
|
53
36
|
|
54
|
-
*
|
37
|
+
*Jeremy Green*
|
55
38
|
|
56
|
-
|
39
|
+
* Rename `rich_text_area` methods into `rich_textarea`
|
57
40
|
|
58
|
-
|
41
|
+
Old names are still available as aliases.
|
59
42
|
|
60
|
-
*
|
43
|
+
*Sean Doyle*
|
61
44
|
|
62
|
-
*
|
45
|
+
* Only sanitize `content` attribute when present in attachments.
|
63
46
|
|
64
|
-
*
|
47
|
+
*Petrik de Heus*
|
65
48
|
|
66
|
-
Please check [7-
|
49
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actiontext/CHANGELOG.md) for previous changes.
|
@@ -853,25 +853,47 @@ class AttachmentUpload {
|
|
853
853
|
}
|
854
854
|
start() {
|
855
855
|
this.directUpload.create(this.directUploadDidComplete.bind(this));
|
856
|
+
this.dispatch("start");
|
856
857
|
}
|
857
858
|
directUploadWillStoreFileWithXHR(xhr) {
|
858
859
|
xhr.upload.addEventListener("progress", (event => {
|
859
860
|
const progress = event.loaded / event.total * 100;
|
860
861
|
this.attachment.setUploadProgress(progress);
|
862
|
+
if (progress) {
|
863
|
+
this.dispatch("progress", {
|
864
|
+
progress: progress
|
865
|
+
});
|
866
|
+
}
|
861
867
|
}));
|
862
868
|
}
|
863
869
|
directUploadDidComplete(error, attributes) {
|
864
870
|
if (error) {
|
865
|
-
|
871
|
+
this.dispatchError(error);
|
872
|
+
} else {
|
873
|
+
this.attachment.setAttributes({
|
874
|
+
sgid: attributes.attachable_sgid,
|
875
|
+
url: this.createBlobUrl(attributes.signed_id, attributes.filename)
|
876
|
+
});
|
877
|
+
this.dispatch("end");
|
866
878
|
}
|
867
|
-
this.attachment.setAttributes({
|
868
|
-
sgid: attributes.attachable_sgid,
|
869
|
-
url: this.createBlobUrl(attributes.signed_id, attributes.filename)
|
870
|
-
});
|
871
879
|
}
|
872
880
|
createBlobUrl(signedId, filename) {
|
873
881
|
return this.blobUrlTemplate.replace(":signed_id", signedId).replace(":filename", encodeURIComponent(filename));
|
874
882
|
}
|
883
|
+
dispatch(name, detail = {}) {
|
884
|
+
detail.attachment = this.attachment;
|
885
|
+
return dispatchEvent(this.element, `direct-upload:${name}`, {
|
886
|
+
detail: detail
|
887
|
+
});
|
888
|
+
}
|
889
|
+
dispatchError(error) {
|
890
|
+
const event = this.dispatch("error", {
|
891
|
+
error: error
|
892
|
+
});
|
893
|
+
if (!event.defaultPrevented) {
|
894
|
+
alert(error);
|
895
|
+
}
|
896
|
+
}
|
875
897
|
get directUploadUrl() {
|
876
898
|
return this.element.dataset.directUploadUrl;
|
877
899
|
}
|
@@ -826,25 +826,47 @@
|
|
826
826
|
}
|
827
827
|
start() {
|
828
828
|
this.directUpload.create(this.directUploadDidComplete.bind(this));
|
829
|
+
this.dispatch("start");
|
829
830
|
}
|
830
831
|
directUploadWillStoreFileWithXHR(xhr) {
|
831
832
|
xhr.upload.addEventListener("progress", (event => {
|
832
833
|
const progress = event.loaded / event.total * 100;
|
833
834
|
this.attachment.setUploadProgress(progress);
|
835
|
+
if (progress) {
|
836
|
+
this.dispatch("progress", {
|
837
|
+
progress: progress
|
838
|
+
});
|
839
|
+
}
|
834
840
|
}));
|
835
841
|
}
|
836
842
|
directUploadDidComplete(error, attributes) {
|
837
843
|
if (error) {
|
838
|
-
|
844
|
+
this.dispatchError(error);
|
845
|
+
} else {
|
846
|
+
this.attachment.setAttributes({
|
847
|
+
sgid: attributes.attachable_sgid,
|
848
|
+
url: this.createBlobUrl(attributes.signed_id, attributes.filename)
|
849
|
+
});
|
850
|
+
this.dispatch("end");
|
839
851
|
}
|
840
|
-
this.attachment.setAttributes({
|
841
|
-
sgid: attributes.attachable_sgid,
|
842
|
-
url: this.createBlobUrl(attributes.signed_id, attributes.filename)
|
843
|
-
});
|
844
852
|
}
|
845
853
|
createBlobUrl(signedId, filename) {
|
846
854
|
return this.blobUrlTemplate.replace(":signed_id", signedId).replace(":filename", encodeURIComponent(filename));
|
847
855
|
}
|
856
|
+
dispatch(name, detail = {}) {
|
857
|
+
detail.attachment = this.attachment;
|
858
|
+
return dispatchEvent(this.element, `direct-upload:${name}`, {
|
859
|
+
detail: detail
|
860
|
+
});
|
861
|
+
}
|
862
|
+
dispatchError(error) {
|
863
|
+
const event = this.dispatch("error", {
|
864
|
+
error: error
|
865
|
+
});
|
866
|
+
if (!event.defaultPrevented) {
|
867
|
+
alert(error);
|
868
|
+
}
|
869
|
+
}
|
848
870
|
get directUploadUrl() {
|
849
871
|
return this.element.dataset.directUploadUrl;
|
850
872
|
}
|