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
43918612
Commit
43918612
authored
Jan 09, 2023
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Jan 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert AnnotationShareControl to TS
parent
1e37192b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
19 deletions
+25
-19
AnnotationShareControl.tsx
src/sidebar/components/Annotation/AnnotationShareControl.tsx
+25
-19
No files found.
src/sidebar/components/Annotation/AnnotationShareControl.
js
→
src/sidebar/components/Annotation/AnnotationShareControl.
tsx
View file @
43918612
...
...
@@ -10,30 +10,36 @@ import {
import
classnames
from
'classnames'
;
import
{
useEffect
,
useRef
,
useState
}
from
'preact/hooks'
;
import
{
isIOS
}
from
'../../../shared/user-agent'
;
import
type
{
Annotation
,
Group
}
from
'../../../types/api'
;
import
{
isShareableURI
}
from
'../../helpers/annotation-sharing'
;
import
{
copyText
}
from
'../../util/copy-to-clipboard'
;
import
{
isPrivate
}
from
'../../helpers/permissions'
;
import
{
withServices
}
from
'../../service-context'
;
import
{
isIOS
}
from
'../../../shared/user-agent'
;
import
type
{
ToastMessengerService
}
from
'../../services/toast-messenger'
;
import
{
copyText
}
from
'../../util/copy-to-clipboard'
;
import
MenuArrow
from
'../MenuArrow'
;
import
ShareLinks
from
'../ShareLinks'
;
/**
* @typedef {import('../../../types/api').Annotation} Annotation
* @typedef {import('../../../types/api').Group} Group
*/
export
type
AnnotationShareControlProps
=
{
/** The annotation in question */
annotation
:
Annotation
;
/**
* @typedef AnnotationShareControlProps
* @prop {Annotation} annotation - The annotation in question
* @prop {Group} [group] -
* Group that the annotation is in. If missing, this component will not render.
* FIXME: Refactor after root cause is addressed.
* See https://github.com/hypothesis/client/issues/1542
* @prop {string} shareUri - The URI to view the annotation on its own
* @prop {import('../../services/toast-messenger').ToastMessengerService} toastMessenger
*/
/**
* Group that the annotation is in. If missing, this component will not
* render.
* FIXME: Refactor after root cause is addressed. See
* https://github.com/hypothesis/client/issues/1542
*/
group
?:
Group
;
/** The URI to view the annotation on its own */
shareUri
:
string
;
// Injected
toastMessenger
:
ToastMessengerService
;
};
function
selectionOverflowsInputElement
()
{
// On iOS the selection overflows the input element
...
...
@@ -51,11 +57,11 @@ function AnnotationShareControl({
toastMessenger
,
group
,
shareUri
,
})
{
}
:
AnnotationShareControlProps
)
{
const
annotationIsPrivate
=
isPrivate
(
annotation
.
permissions
);
const
inContextAvailable
=
isShareableURI
(
annotation
.
uri
);
const
shareRef
=
useRef
(
/** @type {HTMLDivElement|null} */
(
null
)
);
const
inputRef
=
useRef
(
/** @type {HTMLInputElement|null} */
(
null
)
);
const
inputRef
=
useRef
<
HTMLInputElement
|
null
>
(
null
);
const
shareRef
=
useRef
<
HTMLDivElement
|
null
>
(
null
);
const
[
isOpen
,
setOpen
]
=
useState
(
false
);
const
wasOpen
=
useRef
(
isOpen
);
...
...
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