Fix linting errors and update changelog

This commit is contained in:
JC Brand 2020-01-07 15:58:46 +01:00
parent 995f2a9997
commit 0524352446
3 changed files with 17 additions and 20 deletions

View File

@ -4,6 +4,7 @@
- [enable_smacks](https://conversejs.org/docs/html/configuration.html#enable-smacks) is not set to `true` by default.
- Refactor some presence and status handling code from `converse-core` into `@converse/headless/converse-status`.
- It's now possible to navigate the emoji-picker via the keyboard arrow keys.
- Add support for [notifications about affiliation change for users not in a room](https://xmpp.org/extensions/xep-0045.html#example-196)
- Add support for [XEP-0424 Message Retraction](http://localhost:3080/extensions/xep-0424.html)

View File

@ -327,9 +327,6 @@ converse.plugins.add('converse-emoji-views', {
ev.preventDefault();
ev.stopPropagation();
ev.target.blur();
const category = this.model.get('current_category');
// If there's no category, we're viewing search results.
const selector = category ? `ul[data-category="${category}"]` : 'ul';
this.disableArrowNavigation();
this.navigator.enable();
this.navigator.handleKeydown(ev);

View File

@ -4,7 +4,6 @@
* This module started as a fork of Rubens Mariuzzo's dom-navigator.
* @copyright Rubens Mariuzzo, JC Brand
*/
import log from "@converse/headless/log";
import u from './utils/html';
@ -105,6 +104,22 @@ class DOMNavigator {
};
}
static getClosestElement (els, getDistance) {
const next = els.reduce((prev, curr) => {
const current_distance = getDistance(curr);
if (current_distance < prev.distance) {
return {
distance: current_distance,
element: curr
};
}
return prev;
}, {
distance: Infinity
});
return next.element;
}
/**
* Create a new DOM Navigator.
* @param { Element } container The container of the element to navigate.
@ -189,22 +204,6 @@ class DOMNavigator {
}
}
getClosestElement (els, getDistance) {
const next = els.reduce((prev, curr) => {
const current_distance = getDistance(curr);
if (current_distance < prev.distance) {
return {
distance: current_distance,
element: curr
};
}
return prev;
}, {
distance: Infinity
});
return next.element;
}
/**
* @method DOMNavigator#getNextElement
* @param {'down'|'right'|'left'|'up'} direction