File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
app/server/static/components Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,8 @@ export default {
58
58
mixins: [annotationMixin],
59
59
60
60
methods: {
61
- isIn (label ) {
62
- for (let i = 0 ; i < this .annotations [this .pageNumber ].length ; i++ ) {
63
- const a = this .annotations [this .pageNumber ][i];
64
- if (a .label === label .id ) {
65
- return a;
66
- }
67
- }
68
- return false ;
61
+ getAnnotation (label ) {
62
+ return this .annotations [this .pageNumber ].find (annotation => annotation .label === label .id );
69
63
},
70
64
71
65
async submit () {
@@ -76,9 +70,9 @@ export default {
76
70
},
77
71
78
72
async addLabel (label ) {
79
- const a = this .isIn (label);
80
- if (a ) {
81
- this .removeLabel (a );
73
+ const annotation = this .getAnnotation (label);
74
+ if (annotation ) {
75
+ this .removeLabel (annotation );
82
76
} else {
83
77
const docId = this .docs [this .pageNumber ].id ;
84
78
const payload = {
You can’t perform that action at this time.
0 commit comments