aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-27 15:08:55 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-16 22:39:26 -0500
commita50e2fb0f12838673543131c02e7ca37fe4b66fb (patch)
treebb8c848a5881121a708135ce7f52d9de7f4c266c /ext/mixed/js
parent56ee7f8df47a3826e10d9b0876f313f5ced4c98e (diff)
Fix furigana segmentation
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display-generator.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js
index 37be5041..1921a454 100644
--- a/ext/mixed/js/display-generator.js
+++ b/ext/mixed/js/display-generator.js
@@ -76,8 +76,12 @@ class DisplayGenerator {
}
if (expressionContainer !== null) {
- const segments = [{text: details.expression, furigana: details.reading}]; // TODO : Use proper furigana segmentation
- DisplayGenerator._appendFurigana(expressionContainer, segments, this._appendKanjiLinks.bind(this));
+ let furiganaSegments = details.furiganaSegments;
+ if (!Array.isArray(furiganaSegments)) {
+ // This case should not occur
+ furiganaSegments = [{text: details.expression, furigana: details.reading}];
+ }
+ DisplayGenerator._appendFurigana(expressionContainer, furiganaSegments, this._appendKanjiLinks.bind(this));
}
DisplayGenerator._appendMultiple(tagContainer, this.createTag.bind(this), details.termTags);