render_editorjs 0.1.2 → 0.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 +4 -4
- data/.github/workflows/ci.yml +1 -2
- data/Gemfile.lock +6 -9
- data/lib/render_editorjs/blocks/paragraph.rb +9 -8
- data/lib/render_editorjs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02d03a5fea8db48118e679aa1c956e6e91ea551cc5ee211384b36806a866dbfa
|
4
|
+
data.tar.gz: f07ed69a71fc542678f3ccb47cdadef1f147860a3f88844b82362472dbb9f09d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96200bcdf8cb481c97678fa476ad2f632fd5cf1f38a07e8a878c127fc68d094ebc920a25361dab42b020510f00a9be6ea03da769c7429df98cae3bdd4f5b33b6
|
7
|
+
data.tar.gz: 2d16c244edffa752fb3459a9e944e472b835578c88e6d85f38d33a842a37f83f2641bd6f0a6a0edb8e9df53ebebeea36b63ee1fd91d85998d82906ade2b41bb9
|
data/.github/workflows/ci.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
render_editorjs (0.1.
|
4
|
+
render_editorjs (0.1.3)
|
5
5
|
actionview (>= 4)
|
6
6
|
json-schema (~> 2)
|
7
7
|
sanitize (~> 6.0.0)
|
@@ -10,18 +10,17 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actionview (
|
14
|
-
activesupport (=
|
13
|
+
actionview (7.0.0)
|
14
|
+
activesupport (= 7.0.0)
|
15
15
|
builder (~> 3.1)
|
16
16
|
erubi (~> 1.4)
|
17
17
|
rails-dom-testing (~> 2.0)
|
18
18
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
19
|
-
activesupport (
|
19
|
+
activesupport (7.0.0)
|
20
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
21
|
i18n (>= 1.6, < 2)
|
22
22
|
minitest (>= 5.1)
|
23
23
|
tzinfo (~> 2.0)
|
24
|
-
zeitwerk (~> 2.3)
|
25
24
|
addressable (2.8.0)
|
26
25
|
public_suffix (>= 2.0.2, < 5.0)
|
27
26
|
ansi (1.5.0)
|
@@ -54,12 +53,11 @@ GEM
|
|
54
53
|
listen (3.7.0)
|
55
54
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
56
55
|
rb-inotify (~> 0.9, >= 0.9.10)
|
57
|
-
loofah (2.
|
56
|
+
loofah (2.13.0)
|
58
57
|
crass (~> 1.0.2)
|
59
58
|
nokogiri (>= 1.5.9)
|
60
59
|
lumberjack (1.2.8)
|
61
60
|
method_source (1.0.0)
|
62
|
-
mini_portile2 (2.6.1)
|
63
61
|
minitest (5.14.4)
|
64
62
|
minitest-focus (1.3.1)
|
65
63
|
minitest (>= 4, < 6)
|
@@ -71,8 +69,7 @@ GEM
|
|
71
69
|
minitest (>= 5.0)
|
72
70
|
ruby-progressbar
|
73
71
|
nenv (0.3.0)
|
74
|
-
nokogiri (1.12.5)
|
75
|
-
mini_portile2 (~> 2.6.1)
|
72
|
+
nokogiri (1.12.5-x86_64-darwin)
|
76
73
|
racc (~> 1.4)
|
77
74
|
notiffany (0.1.3)
|
78
75
|
nenv (~> 0.1)
|
@@ -5,11 +5,7 @@ module RenderEditorjs
|
|
5
5
|
# Compatible with default Paragraph and paragraph-with-aligment
|
6
6
|
# https://github.com/kaaaaaaaaaaai/paragraph-with-alignment
|
7
7
|
class Paragraph < Base
|
8
|
-
|
9
|
-
tag: "p"
|
10
|
-
}.freeze
|
11
|
-
|
12
|
-
SAFE_TAGS = {
|
8
|
+
DEFAULT_SAFE_TAGS = {
|
13
9
|
"b" => nil,
|
14
10
|
"i" => nil,
|
15
11
|
"u" => ["class"],
|
@@ -19,6 +15,10 @@ module RenderEditorjs
|
|
19
15
|
"code" => ["class"]
|
20
16
|
}.freeze
|
21
17
|
|
18
|
+
DEFAULT_OPTIONS = {
|
19
|
+
tag: "p"
|
20
|
+
}.freeze
|
21
|
+
|
22
22
|
SCHEMA = YAML.safe_load(<<~YAML)
|
23
23
|
type: object
|
24
24
|
additionalProperties: false
|
@@ -35,8 +35,9 @@ module RenderEditorjs
|
|
35
35
|
|
36
36
|
attr_reader :options
|
37
37
|
|
38
|
-
def initialize(options = DEFAULT_OPTIONS)
|
38
|
+
def initialize(options = DEFAULT_OPTIONS.dup)
|
39
39
|
@options = options
|
40
|
+
@options[:safe_tags] ||= DEFAULT_SAFE_TAGS
|
40
41
|
super()
|
41
42
|
end
|
42
43
|
|
@@ -53,8 +54,8 @@ module RenderEditorjs
|
|
53
54
|
def sanitize(text)
|
54
55
|
Sanitize.fragment(
|
55
56
|
text,
|
56
|
-
elements:
|
57
|
-
attributes:
|
57
|
+
elements: options[:safe_tags].keys,
|
58
|
+
attributes: options[:safe_tags].select { |_k, v| v },
|
58
59
|
remove_contents: true
|
59
60
|
)
|
60
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render_editorjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Galisteo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|