commit
a24146538c
@ -422,7 +422,7 @@ class Display {
|
||||
};
|
||||
|
||||
for (const definition of definitions) {
|
||||
definition.cloze = Display.clozeBuild(context.sentence);
|
||||
definition.cloze = Display.clozeBuild(context.sentence, definition.character);
|
||||
definition.url = context.url;
|
||||
}
|
||||
|
||||
@ -686,18 +686,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 = source.trim();
|
||||
result.suffix = sentence.text.substring(sentence.offset + source.length).trim();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
entryIndexFind(element) {
|
||||
|
Loading…
Reference in New Issue
Block a user