Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
b83bb95e
Commit
b83bb95e
authored
Apr 06, 2022
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a couple of explanatory comments
parent
11ac17b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
pdf.js
src/annotator/anchoring/pdf.js
+4
-0
No files found.
src/annotator/anchoring/pdf.js
View file @
b83bb95e
...
@@ -431,6 +431,8 @@ async function anchorQuote(quoteSelector, positionHint) {
...
@@ -431,6 +431,8 @@ async function anchorQuote(quoteSelector, positionHint) {
if
(
page
<
expectedPageIndex
)
{
if
(
page
<
expectedPageIndex
)
{
strippedHint
=
strippedText
.
length
;
// Prefer matches closer to end of page.
strippedHint
=
strippedText
.
length
;
// Prefer matches closer to end of page.
}
else
if
(
page
===
expectedPageIndex
)
{
}
else
if
(
page
===
expectedPageIndex
)
{
// Translate expected offset in whitespace-inclusive version of page
// text into offset in whitespace-stripped version of page text.
[
strippedHint
]
=
translateOffsets
(
[
strippedHint
]
=
translateOffsets
(
text
,
text
,
strippedText
,
strippedText
,
...
@@ -454,6 +456,8 @@ async function anchorQuote(quoteSelector, positionHint) {
...
@@ -454,6 +456,8 @@ async function anchorQuote(quoteSelector, positionHint) {
}
}
if
(
!
bestMatch
||
match
.
score
>
bestMatch
.
match
.
score
)
{
if
(
!
bestMatch
||
match
.
score
>
bestMatch
.
match
.
score
)
{
// Translate match offset from whitespace-stripped version of page text
// back to original text.
const
[
start
,
end
]
=
translateOffsets
(
const
[
start
,
end
]
=
translateOffsets
(
strippedText
,
strippedText
,
text
,
text
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment