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
4c9bdda1
Commit
4c9bdda1
authored
Feb 02, 2022
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revise comments for `frameForAnnotation`
parent
3ddf3cff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
frame-sync.js
src/sidebar/services/frame-sync.js
+7
-11
No files found.
src/sidebar/services/frame-sync.js
View file @
4c9bdda1
...
@@ -35,22 +35,18 @@ export function formatAnnot({ $tag, target, uri }) {
...
@@ -35,22 +35,18 @@ export function formatAnnot({ $tag, target, uri }) {
}
}
/**
/**
* Return the frame in `frames` which best matches `ann`.
* Return the frame which best matches an annotation.
*
* If there is a frame whose URL exactly matches the annotation, it will be
* returned. Otherwise the main frame will be returned. Currently this may fail
* to return the expected frame if an annotation was fetched from h that
* does not match one of the frame URIs. This can happen due to URI expansion /
* document equivalence in h.
*
*
* @param {Frame[]} frames
* @param {Frame[]} frames
* @param {Annotation} ann
* @param {Annotation} ann
*/
*/
function
frameForAnnotation
(
frames
,
ann
)
{
function
frameForAnnotation
(
frames
,
ann
)
{
// Choose the frame whose URL exactly matches this annotation. If there is
// none, we'll use the main frame.
//
// An annotation's URI may not match the frame URI. To handle these
// cases we'll need to either make separate search API calls for each
// frame, or get the backend to return information about which search
// URIs matched a frame.
//
// If there are multiple frames with a matching URI, we'll send it
// whichever one connected first, which is usually the main frame.
const
frame
=
frames
.
find
(
f
=>
f
.
uri
===
ann
.
uri
);
const
frame
=
frames
.
find
(
f
=>
f
.
uri
===
ann
.
uri
);
if
(
frame
)
{
if
(
frame
)
{
return
frame
;
return
frame
;
...
...
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