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
043e656a
Commit
043e656a
authored
May 27, 2015
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only reanchor when a pdf page has placeholders
parent
ab625c58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
pdf.coffee
h/static/scripts/annotator/plugin/pdf.coffee
+23
-20
No files found.
h/static/scripts/annotator/plugin/pdf.coffee
View file @
043e656a
...
...
@@ -59,28 +59,31 @@ class PDF extends Annotator.Plugin
return
new
Promise
(
raf
).
then
(
waitForTextLayer
)
reanchor
=
->
placeholder
=
page
.
el
.
getElementsByClassName
(
'annotator-placeholder'
)[
0
]
unless
placeholder
?
return
unanchored
=
unanchored
.
splice
(
0
,
unanchored
.
length
)
placeholder
=
page
.
el
.
getElementsByClassName
(
'annotator-placeholder'
)[
0
]
if
placeholder
?
unchanged
=
[]
for
info
in
anchored
attempt
=
false
for
hl
in
info
.
highlights
if
placeholder
.
contains
(
hl
)
attempt
=
true
break
if
attempt
highlighter
.
removeHighlights
(
info
.
highlights
)
delete
info
.
highlights
unanchored
.
push
(
info
)
else
unchanged
.
push
(
info
)
anchored
.
splice
(
0
,
anchored
.
length
,
unchanged
...)
page
.
el
.
removeChild
(
placeholder
)
unchanged
=
[]
for
info
in
anchored
attempt
=
false
for
hl
in
info
.
highlights
if
placeholder
.
contains
(
hl
)
attempt
=
true
break
if
attempt
highlighter
.
removeHighlights
(
info
.
highlights
)
delete
info
.
highlights
unanchored
.
push
(
info
)
else
unchanged
.
push
(
info
)
anchored
.
splice
(
0
,
anchored
.
length
,
unchanged
...)
page
.
el
.
removeChild
(
placeholder
)
for
obj
in
unanchored
annotator
.
setupAnnotation
(
obj
.
annotation
)
...
...
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