editor_js 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/lib/editor_js/blocks/embed_block.rb +3 -7
- data/lib/editor_js/blocks/markdown_block.rb +14 -12
- data/lib/editor_js/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: f2787f8b3e0e47ff54da6cc6fc80525a8f5432cfbd3ee2525b88f60fe37469ad
|
4
|
+
data.tar.gz: 72943f09ae8fe960555554f2d70bace6365d8c796608e845e547004b82619a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67e53a8f0a64aa6feccb2890415c38fc828c8404ebef8d79d619a1479c07effab7ca367894d34046d1969d39411d7dfce89bac451e0ffd07201a97a94dea701a
|
7
|
+
data.tar.gz: 455f764aa8dfaefe85bdabbc991f6fb6d401296f3e849d7e00fc92b744c0a3acdcc76e139a5a5f8ae6b2afc66bd83cd1e735decb52a039aec50224394fd04713
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
editor_js (0.
|
4
|
+
editor_js (0.2.0)
|
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.
|
17
|
-
activesupport (= 6.0.
|
16
|
+
actionview (6.0.2)
|
17
|
+
activesupport (= 6.0.2)
|
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.
|
22
|
+
activesupport (6.0.2)
|
23
23
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
24
|
i18n (>= 0.7, < 2)
|
25
25
|
minitest (~> 5.1)
|
@@ -116,4 +116,4 @@ DEPENDENCIES
|
|
116
116
|
simplecov (~> 0.17.1)
|
117
117
|
|
118
118
|
BUNDLED WITH
|
119
|
-
2.0
|
119
|
+
2.1.0
|
@@ -13,17 +13,13 @@ module EditorJs
|
|
13
13
|
embed:
|
14
14
|
type: string
|
15
15
|
height:
|
16
|
-
type:
|
17
|
-
- number
|
18
|
-
- string
|
16
|
+
type: string
|
19
17
|
service:
|
20
18
|
type: string
|
21
19
|
source:
|
22
20
|
type: string
|
23
21
|
width:
|
24
|
-
type:
|
25
|
-
- number
|
26
|
-
- string
|
22
|
+
type: string
|
27
23
|
required:
|
28
24
|
- embed
|
29
25
|
- service
|
@@ -45,7 +41,7 @@ module EditorJs
|
|
45
41
|
end
|
46
42
|
end
|
47
43
|
|
48
|
-
def sanitize
|
44
|
+
def sanitize!
|
49
45
|
%w(caption embed height service source width).each do |key|
|
50
46
|
data[key] = Sanitize.fragment(data[key], remove_contents: true).strip
|
51
47
|
end
|
@@ -2,22 +2,24 @@
|
|
2
2
|
|
3
3
|
module EditorJs
|
4
4
|
module Blocks
|
5
|
-
class
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
class MarkdownBlock < Base
|
6
|
+
class HTMLwithCodeRay < Redcarpet::Render::HTML
|
7
|
+
def block_code(code, language)
|
8
|
+
CodeRay.scan(code, language || :text).div(css: :class)
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def list_item(text, list_type)
|
12
|
+
if text.start_with?("[x]", "[X]")
|
13
|
+
text[0..2] = %(<input type='checkbox' checked='checked' disabled>)
|
14
|
+
elsif text.start_with?("[ ]")
|
15
|
+
text[0..2] = %(<input type='checkbox' disabled>)
|
16
|
+
end
|
17
|
+
%(<li>#{text}</li>)
|
15
18
|
end
|
16
|
-
%(<li>#{text}</li>)
|
17
19
|
end
|
18
|
-
end
|
19
20
|
|
20
|
-
|
21
|
+
def sanitize!; end
|
22
|
+
|
21
23
|
def schema
|
22
24
|
YAML.safe_load(<<~YAML)
|
23
25
|
type: object
|
data/lib/editor_js/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xiaohui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|