draftjs_exporter 0.0.6 → 0.0.7
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/lib/draftjs_exporter/html.rb +2 -2
- data/lib/draftjs_exporter/version.rb +1 -1
- data/lib/draftjs_exporter/wrapper_state.rb +5 -1
- data/spec/integrations/html_spec.rb +34 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77ac3686aa905cad61a246edfd3c853293413e25
|
4
|
+
data.tar.gz: bc764c7e0e564495cb89f5ebe79baa546df27d2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51027a8329447faf3002bf98d3004ed4a8609d51fecd9450da69c21cfbe80586f24cd408e923352259ef42e37a0854a9449b274e38d0059def2308306af12a15
|
7
|
+
data.tar.gz: ebd0833ffe6b115969081c62fedde57b2906f860b8cc476a5ac99110c710663ae156d19c01f7209181f7eb6ca60065137dadcb6c16de08151f34aa6b06980148
|
@@ -15,14 +15,14 @@ module DraftjsExporter
|
|
15
15
|
@entity_decorators = entity_decorators
|
16
16
|
end
|
17
17
|
|
18
|
-
def call(content_state)
|
18
|
+
def call(content_state, options = {})
|
19
19
|
wrapper_state = WrapperState.new(block_map)
|
20
20
|
content_state.fetch(:blocks, []).each do |block|
|
21
21
|
element = wrapper_state.element_for(block)
|
22
22
|
entity_map = content_state.fetch(:entityMap, {})
|
23
23
|
block_contents(element, block, entity_map)
|
24
24
|
end
|
25
|
-
wrapper_state.
|
25
|
+
wrapper_state.to_html(options)
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
@@ -239,5 +239,39 @@ RSpec.describe DraftjsExporter::HTML do
|
|
239
239
|
expect(mapper.call(input)).to eq(expected_output)
|
240
240
|
end
|
241
241
|
end
|
242
|
+
|
243
|
+
context 'with UTF-8 encoding' do
|
244
|
+
it 'leaves non-latin letters as-is' do
|
245
|
+
input = {
|
246
|
+
entityMap: {},
|
247
|
+
blocks: [
|
248
|
+
{
|
249
|
+
key: 'ckf8d',
|
250
|
+
text: 'Russian: Привет, мир!',
|
251
|
+
type: 'unordered-list-item',
|
252
|
+
depth: 0,
|
253
|
+
inlineStyleRanges: [],
|
254
|
+
entityRanges: [],
|
255
|
+
data: {}
|
256
|
+
},
|
257
|
+
{
|
258
|
+
key: 'fi809',
|
259
|
+
text: 'Japanese: 曖昧さ回避',
|
260
|
+
type: 'unordered-list-item',
|
261
|
+
depth: 0,
|
262
|
+
inlineStyleRanges: [],
|
263
|
+
entityRanges: [],
|
264
|
+
data: {}
|
265
|
+
}
|
266
|
+
]
|
267
|
+
}
|
268
|
+
|
269
|
+
expected_output = <<-OUTPUT.strip
|
270
|
+
<ul class=\"public-DraftStyleDefault-ul\">\n<li>Russian: Привет, мир!</li>\n<li>Japanese: 曖昧さ回避</li>\n</ul>
|
271
|
+
OUTPUT
|
272
|
+
|
273
|
+
expect(mapper.call(input, encoding: 'UTF-8')).to eq(expected_output)
|
274
|
+
end
|
275
|
+
end
|
242
276
|
end
|
243
277
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draftjs_exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Cushion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.6.11
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: Export Draft.js content state into HTML
|