draftjs_html 0.15.0 → 0.16.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 770a91eea2ce6ff069f3ccf80d8d9857e15ea8882cfd7a426fe9b8aea2b6ca4e
|
4
|
+
data.tar.gz: 1dfef55358fb964b0a6ac6c98458b1d04a59c0e115c11a2d32a5f4042c747777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0830e5b529717b67fd2dbdd2627c53e68332bbc66601e6b405ecd60d993aef9eca797211bfc442c95c6cf00d9996d65b22cdacd12982094b4d3c33f04e86f0c2'
|
7
|
+
data.tar.gz: 47f94740645254e51675033bcb1d23d331eaa054d0d73382d689e4d10e18441177622b8fb9d66d51008c06f3d432eda1809014fd541ae2f52fa1b5d5d5905c9b
|
@@ -54,9 +54,14 @@ module DraftjsHtml
|
|
54
54
|
while current.pending_entities.any?
|
55
55
|
pending_entity = current.pending_entities.pop
|
56
56
|
range = pending_entity[:start]..current_character_offset
|
57
|
-
|
57
|
+
content = current_text_buffer[range]
|
58
|
+
user_created_entity = conversion.call(pending_entity[:tagname], content, pending_entity[:attrs])
|
58
59
|
next unless user_created_entity
|
59
60
|
|
61
|
+
if content == '' && !user_created_entity[:atomic]
|
62
|
+
current.text_buffer << ' '
|
63
|
+
range = range.begin..(range.end+1)
|
64
|
+
end
|
60
65
|
current.entities << user_created_entity.merge(start: range.begin, finish: range.end)
|
61
66
|
end
|
62
67
|
end
|
@@ -39,7 +39,7 @@ module DraftjsHtml
|
|
39
39
|
def flush_to(draftjs, styles)
|
40
40
|
if text_buffer.any?
|
41
41
|
chars.join.lines.each do |line|
|
42
|
-
draftjs.typed_block(block_name, line.
|
42
|
+
draftjs.typed_block(block_name, line.chomp, depth: [depth, 0].max)
|
43
43
|
end
|
44
44
|
|
45
45
|
styles.each do |descriptor|
|
@@ -57,10 +57,7 @@ module DraftjsHtml
|
|
57
57
|
range = entity[:start]..entity[:finish]
|
58
58
|
if entity[:atomic]
|
59
59
|
draftjs.typed_block('atomic', ' ', depth: [depth, 0].max)
|
60
|
-
range = 0..
|
61
|
-
elsif range.size < 1
|
62
|
-
draftjs.typed_block('atomic', ' ', depth: [depth, 0].max) unless draftjs.has_blocks?
|
63
|
-
range = (range.begin..range.end + 1)
|
60
|
+
range = 0..0
|
64
61
|
end
|
65
62
|
|
66
63
|
draftjs.apply_entity entity[:type], range, data: entity[:data], mutability: entity.fetch(:mutability, 'IMMUTABLE')
|
@@ -44,7 +44,7 @@ module DraftjsHtml
|
|
44
44
|
|
45
45
|
ENTITY_CONVERSION_MAP = {
|
46
46
|
'LINK' => ->(entity, content, *) {
|
47
|
-
attributes = entity.data.slice('url', 'rel', 'target', 'title', 'className').each_with_object({}) do |(attr, value), h|
|
47
|
+
attributes = entity.data.slice('url', 'href', 'rel', 'target', 'title', 'className').each_with_object({}) do |(attr, value), h|
|
48
48
|
h[ENTITY_ATTRIBUTE_NAME_MAP.fetch(attr, attr)] = value
|
49
49
|
end
|
50
50
|
|
data/lib/draftjs_html/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draftjs_html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TJ Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|