draftjs_html 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/draftjs_html/to_html.rb +12 -2
- data/lib/draftjs_html/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cfbca2f7dded1786a1532eae1dc2774163709592bd45b869d45c44f6115a3b1
|
4
|
+
data.tar.gz: 16a612e48e5144afc8e1a521067718c726a0df934cc0554493c1490bb5774080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4877c7deb8719962e759e5162a7b250f1ba048d1410e1f03617c503aa85117d5a7fbf83991fac79993b34c8618a746d7a1001dd7ea0d5700b6d949474fcaf0e7
|
7
|
+
data.tar.gz: 32ce13bad5ca0f65fd411eaccb4ab3a00e6e4dbe300f7464127a8b829e343153b2abdc757b05b1183734880e3c329bcdb6022d4d086d98dd2acc81fbfadf995a
|
data/lib/draftjs_html/to_html.rb
CHANGED
@@ -56,11 +56,21 @@ module DraftjsHtml
|
|
56
56
|
|
57
57
|
def append_child(nokogiri, child)
|
58
58
|
new_node = DraftjsHtml::Node.of(child).to_nokogiri(@document.doc)
|
59
|
-
|
60
|
-
nokogiri.parent['dir'] = 'rtl' if @current_bidi_direction.rtl?
|
59
|
+
apply_bidi_direction(new_node.inner_text, nokogiri)
|
61
60
|
nokogiri.parent.add_child(new_node)
|
62
61
|
end
|
63
62
|
|
63
|
+
def apply_bidi_direction(text, nokogiri)
|
64
|
+
@current_bidi_direction.update(text)
|
65
|
+
if @current_bidi_direction.rtl?
|
66
|
+
current_parent = nokogiri.parent
|
67
|
+
while current_parent.name != 'body'
|
68
|
+
current_parent['dir'] = 'rtl'
|
69
|
+
current_parent = current_parent.parent
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
64
74
|
def block_element_for(block)
|
65
75
|
return 'br' if block.blank?
|
66
76
|
|
data/lib/draftjs_html/version.rb
CHANGED