@@ -57,19 +57,21 @@ function AnnotationEditor({
57
57
const isEmpty = ! text && ! tags . length ;
58
58
59
59
const onEditTags = useCallback (
60
+ /** @param {string[] } tags */
60
61
tags => {
61
62
store . createDraft ( draft . annotation , { ...draft , tags } ) ;
62
63
} ,
63
64
[ draft , store ]
64
65
) ;
65
66
66
- /**
67
- * Verify `newTag` has content and is not a duplicate; add the tag
68
- *
69
- * @param {string } newTag
70
- * @return {boolean } - `true` if tag is added
71
- */
72
67
const onAddTag = useCallback (
68
+ /**
69
+ * Verify `newTag` has content and is not a duplicate; add the tag
70
+ *
71
+ * @param {string } newTag
72
+ * @return {boolean } Tag was added to the draft's tags; `false` if duplicate
73
+ * or empty
74
+ */
73
75
newTag => {
74
76
if ( ! newTag || tags . indexOf ( newTag ) >= 0 ) {
75
77
// don't add empty or duplicate tags
@@ -84,13 +86,13 @@ function AnnotationEditor({
84
86
[ onEditTags , tags , tagsService ]
85
87
) ;
86
88
87
- /**
88
- * Remove a tag from the annotation.
89
- *
90
- * @param {string } tag
91
- * @return {boolean } - `true` if tag extant and removed
92
- */
93
89
const onRemoveTag = useCallback (
90
+ /**
91
+ * Remove tag from draft if present.
92
+ *
93
+ * @param {string } tag
94
+ * @return {boolean } Tag removed from draft
95
+ */
94
96
tag => {
95
97
const newTagList = [ ...tags ] ; // make a copy
96
98
const index = newTagList . indexOf ( tag ) ;
@@ -115,6 +117,7 @@ function AnnotationEditor({
115
117
* @param {boolean } isPrivate
116
118
*/
117
119
const onSetPrivate = useCallback (
120
+ /** @param {boolean } isPrivate */
118
121
isPrivate => {
119
122
store . createDraft ( annotation , {
120
123
...draft ,
0 commit comments