editmode 1.0.18 → 1.1.3

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: 4ae0438c959f508fa801802027178522476c93f3f4484f48693ecbc2719d879a
4
- data.tar.gz: 3cc41e671a7c2c21b4a37b324163ff24494ca88d6381b1779aee14fc79386594
3
+ metadata.gz: 7f35d1a3250f58710c56b263924699ab3754f756421f69f226f76532402b2761
4
+ data.tar.gz: d6ee312d1bab76c93cf27f1a89b706832841e6423aff7594ba80e1497b824235
5
5
  SHA512:
6
- metadata.gz: a1fa2d9118f2d4e9e47aedb3ec0b65dd0c88a5cc3becd945414103380de431f34b0010531fe64a23cc32b39e52bba0d57fef0e2b80cf406402b552c388c5924f
7
- data.tar.gz: 329caa75d6c8a8fe11fabaf5d3a7a182da3b6112e04dd4831a5f96fb7f28c7125b3250144ab0a5b60bd59187353566bd28c656007f625c66437366dd92971389
6
+ metadata.gz: ed579de54f72d27d3481c663a68bf267eecb2cd77824fa33cd2510096b92c9aeee8459ca1df7336284bb93c47ba8babedc2574a7ebc505fe5ff2d90c722a79ce
7
+ data.tar.gz: e50a3b41492043301caec5db7ee79cb4a7d67a19fe4f301138bb04a055d7c732e212ac92ae12891ff395b4805d7df5d26cdcb33f5444905c57553d5677112c4c
@@ -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"
@@ -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
@@ -18,7 +20,7 @@ module Editmode
18
20
  if chunk_type == 'collection_item'
19
21
  if field.present?
20
22
  field.downcase!
21
- field_content = content.detect {|f| f["custom_field_identifier"].downcase == field || f["custom_field_name"].downcase == field }
23
+ field_content = @content.detect {|f| f["custom_field_identifier"].downcase == field || f["custom_field_name"].downcase == field }
22
24
  if field_content.present?
23
25
  result = field_content['content']
24
26
  result = variable_parse!(result, variable_fallbacks, variable_values)
@@ -29,9 +31,15 @@ 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
- result ||= content
36
+ result || @content
37
+ end
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)
35
43
  end
36
44
 
37
45
  private
@@ -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 = "1.0.18"
2
+ VERSION = "1.1.3"
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.0.18
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Ennis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-13 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,7 +93,7 @@ homepage: https://github.com/tonyennis145/editmode-rails
93
93
  licenses:
94
94
  - MIT
95
95
  metadata: {}
96
- post_install_message:
96
+ post_install_message:
97
97
  rdoc_options: []
98
98
  require_paths:
99
99
  - lib
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubygems_version: 3.0.8
112
- signing_key:
112
+ signing_key:
113
113
  specification_version: 4
114
114
  summary: Editmode allows you to turn plain text in your rails app into easily inline-editable
115
115
  bits of content that can be managed by anyone with no technical knowledge