editmode 0.0.10.17 → 1.1.1

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: 84e04c69c8b419dd68ae049388bdb37b578e6294b6cc28eda7cd9abd2c81ee08
4
- data.tar.gz: a35062691fc6cfbf10b00090cd625e93fad33c73f875ebf89b4dd2280fb23ab4
3
+ metadata.gz: 2b0dd9951ef0e48376081729783e5f722f291818ce523db1867a7e6ecc30eb83
4
+ data.tar.gz: b83d8a8b26ce25c881fe848197917d0318fc5c32cab12105a14263e1cac78900
5
5
  SHA512:
6
- metadata.gz: efd6cafe879df92901fd55b82f399a5e04b24a134c79a4156d5af93d34f202b7a63956b5c16a308effe9fd7994dd827f9cbf793c7cf43da0dcf79d069ce7cf69
7
- data.tar.gz: ce0fd13d933885a3091dc08f81e7aef749ebf1b7ef9d3345332bd6e73775cef2c962eec7defdf4f6ce76774c05e5bdf8d5533a2b2e805ca5cce0fbeb4abd347b
6
+ metadata.gz: 4c9c3b5e77d2a30f30986009c9998c2746d38c9c95668ff05425ca006d0356728c049395ef7661c8d2158e68f1e2867a3a16b4b43f4643b0a42f830c02bdfce1
7
+ data.tar.gz: ae797ecca5f90c38ce43f5aa8cafa8ca39890ff336a441969065ea12e41f5b441057cd4454894462657eb23698508cb01f1e3948259d09f0f438710cc66a8c99
@@ -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
@@ -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}" : ""
@@ -18,6 +18,7 @@ module Editmode
18
18
 
19
19
  str = <<-EDITMODE_SCRIPT
20
20
  <script>window.chunksProjectIdentifier = '#{Editmode.project_id}'</script>
21
+ <script>window.editmodeENV = '#{ENV["EDITMODE_ENV"] || 'production'}'</script>
21
22
  <script src="#{script_url}" async ></script>
22
23
  EDITMODE_SCRIPT
23
24
 
@@ -26,7 +27,7 @@ module Editmode
26
27
  end
27
28
 
28
29
  def script_url
29
- ENV["EDITMODE_OVERRIDE_SCRIPT_URL"] || "https://static.editmode.com/editmode@1.0.0/dist/editmode.js"
30
+ ENV["EDITMODE_OVERRIDE_SCRIPT_URL"] || "https://static.editmode.com/editmode@^1.0.0/dist/editmode.js"
30
31
  end
31
32
 
32
33
  end
@@ -1,3 +1,3 @@
1
1
  module Editmode
2
- VERSION = "0.0.10.17"
2
+ VERSION = "1.1.1"
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.17
4
+ version: 1.1.1
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-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler