@rails/actiontext 6.1.4 → 7.0.0-rc2

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.
package/README.md CHANGED
@@ -4,6 +4,10 @@ Action Text brings rich text content and editing to Rails. It includes the [Trix
4
4
 
5
5
  You can read more about Action Text in the [Action Text Overview](https://edgeguides.rubyonrails.org/action_text_overview.html) guide.
6
6
 
7
+ ## Development
8
+
9
+ The JavaScript for Action Text is distributed both as a npm module under @rails/actiontext and via the asset pipeline as actiontext.js (and we mirror Trix as trix.js). To ensure that the latter remains in sync, you must run `yarn build` and checkin the artifacts whenever the JavaScript source or the Trix dependency is bumped. CSS changes must be brought over manually to app/assets/stylesheets/trix.css
10
+
7
11
  ## License
8
12
 
9
13
  Action Text is released under the [MIT License](https://opensource.org/licenses/MIT).
@@ -4,7 +4,7 @@ export class AttachmentUpload {
4
4
  constructor(attachment, element) {
5
5
  this.attachment = attachment
6
6
  this.element = element
7
- this.directUpload = new DirectUpload(attachment.file, this.directUploadUrl, this)
7
+ this.directUpload = new DirectUpload(attachment.file, this.directUploadUrl, this.directUploadToken, this.attachmentName, this)
8
8
  }
9
9
 
10
10
  start() {
@@ -42,4 +42,11 @@ export class AttachmentUpload {
42
42
  get blobUrlTemplate() {
43
43
  return this.element.dataset.blobUrlTemplate
44
44
  }
45
+
46
+ get directUploadToken() {
47
+ return this.element.getAttribute("data-direct-upload-token");
48
+ }
49
+ get attachmentName() {
50
+ return this.element.getAttribute("data-direct-upload-attachment-name");
51
+ }
45
52
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@rails/actiontext",
3
- "version": "6.1.4",
3
+ "version": "7.0.0-rc2",
4
4
  "description": "Edit and display rich text in Rails applications",
5
5
  "main": "app/javascript/actiontext/index.js",
6
+ "type": "module",
6
7
  "files": [
7
8
  "app/javascript/actiontext/*.js"
8
9
  ],
@@ -21,9 +22,18 @@
21
22
  ],
22
23
  "license": "MIT",
23
24
  "dependencies": {
24
- "@rails/activestorage": "^6.0.0"
25
+ "@rails/activestorage": ">= 7.0.0-alpha1"
25
26
  },
26
27
  "peerDependencies": {
27
- "trix": "^1.2.0"
28
+ "trix": "^1.3.1"
29
+ },
30
+ "devDependencies": {
31
+ "@rollup/plugin-node-resolve": "^11.0.1",
32
+ "@rollup/plugin-commonjs": "^19.0.1",
33
+ "rollup": "^2.35.1",
34
+ "trix": "^1.3.1"
35
+ },
36
+ "scripts": {
37
+ "build": "rollup --config rollup.config.js"
28
38
  }
29
39
  }
package/CHANGELOG.md DELETED
@@ -1,101 +0,0 @@
1
- ## Rails 6.1.4 (June 24, 2021) ##
2
-
3
- * Always render attachment partials as HTML with `:html` format inside trix editor.
4
-
5
- *James Brooks*
6
-
7
-
8
- ## Rails 6.1.3.2 (May 05, 2021) ##
9
-
10
- * No changes.
11
-
12
-
13
- ## Rails 6.1.3.1 (March 26, 2021) ##
14
-
15
- * No changes.
16
-
17
-
18
- ## Rails 6.1.3 (February 17, 2021) ##
19
-
20
- * No changes.
21
-
22
-
23
- ## Rails 6.1.2.1 (February 10, 2021) ##
24
-
25
- * No changes.
26
-
27
-
28
- ## Rails 6.1.2 (February 09, 2021) ##
29
-
30
- * No changes.
31
-
32
-
33
- ## Rails 6.1.1 (January 07, 2021) ##
34
-
35
- * No changes.
36
-
37
-
38
- ## Rails 6.1.0 (December 09, 2020) ##
39
-
40
- * Declare `ActionText::FixtureSet.attachment` to generate an
41
- `<action-text-attachment sgid="..."></action-text-attachment>` element with
42
- a valid `sgid` attribute.
43
-
44
- ```ruby
45
- hello_world_review_content:
46
- record: hello_world (Review)
47
- name: content
48
- body: <p><%= ActionText::FixtureSet.attachment("messages", :hello_world) %> is great!</p>
49
- ```
50
-
51
- *Sean Doyle*
52
-
53
- * Locate `fill_in_rich_text_area` by `<label>` text
54
-
55
- In addition to searching for `<trix-editor>` elements with the appropriate
56
- `aria-label` attribute, also support locating elements that match the
57
- corresponding `<label>` element's text.
58
-
59
- *Sean Doyle*
60
-
61
- * Be able to add a default value to `rich_text_area`.
62
-
63
- ```ruby
64
- form.rich_text_area :content, value: "<h1>Hello world</h1>"
65
- #=> <input type="hidden" name="message[content]" id="message_content_trix_input_message_1" value="<h1>Hello world</h1>">
66
- ```
67
-
68
- *Paulo Ancheta*
69
-
70
- * Add method to confirm rich text content existence by adding `?` after rich
71
- text attribute.
72
-
73
- ```ruby
74
- message = Message.create!(body: "<h1>Funny times!</h1>")
75
- message.body? #=> true
76
- ```
77
-
78
- *Kyohei Toyoda*
79
-
80
- * The `fill_in_rich_text_area` system test helper locates a Trix editor
81
- and fills it in with the given HTML.
82
-
83
- ```ruby
84
- # <trix-editor id="message_content" ...></trix-editor>
85
- fill_in_rich_text_area "message_content", with: "Hello <em>world!</em>"
86
-
87
- # <trix-editor placeholder="Your message here" ...></trix-editor>
88
- fill_in_rich_text_area "Your message here", with: "Hello <em>world!</em>"
89
-
90
- # <trix-editor aria-label="Message content" ...></trix-editor>
91
- fill_in_rich_text_area "Message content", with: "Hello <em>world!</em>"
92
-
93
- # <input id="trix_input_1" name="message[content]" type="hidden">
94
- # <trix-editor input="trix_input_1"></trix-editor>
95
- fill_in_rich_text_area "message[content]", with: "Hello <em>world!</em>"
96
- ```
97
-
98
- *George Claghorn*
99
-
100
-
101
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actiontext/CHANGELOG.md) for previous changes.