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
90af4bb7
Commit
90af4bb7
authored
Feb 07, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Feb 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate placeholder module to TypeScript
parent
aa5e4097
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
placeholder.ts
src/annotator/anchoring/placeholder.ts
+6
-12
No files found.
src/annotator/anchoring/placeholder.
j
s
→
src/annotator/anchoring/placeholder.
t
s
View file @
90af4bb7
...
...
@@ -16,10 +16,10 @@ const placeholderSelector = '.annotator-placeholder';
* When the viewport is scrolled to the non-rendered page, the placeholder
* is removed and annotations are re-anchored to the real content.
*
* @param
{HTMLElement} container - The container element for the page or tile
*
which is not
rendered.
* @param
container - The container element for the page or tile which is not
* rendered.
*/
export
function
createPlaceholder
(
container
)
{
export
function
createPlaceholder
(
container
:
HTMLElement
)
{
let
placeholder
=
container
.
querySelector
(
placeholderSelector
);
if
(
placeholder
)
{
return
placeholder
;
...
...
@@ -33,19 +33,15 @@ export function createPlaceholder(container) {
/**
* Return true if a page/tile container has a placeholder.
*
* @param {HTMLElement} container
*/
export
function
hasPlaceholder
(
container
)
{
export
function
hasPlaceholder
(
container
:
HTMLElement
):
boolean
{
return
container
.
querySelector
(
placeholderSelector
)
!==
null
;
}
/**
* Remove the placeholder element in `container`, if present.
*
* @param {HTMLElement} container
*/
export
function
removePlaceholder
(
container
)
{
export
function
removePlaceholder
(
container
:
HTMLElement
)
{
container
.
querySelector
(
placeholderSelector
)?.
remove
();
}
...
...
@@ -54,10 +50,8 @@ export function removePlaceholder(container) {
*
* This is typically used to test if a highlight element associated with an
* anchor is inside a placeholder.
*
* @param {Node} node
*/
export
function
isInPlaceholder
(
node
)
{
export
function
isInPlaceholder
(
node
:
Node
):
boolean
{
if
(
!
node
.
parentElement
)
{
return
false
;
}
...
...
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