From a50e2fb0f12838673543131c02e7ca37fe4b66fb Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 27 Dec 2019 15:08:55 -0500 Subject: Fix furigana segmentation --- ext/mixed/js/display-generator.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext/mixed') 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); -- cgit v1.2.3