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
d00ff041
Commit
d00ff041
authored
Apr 25, 2021
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor `scrollToAnnotation` handler to reduce nesting
parent
a0367a19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
guest.js
src/annotator/guest.js
+18
-19
No files found.
src/annotator/guest.js
View file @
d00ff041
...
@@ -293,25 +293,24 @@ export default class Guest {
...
@@ -293,25 +293,24 @@ export default class Guest {
});
});
this
.
crossframe
.
on
(
'scrollToAnnotation'
,
tag
=>
{
this
.
crossframe
.
on
(
'scrollToAnnotation'
,
tag
=>
{
for
(
let
anchor
of
this
.
anchors
)
{
const
anchor
=
this
.
anchors
.
find
(
a
=>
a
.
annotation
.
$tag
===
tag
);
if
(
anchor
.
highlights
)
{
if
(
!
anchor
?.
highlights
)
{
if
(
anchor
.
annotation
.
$tag
===
tag
)
{
return
;
const
range
=
resolveAnchor
(
anchor
);
}
if
(
!
range
)
{
const
range
=
resolveAnchor
(
anchor
);
continue
;
if
(
!
range
)
{
}
return
;
}
const
event
=
new
CustomEvent
(
'scrolltorange'
,
{
bubbles
:
true
,
const
event
=
new
CustomEvent
(
'scrolltorange'
,
{
cancelable
:
true
,
bubbles
:
true
,
detail
:
range
,
cancelable
:
true
,
});
detail
:
range
,
const
defaultNotPrevented
=
this
.
element
.
dispatchEvent
(
event
);
});
if
(
defaultNotPrevented
)
{
const
defaultNotPrevented
=
this
.
element
.
dispatchEvent
(
event
);
scrollIntoView
(
anchor
.
highlights
[
0
]);
}
if
(
defaultNotPrevented
)
{
}
scrollIntoView
(
anchor
.
highlights
[
0
]);
}
}
}
});
});
...
...
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