editor_js 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bde34585f58bd8801fa2245cabcd3f21ac959e75aa38872ddc1109667045a1c
4
- data.tar.gz: 69543e67908af715d8d287e5f9ee82a65da908c7fa5762b25c71f5b04d779ec7
3
+ metadata.gz: e86cd6d867f3751fae7644a529b9a81940189acff184a7a9d57c835603c1a10c
4
+ data.tar.gz: e8650afadb86745553ae949f67b26766e866d4213f4f2da49a1fb3b8a27b6f8d
5
5
  SHA512:
6
- metadata.gz: ad0f0292a369902cf8b09367c2b20b68b54d454ff9fb338d63917868e952b9d128f1389c849895c45c95978f4d352e9855895f1cbfe3f910b54fbcf0e5a7c35d
7
- data.tar.gz: 820748d8a5d178e547230aaacae0291b677f741abd29d481c5cc54ca7a42a331e392484169e804359e47c04f2d7f88cf79a536674dc8cb970fcd5f2fc3ddf686
6
+ metadata.gz: 39595b63e56f1f8d68ef2ca9ab3b83daf5539c87a88a5456f278444739c0705b8bb2ce3290f284e0ed13f84271c47ee0b0a851e8004be3d36082395017b0fefd
7
+ data.tar.gz: 70d3d7bfb418837f95d1e8140197a68daf1a2225e7fa1076f164991d6698decfcf83d515ff3dc280e2304141674ede9cf9cf3f70affa995511a64d64cc8801d8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- editor_js (0.2.1)
4
+ editor_js (0.2.2)
5
5
  actionview (>= 4)
6
6
  activesupport (>= 4)
7
7
  coderay (~> 1.1, >= 1.1.2)
@@ -13,13 +13,13 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- actionview (6.0.2)
17
- activesupport (= 6.0.2)
16
+ actionview (6.0.2.1)
17
+ activesupport (= 6.0.2.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)
22
+ activesupport (6.0.2.1)
23
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
24
  i18n (>= 0.7, < 2)
25
25
  minitest (~> 5.1)
@@ -25,9 +25,13 @@ module EditorJs
25
25
 
26
26
  def render(_options = {})
27
27
  content_tag :div, class: css_name do
28
- data['items'].each do |item|
29
- concat content_tag(:input, item['text'], type: 'checkbox', disabled: true, checked: item['checked'])
30
- end
28
+ data['items'].map do |item|
29
+ content_tag(:div, class: css_name('__warrper')) do
30
+ html_str = content_tag(:input, nil, type: 'checkbox', disabled: true, checked: item['checked'])
31
+ html_str += content_tag(:label, item['text'])
32
+ html_str.html_safe
33
+ end.html_safe
34
+ end.join.html_safe
31
35
  end
32
36
  end
33
37
 
@@ -15,6 +15,10 @@ module EditorJs
15
15
  type: object
16
16
  version:
17
17
  type: string
18
+ required:
19
+ - time
20
+ - blocks
21
+ - version
18
22
  YAML
19
23
 
20
24
  def initialize(str_or_hash)
@@ -40,7 +44,7 @@ module EditorJs
40
44
  def render
41
45
  return @renderred_html if instance_variable_defined?(:@renderred_html)
42
46
 
43
- @renderred_html = valid? ? @blocks.map(&:render).join : ''
47
+ @renderred_html = valid? ? @blocks.map(&:render).join.html_safe : ''
44
48
  end
45
49
 
46
50
  def plain
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EditorJs
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editor_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - xiaohui