editmode 0.0.10.16 → 1.1.0

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: 6436b313b030cf81d23b8272298001445eb96fe03cdece2493ab493b7b03353b
4
- data.tar.gz: d277cd2ca885fd8e082f17cde5afaab63db7cef4e67a7f131785a29d0c013006
3
+ metadata.gz: f95b98f49a419090f8745a3cf5cfb96d2cafb889c22268f759b07ca5fbb326d1
4
+ data.tar.gz: 61e6d4f6acf151d875d990e5b223009deefd1407c7fbad3799793ba703ffde17
5
5
  SHA512:
6
- metadata.gz: 920b13e489ef97f223550ec25d9fe0ee6015d97cd442c448317a01ecc4d11d3c22c5bb56ae89c2e107978d4fe570385c81fb97515dcded68c70f5767808e214f
7
- data.tar.gz: a1c1d9d60c1bfbe1f8b6bccf715aca23d03fcf14a60e3eeeb55c88a34e1110ed65f4affb37bd12d8cbdfcefd18e05f2709f744555eec7ded5bbce89a0a14f1ba
6
+ metadata.gz: adcdff8c0127b8ca33ee6fc735d2aaa05b9c009570d0e62f726d1cb08ea42e78b53f89bd825deda483da66423b9870b5b278b79acf24df7f5af533cb0d0bda0f
7
+ data.tar.gz: 6c530fe95532b300ac069797078133a931f8c5fc6873e42fee1656bcee5bca6ab43f39424eac982ef9f7e0c05e470a95b7b1a070ba8807f153dc1df6b5078899
@@ -67,8 +67,8 @@ module Editmode
67
67
 
68
68
  begin
69
69
  # Always sanitize the content!!
70
- chunk_content = ActionController::Base.helpers.sanitize(chunk_content)
71
-
70
+ chunk_content = ActionController::Base.helpers.sanitize(chunk_content) unless chunk_type == 'rich_text'
71
+
72
72
  css_class = options[:class]
73
73
 
74
74
  if chunk_type == "image"
@@ -77,7 +77,7 @@ module Editmode
77
77
  display_type = options[:display_type] || "span"
78
78
  end
79
79
 
80
- chunk_data = { :chunk => chunk_identifier, :chunk_editable => false }
80
+ chunk_data = { :chunk => chunk_identifier, :chunk_editable => false, :chunk_type => chunk_type }
81
81
 
82
82
  if options[:parent_identifier].present?
83
83
  chunk_data.merge!({parent_identifier: options[:parent_identifier]})
@@ -86,7 +86,7 @@ module Editmode
86
86
  case display_type
87
87
  when "span"
88
88
  if chunk_type == "rich_text"
89
- content_tag("em-span", :class => css_class, :data => chunk_data ) do
89
+ content = content_tag("em-span", :class => "editmode-richtext-editor #{css_class}", :data => chunk_data.merge!({:chunk_editable => true}) ) do
90
90
  chunk_content.html_safe
91
91
  end
92
92
  else
@@ -165,7 +165,7 @@ module Editmode
165
165
  end
166
166
 
167
167
  def no_response_received(id = "")
168
- "Sorry, we can't find a content using this identifier: \"#{id}\""
168
+ "Sorry, we can't find a chunk using this identifier: \"#{id}\". This can happen if you've deleted a chunk on editmode.com or if your local cache is out of date. If it persists, try running Rails.cache clear."
169
169
  end
170
170
 
171
171
  def require_field_id
@@ -4,7 +4,9 @@ module Editmode
4
4
 
5
5
  attr_accessor :identifier, :variable_values, :branch_id,
6
6
  :variable_fallbacks, :chunk_type, :project_id,
7
- :response, :content
7
+ :response
8
+
9
+ attr_writer :content
8
10
 
9
11
  def initialize(identifier, **options)
10
12
  @identifier = identifier
@@ -29,11 +31,17 @@ module Editmode
29
31
  raise require_field_id
30
32
  end
31
33
  else
32
- raise "undefined method field for chunk_type: #{chunk_type}"
34
+ raise NoMethodError.new "undefined method 'field` for chunk_type: #{chunk_type} \n"
33
35
  end
34
36
  result ||= content
35
37
  end
36
38
 
39
+ def content
40
+ raise NoMethodError.new "undefined method 'content` for chunk_type: collection_item \nDid you mean? field" if chunk_type == 'collection_item'
41
+
42
+ variable_parse!(@content, variable_fallbacks, variable_values)
43
+ end
44
+
37
45
  private
38
46
  def get_content
39
47
  branch_params = branch_id.present? ? "branch_id=#{branch_id}" : ""
@@ -26,7 +26,7 @@ module Editmode
26
26
  end
27
27
 
28
28
  def script_url
29
- ENV["EDITMODE_OVERRIDE_SCRIPT_URL"] || "https://static.editmode.com/editmode@1.0.0/dist/editmode.js"
29
+ ENV["EDITMODE_OVERRIDE_SCRIPT_URL"] || "https://static.editmode.com/editmode@^1.0.0/dist/editmode.js"
30
30
  end
31
31
 
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module Editmode
2
- VERSION = "0.0.10.16"
2
+ VERSION = "1.1.0"
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: 0.0.10.16
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Ennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler