summaryrefslogtreecommitdiff
path: root/ext/fg/js/util.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-04-06 21:07:55 -0700
committerAlex Yatskov <alex@foosoft.net>2017-04-06 21:07:55 -0700
commitbbe4afecf6a56f4bdaaafe083a3bf67191fd9cde (patch)
tree2aaecfd3ab5dea3d4a9ca8071dd801c28fa2ebb6 /ext/fg/js/util.js
parente6b592b4c06ee18017a03bb5148e2c4b64deb146 (diff)
wip
Diffstat (limited to 'ext/fg/js/util.js')
-rw-r--r--ext/fg/js/util.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js
index a1bce660..59060221 100644
--- a/ext/fg/js/util.js
+++ b/ext/fg/js/util.js
@@ -205,14 +205,10 @@ function docClozeExtract(source, extent) {
}
const sentence = content.substring(startPos, endPos);
- const clozePrefix = sentence.substring(0, position - startPos);
- const clozeBody = source.text();
- const clozeSuffix = sentence.substring(position - startPos + clozeBody.length);
+ const padding = sentence.length - sentence.replace(/^\s+/, '');
return {
sentence: sentence.trim(),
- prefix: clozePrefix.trim(),
- body: clozeBody.trim(),
- suffix: clozeSuffix.trim()
+ offset: position - startPos - padding
};
}