aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/mixed/js/display.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 21d00bbc..f231fab5 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -633,18 +633,13 @@ class Display {
return index >= 0 && index < entries.length ? entries[index] : null;
}
- static clozeBuild(sentence, source) {
- const result = {
- sentence: sentence.text.trim()
+ static clozeBuild({text, offset}, source) {
+ return {
+ sentence: text.trim(),
+ prefix: text.substring(0, offset).trim(),
+ body: text.substring(offset, offset + source.length),
+ suffix: text.substring(offset + source.length).trim()
};
-
- if (source) {
- result.prefix = sentence.text.substring(0, sentence.offset).trim();
- result.body = sentence.text.substring(sentence.offset, sentence.offset + source.length);
- result.suffix = sentence.text.substring(sentence.offset + source.length).trim();
- }
-
- return result;
}
entryIndexFind(element) {