editor_js 0.3.0 → 0.3.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: acb250e53e4ac2ca1a58b57158be0c202b0bfbdbd139a6c1d42960448f429646
4
- data.tar.gz: 945fd7ee5b68505e3e8410f63abba4d282327a39fe1ab0023fd4bca2e56439e6
3
+ metadata.gz: 3331b44289e858fff9fe9dff634c67c385c355f54f26a671ca32caf0b2736c2a
4
+ data.tar.gz: 3a6690dad7bf834d108855d1bf80de681c285ccec755ca7f0e9b799dff7a3c76
5
5
  SHA512:
6
- metadata.gz: 4faa65d0158ea4e23d19a6c4fc9ddae3e919e5b5e37a3635451fd00ad2656f8af9b9a149f50ebba19b05f11f149747f0ea88ff052767c756e2ac30180e37076a
7
- data.tar.gz: f55ca3cae24b0d553abdf9fecb96234e722c2410fc099719f4d5140258a380e341abb5f59c1afc6f32f62950c4988f8470d8fc6ce81aa46f5c0e019032a42b5c
6
+ metadata.gz: ad9f9f867736e7bc0db5497d64f8253d4c381088c1e2b65dc6d6747c508809a901e609868fa354733b137d217ef49ab43f27ddc2d40d27d7fe8243b856d16da9
7
+ data.tar.gz: '09dd651215451db432c4c3ef27a772db470fd6dba5b4d216b592fef2373b5dfec6b12c5efdda3b69be94c20f82b2f76c719eb2f732db80a33b2c96650848e113'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- editor_js (0.3.0)
4
+ editor_js (0.3.1)
5
5
  actionview (>= 4)
6
6
  activesupport (>= 4)
7
7
  coderay (~> 1.1, >= 1.1.2)
@@ -13,41 +13,41 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- actionview (6.0.2.2)
17
- activesupport (= 6.0.2.2)
16
+ actionview (6.0.3.1)
17
+ activesupport (= 6.0.3.1)
18
18
  builder (~> 3.1)
19
19
  erubi (~> 1.4)
20
20
  rails-dom-testing (~> 2.0)
21
21
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
22
- activesupport (6.0.2.2)
22
+ activesupport (6.0.3.1)
23
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
24
  i18n (>= 0.7, < 2)
25
25
  minitest (~> 5.1)
26
26
  tzinfo (~> 1.1)
27
- zeitwerk (~> 2.2)
27
+ zeitwerk (~> 2.2, >= 2.2.2)
28
28
  addressable (2.7.0)
29
29
  public_suffix (>= 2.0.2, < 5.0)
30
30
  ast (2.4.0)
31
31
  builder (3.2.4)
32
32
  coderay (1.1.2)
33
- concurrent-ruby (1.1.6)
34
- crass (1.0.6)
33
+ concurrent-ruby (1.1.5)
34
+ crass (1.0.5)
35
35
  diff-lcs (1.3)
36
36
  docile (1.3.2)
37
37
  erubi (1.9.0)
38
38
  htmlentities (4.3.4)
39
- i18n (1.8.2)
39
+ i18n (1.7.0)
40
40
  concurrent-ruby (~> 1.0)
41
41
  jaro_winkler (1.5.4)
42
42
  json (2.3.0)
43
43
  json-schema (2.8.1)
44
44
  addressable (>= 2.4)
45
- loofah (2.4.0)
45
+ loofah (2.5.0)
46
46
  crass (~> 1.0.2)
47
47
  nokogiri (>= 1.5.9)
48
48
  method_source (0.9.2)
49
49
  mini_portile2 (2.4.0)
50
- minitest (5.14.0)
50
+ minitest (5.14.1)
51
51
  nokogiri (1.10.9)
52
52
  mini_portile2 (~> 2.4.0)
53
53
  nokogumbo (2.0.2)
@@ -58,7 +58,7 @@ GEM
58
58
  pry (0.12.2)
59
59
  coderay (~> 1.1.0)
60
60
  method_source (~> 0.9.0)
61
- public_suffix (4.0.1)
61
+ public_suffix (4.0.3)
62
62
  rails-dom-testing (2.0.3)
63
63
  activesupport (>= 4.2.0)
64
64
  nokogiri (>= 1.6)
@@ -98,10 +98,10 @@ GEM
98
98
  simplecov-html (~> 0.10.0)
99
99
  simplecov-html (0.10.2)
100
100
  thread_safe (0.3.6)
101
- tzinfo (1.2.6)
101
+ tzinfo (1.2.7)
102
102
  thread_safe (~> 0.1)
103
103
  unicode-display_width (1.6.0)
104
- zeitwerk (2.3.0)
104
+ zeitwerk (2.2.2)
105
105
 
106
106
  PLATFORMS
107
107
  ruby
@@ -116,4 +116,4 @@ DEPENDENCIES
116
116
  simplecov (~> 0.17.1)
117
117
 
118
118
  BUNDLED WITH
119
- 2.0.2
119
+ 2.1.4
@@ -28,7 +28,7 @@ module EditorJs
28
28
  data['items'].map do |item|
29
29
  content_tag(:div, class: css_name('__warrper')) do
30
30
  html_str = content_tag(:input, nil, type: 'checkbox', disabled: true, checked: item['checked'])
31
- html_str += content_tag(:label, item['text'])
31
+ html_str += content_tag(:label, item['text'].html_safe)
32
32
  html_str.html_safe
33
33
  end.html_safe
34
34
  end.join.html_safe
@@ -36,8 +36,21 @@ module EditorJs
36
36
  end
37
37
 
38
38
  def sanitize!
39
+ safe_tags = {
40
+ 'b' => nil,
41
+ 'i' => nil,
42
+ 'a' => ['href'],
43
+ 'mark' => ['class'],
44
+ 'code' => ['class']
45
+ }
46
+
39
47
  data['items'].each do |item|
40
- item['text'] = Sanitize.fragment(item['text'], remove_contents: true).strip
48
+ item['text'] = Sanitize.fragment(
49
+ item['text'],
50
+ elements: safe_tags.keys,
51
+ attributes: safe_tags.select {|k, v| v},
52
+ remove_contents: true
53
+ )
41
54
  end
42
55
  end
43
56
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EditorJs
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editor_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - xiaohui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  requirements: []
223
- rubygems_version: 3.0.6
223
+ rubygems_version: 3.0.8
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Ruby gem for editorjs.io text editor