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
935594b9
Commit
935594b9
authored
Dec 11, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve `TextQuoteAnchor` JSDoc and remove obsolete lint suppression
parent
f307c817
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
types.js
src/annotator/anchoring/types.js
+11
-7
No files found.
src/annotator/anchoring/types.js
View file @
935594b9
...
@@ -133,6 +133,11 @@ export class TextPositionAnchor {
...
@@ -133,6 +133,11 @@ export class TextPositionAnchor {
}
}
}
}
/**
* @typedef QuoteMatchOptions
* @prop {number} [hint] - Expected position of match in text. See `matchQuote`.
*/
/**
/**
* Converts between `TextQuoteSelector` selectors and `Range` objects.
* Converts between `TextQuoteSelector` selectors and `Range` objects.
*/
*/
...
@@ -151,6 +156,10 @@ export class TextQuoteAnchor {
...
@@ -151,6 +156,10 @@ export class TextQuoteAnchor {
}
}
/**
/**
* Create a `TextQuoteAnchor` from a range.
*
* Will throw if `range` does not contain any text nodes.
*
* @param {Element} root
* @param {Element} root
* @param {Range} range
* @param {Range} range
*/
*/
...
@@ -200,21 +209,16 @@ export class TextQuoteAnchor {
...
@@ -200,21 +209,16 @@ export class TextQuoteAnchor {
}
}
/**
/**
* @param {Object} [options]
* @param {QuoteMatchOptions} [options]
* @param {number} [options.hint] -
* Offset hint to disambiguate matches
*/
*/
toRange
(
options
=
{})
{
toRange
(
options
=
{})
{
return
this
.
toPositionAnchor
(
options
).
toRange
();
return
this
.
toPositionAnchor
(
options
).
toRange
();
}
}
/**
/**
* @param {Object} [options]
* @param {QuoteMatchOptions} [options]
* @param {number} [options.hint] -
* Character offset hint to disambiguate matches.
*/
*/
toPositionAnchor
(
options
=
{})
{
toPositionAnchor
(
options
=
{})
{
// eslint-disable-line no-unused-vars
const
text
=
/** @type {string} */
(
this
.
root
.
textContent
);
const
text
=
/** @type {string} */
(
this
.
root
.
textContent
);
const
match
=
matchQuote
(
text
,
this
.
exact
,
{
const
match
=
matchQuote
(
text
,
this
.
exact
,
{
...
this
.
context
,
...
this
.
context
,
...
...
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