editmode 1.4.0 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d4e2e45806e29ba1a85e9bc615297cb1e1a6e9445d50f52b003472b2a20cd6c
4
- data.tar.gz: 1a8c556bd66f8bff8b3c59e696f1e08dc5c1b4855537c10cb7874bcb6139e05c
3
+ metadata.gz: fff57d95ac86fdc9e8ed38b229db1af91bfbf5ce800d9267a53a23cdb171ac49
4
+ data.tar.gz: 82c91e009fddbf8425f347c1623005ac6fe56c3d00adead787ebe3149d14395c
5
5
  SHA512:
6
- metadata.gz: 537d0f6d2ef4627f99bc9ca085b022bb9c5d6b8035254bc5a4284d9a25f3e24996e6f4d1a69734cca3c72317e292505706202004c7147dbe2f7419e0266c441e
7
- data.tar.gz: b36ac59ef4a1768c08ab526401b1e28e92fe9977c53e4bc786b850fb9f25f21968da79a992ad8321bdd4457297df687ed6a98a601b80be492101fdf7ac8bc4ea
6
+ metadata.gz: 23b94b470c954703662f0536e435c94a7df34e40a5422cf396028325b509c312867690cbb757cb866aa42c1a90647f3c7dc9b2389c0a82ed63bd7c90da0b2eff
7
+ data.tar.gz: e6148ce31116c2b0713ce05c42319c7c199c890e2ba4d6d4c13ef4eb61c71679d07b6c685b65681ba50b86130fdbedcd0e4af0fd2abb8d1857eb38e641f98e2e
data/README.md CHANGED
@@ -33,6 +33,11 @@ end
33
33
  That's it, you're all set up. By default Editmode will now include editmode.js in every page of your rails application, unless you disable auto-include.
34
34
  <hr/>
35
35
 
36
+ #### 3. (Rails 6) Ensuring the Magic Editor works with Content Security Policy
37
+
38
+ - Add "https://static.editmode.com" to `style_src` and `script_src` in your content security policy.
39
+ - Add "https://api.editmode.com" to `connect_src` in your content security policy.
40
+
36
41
  ## Rendering Content
37
42
 
38
43
  Editmode provides helper methods for use in your rails views and controllers.
@@ -38,7 +38,8 @@ module Editmode
38
38
  :collection_identifier => collection_identifier,
39
39
  :branch_id => branch_id,
40
40
  :limit => limit,
41
- :tags => tags
41
+ :tags => tags,
42
+ :project_id => Editmode.project_id
42
43
  }.to_query
43
44
 
44
45
  url = URI(api_root_url)
@@ -63,10 +64,10 @@ module Editmode
63
64
 
64
65
  if chunks.any?
65
66
  content_tag :div, class: "chunks-collection-wrapper #{parent_class}", data: {chunk_collection_identifier: collection_identifier} do
66
- chunks.each do |chunk|
67
+ chunks.each_with_index do |chunk, index|
67
68
  @custom_field_chunk = chunk
68
69
  concat(content_tag(:div, class: "chunks-collection-item--wrapper #{item_class}") do
69
- yield(@custom_field_chunk)
70
+ yield(@custom_field_chunk, index)
70
71
  end)
71
72
  end
72
73
 
@@ -90,7 +91,7 @@ module Editmode
90
91
  def chunk_field_value(parent_chunk_object, custom_field_identifier, options = {})
91
92
  begin
92
93
  chunk_identifier = parent_chunk_object["identifier"]
93
- chunk_value = Editmode::ChunkValue.new(parent_chunk_object["identifier"], options.merge({response: parent_chunk_object}))
94
+ chunk_value = Editmode::ChunkValue.new(parent_chunk_object["identifier"], **options.merge({response: parent_chunk_object}))
94
95
  custom_field_item = chunk_value.field_chunk(custom_field_identifier)
95
96
 
96
97
  options[:field] = custom_field_identifier
@@ -164,7 +165,7 @@ module Editmode
164
165
  begin
165
166
  field = options[:field].presence || ""
166
167
  options[:referrer] = request.present? && request.url || ""
167
- chunk_value = Editmode::ChunkValue.new(identifier, options)
168
+ chunk_value = Editmode::ChunkValue.new(identifier, **options)
168
169
 
169
170
  if field.present? && chunk_value.chunk_type == 'collection_item'
170
171
  chunk_content = chunk_value.field(field)
@@ -4,7 +4,7 @@ module Editmode
4
4
  def e(identifier, *args)
5
5
  field, options = parse_arguments(args)
6
6
  begin
7
- chunk = Editmode::ChunkValue.new(identifier, options.merge({raw: true}))
7
+ chunk = Editmode::ChunkValue.new(identifier, **options.merge({raw: true}))
8
8
 
9
9
  if chunk.chunk_type == 'collection_item'
10
10
  chunk.field(field)
@@ -1,3 +1,3 @@
1
1
  module Editmode
2
- VERSION = "1.4.0"
2
+ VERSION = "1.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editmode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Ennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.0.3
115
+ rubygems_version: 3.0.3.1
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Editmode allows you to turn plain text in your rails app into easily inline-editable