Fix sidebar's focusing on annotation cards
When the user moves the mouse over a highlight in the document, the corresponding annotation card (in the sidebar) is supposed to be highlighted, to indicate focus. Our mechanism for this was broken in 3 different ways: 1. AnnotationUI service's focusAnnotations() method was working with annotation IDs. However, annotations being created right now don't yet have ID, only tags. So we should be working with tags instead. (Like we are, in many other cases when cross-frame communication communication is done around annotations.) I fixed that, and also updated the corresponding tests. 2. In controllers.coffee, when we were trying to check if a given annotation has focus, we were using the tag value, while on the other hand, it was not the tag, but the id that was put into the map. Of course this didn't work. Since now we are consistently using the tag, no change was needed here. 3. We are putting $$tag:true pairs into the map, but when checking for membership, the `in` operator was used. That works for lists, but not for maps. For maps, we simply have to read out the value belonging to the given key, and see if it's true. After fixing these problems, the feature works again.
Showing
Please register or sign in to comment