editor_js 0.3.2 → 0.3.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: 93229c8676be2345e0a35669d12446cf9129a64ed6125075c48f40c68cc88002
4
- data.tar.gz: 7c38da172a624ba263578c309804d7ac81397f2ad23248dbe2c967245f445c6d
3
+ metadata.gz: 78823d325e66419e62e84adde1e8ec37586db12f9bbfb35482ccb34187dc2799
4
+ data.tar.gz: 47c8ff8f3a588bb6418e0118bca21f183aecf3802e683078f2b2019b565e42f4
5
5
  SHA512:
6
- metadata.gz: 5cf50dda5535924c9ca49d419116e1c3b690ef12cf1cb7418c5566e767093fdd5934ec7f1d0ec1b7584d987280ee8d13f498da3bc3d54e2385a069f4c1883012
7
- data.tar.gz: f9ecf7becd391807beb4cf0e050c89349bd1e9a46884644e11beae6ba2eb21425e1ebdfee34096b00bf3d95cd63d5b8e8f44cd412fe4b326806d3790fa817a18
6
+ metadata.gz: 50a8ba307aa9a078f0e50e8364503c5c917fc429d73d5eebe134e2152493ce55d69e8301fb5c9121ce6a6098d6931372e843f59c564b2e802ef3bda9cb43fa12
7
+ data.tar.gz: 723fa09aa421e41880ddab811ee431814c9e655ef95ab0dd6fc94a3ebe790d52b1422a6189eb38f41447b743cfce1f96e1d7a27b749fc4af17c33dfcb8d0de0a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- editor_js (0.3.2)
4
+ editor_js (0.3.3)
5
5
  actionview (>= 4)
6
6
  activesupport (>= 4)
7
7
  coderay (~> 1.1, >= 1.1.2)
@@ -13,6 +13,12 @@ module EditorJs
13
13
  level:
14
14
  type: number
15
15
  enum: [1,2,3,4,5,6]
16
+ alignment:
17
+ type: string
18
+ enum:
19
+ - align-left
20
+ - align-center
21
+ - align-right
16
22
  required:
17
23
  - text
18
24
  - level
@@ -20,7 +26,15 @@ module EditorJs
20
26
  end
21
27
 
22
28
  def render(_options = {})
23
- content_tag(:"h#{data['level']}", data['text'].html_safe, class: css_name)
29
+ alignment = data['alignment']
30
+ class_name_str = css_name
31
+ if alignment.present?
32
+ class_name_str = [
33
+ class_name_str,
34
+ css_name("__#{alignment}")
35
+ ].join(' ')
36
+ end
37
+ content_tag(:"h#{data['level']}", data['text'].html_safe, class: class_name_str)
24
38
  end
25
39
 
26
40
  def sanitize!
@@ -10,11 +10,25 @@ module EditorJs
10
10
  properties:
11
11
  text:
12
12
  type: string
13
+ alignment:
14
+ type: string
15
+ enum:
16
+ - align-left
17
+ - align-center
18
+ - align-right
13
19
  YAML
14
20
  end
15
21
 
16
22
  def render(_options = {})
17
- content_tag(:div, class: css_name) { data['text'].html_safe }
23
+ alignment = data['alignment']
24
+ class_name_str = css_name
25
+ if alignment.present?
26
+ class_name_str = [
27
+ class_name_str,
28
+ css_name("__#{alignment}")
29
+ ].join(' ')
30
+ end
31
+ content_tag(:div, class: class_name_str) { data['text'].html_safe }
18
32
  end
19
33
 
20
34
  def sanitize!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EditorJs
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.3'
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.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - xiaohui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-08 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview