richer_text 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/richer_text/html_visitor.rb +14 -1
- data/lib/richer_text/node.rb +1 -1
- data/lib/richer_text/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: e5520f0457b69a555273d7a738f5257a0951eef4d65153ad783cd2f31246daad
|
4
|
+
data.tar.gz: d4978b9880b46a6af9a91868cdbf40ae8306d3dd749c6ec94631e6999820af89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faca362e8db800731ec19ade535551664f5bcc2f379e80283229f536a8b06608a6601d50c4672e02394c650f178ec5697244e14adfca4f0a701ec4bba1ca4846
|
7
|
+
data.tar.gz: 4662002c357fee3d91db0b96236c2d314c0551ecbc916a41f6e1c3dea63a5a5d30ab3208045160936b312500a72295d26aed2b59b2c487855431c69f5bf5da6a
|
@@ -89,7 +89,7 @@ module RicherText
|
|
89
89
|
if marks.empty?
|
90
90
|
node.text
|
91
91
|
else
|
92
|
-
content_tag(marks[0].tag, visit_text(node, marks[1..]), marks[0]
|
92
|
+
content_tag(marks[0].tag, visit_text(node, marks[1..]), parse_mark_attrs(marks[0]))
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -118,5 +118,18 @@ module RicherText
|
|
118
118
|
def node_previewable?(node)
|
119
119
|
node.attrs["contentType"].match(previewable_regex)
|
120
120
|
end
|
121
|
+
|
122
|
+
def parse_mark_attrs(mark)
|
123
|
+
attrs = mark.attrs
|
124
|
+
tag = mark.tag
|
125
|
+
|
126
|
+
if attrs.dig("color").present? && tag == "mark"
|
127
|
+
attrs.merge(style: "background-color: #{attrs["color"]};")
|
128
|
+
elsif attrs.dig("color").present? && tag == "span"
|
129
|
+
attrs.merge(style: "color: #{attrs["color"]};")
|
130
|
+
else
|
131
|
+
attrs
|
132
|
+
end
|
133
|
+
end
|
121
134
|
end
|
122
135
|
end
|
data/lib/richer_text/node.rb
CHANGED
data/lib/richer_text/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: richer_text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Fomera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|