Various JSDoc related fixes and improvements
Using the `@method` directive on a `@class` means that the method doesn't appear.
This commit is contained in:
parent
b44c0c266c
commit
c6f8ef0c46
@ -55,8 +55,7 @@ function absoluteOffsetLeft(el) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the ability to navigate the DOM with the arrow keys
|
* Adds the ability to navigate the DOM with the arrow keys
|
||||||
* @class
|
* @class DOMNavigator
|
||||||
* @namespace DOMNavigator
|
|
||||||
*/
|
*/
|
||||||
class DOMNavigator {
|
class DOMNavigator {
|
||||||
/**
|
/**
|
||||||
@ -162,7 +161,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the navigator.
|
* Initialize the navigator.
|
||||||
* @method DOMNavigator#init
|
|
||||||
*/
|
*/
|
||||||
init () {
|
init () {
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
@ -180,7 +178,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable this navigator.
|
* Enable this navigator.
|
||||||
* @method DOMNavigator#enable
|
|
||||||
*/
|
*/
|
||||||
enable () {
|
enable () {
|
||||||
this.getElements();
|
this.getElements();
|
||||||
@ -191,7 +188,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable this navigator.
|
* Disable this navigator.
|
||||||
* @method DOMNavigator#disable
|
|
||||||
*/
|
*/
|
||||||
disable () {
|
disable () {
|
||||||
if (this.keydownHandler) {
|
if (this.keydownHandler) {
|
||||||
@ -204,7 +200,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy this navigator removing any event registered and any other data.
|
* Destroy this navigator removing any event registered and any other data.
|
||||||
* @method DOMNavigator#destroy
|
|
||||||
*/
|
*/
|
||||||
destroy () {
|
destroy () {
|
||||||
this.disable();
|
this.disable();
|
||||||
@ -214,7 +209,6 @@ class DOMNavigator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method DOMNavigator#getNextElement
|
|
||||||
* @param {'down'|'right'|'left'|'up'} direction
|
* @param {'down'|'right'|'left'|'up'} direction
|
||||||
* @returns { HTMLElement }
|
* @returns { HTMLElement }
|
||||||
*/
|
*/
|
||||||
@ -266,7 +260,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Select the given element.
|
* Select the given element.
|
||||||
* @method DOMNavigator#select
|
|
||||||
* @param { Element } el The DOM element to select.
|
* @param { Element } el The DOM element to select.
|
||||||
* @param { string } [direction] The direction.
|
* @param { string } [direction] The direction.
|
||||||
*/
|
*/
|
||||||
@ -287,7 +280,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the current selection
|
* Remove the current selection
|
||||||
* @method DOMNavigator#unselect
|
|
||||||
*/
|
*/
|
||||||
unselect () {
|
unselect () {
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
@ -298,7 +290,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scroll the container to an element.
|
* Scroll the container to an element.
|
||||||
* @method DOMNavigator#scrollTo
|
|
||||||
* @param { HTMLElement } el The destination element.
|
* @param { HTMLElement } el The destination element.
|
||||||
* @param { String } direction The direction of the current navigation.
|
* @param { String } direction The direction of the current navigation.
|
||||||
* @return void.
|
* @return void.
|
||||||
@ -345,7 +336,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate if an element is in the container viewport.
|
* Indicate if an element is in the container viewport.
|
||||||
* @method DOMNavigator#inScrollContainerViewport
|
|
||||||
* @param { HTMLElement } el The element to check.
|
* @param { HTMLElement } el The element to check.
|
||||||
* @return { Boolean } true if the given element is in the container viewport, otherwise false.
|
* @return { Boolean } true if the given element is in the container viewport, otherwise false.
|
||||||
*/
|
*/
|
||||||
@ -372,7 +362,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find and store the navigable elements
|
* Find and store the navigable elements
|
||||||
* @method DOMNavigator#getElements
|
|
||||||
*/
|
*/
|
||||||
getElements (direction) {
|
getElements (direction) {
|
||||||
const selector = this.options.getSelector ? this.options.getSelector(direction) : this.options.selector;
|
const selector = this.options.getSelector ? this.options.getSelector(direction) : this.options.selector;
|
||||||
@ -384,7 +373,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of navigable elements after an offset.
|
* Return an array of navigable elements after an offset.
|
||||||
* @method DOMNavigator#elementsAfter
|
|
||||||
* @param { number } left The left offset.
|
* @param { number } left The left offset.
|
||||||
* @param { number } top The top offset.
|
* @param { number } top The top offset.
|
||||||
* @return { Array } An array of elements.
|
* @return { Array } An array of elements.
|
||||||
@ -395,7 +383,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of navigable elements before an offset.
|
* Return an array of navigable elements before an offset.
|
||||||
* @method DOMNavigator#elementsBefore
|
|
||||||
* @param { number } left The left offset.
|
* @param { number } left The left offset.
|
||||||
* @param { number } top The top offset.
|
* @param { number } top The top offset.
|
||||||
* @return { Array } An array of elements.
|
* @return { Array } An array of elements.
|
||||||
@ -406,7 +393,6 @@ class DOMNavigator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the key down event.
|
* Handle the key down event.
|
||||||
* @method DOMNavigator#handleKeydown
|
|
||||||
* @param { Event } event The event object.
|
* @param { Event } event The event object.
|
||||||
*/
|
*/
|
||||||
handleKeydown (ev) {
|
handleKeydown (ev) {
|
||||||
|
@ -6,11 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
import "./converse-disco";
|
import "./converse-disco";
|
||||||
import "./converse-rsm";
|
import "./converse-rsm";
|
||||||
|
import { api } from "@converse/headless/converse-core";
|
||||||
import { intersection, pick } from 'lodash'
|
import { intersection, pick } from 'lodash'
|
||||||
import { converse } from "./converse-core";
|
import { converse } from "./converse-core";
|
||||||
import log from "./log";
|
import log from "./log";
|
||||||
import sizzle from "sizzle";
|
import sizzle from "sizzle";
|
||||||
|
|
||||||
|
let _converse;
|
||||||
const { Strophe, $iq, dayjs } = converse.env;
|
const { Strophe, $iq, dayjs } = converse.env;
|
||||||
const u = converse.env.utils;
|
const u = converse.env.utils;
|
||||||
|
|
||||||
@ -18,24 +20,10 @@ const u = converse.env.utils;
|
|||||||
const MAM_ATTRIBUTES = ['with', 'start', 'end'];
|
const MAM_ATTRIBUTES = ['with', 'start', 'end'];
|
||||||
|
|
||||||
|
|
||||||
converse.plugins.add('converse-mam', {
|
/**
|
||||||
|
* The MUC utils object. Contains utility functions related to multi-user chat.
|
||||||
dependencies: ['converse-rsm', 'converse-disco', 'converse-muc'],
|
* @mixin MAMEnabledChat
|
||||||
|
|
||||||
|
|
||||||
initialize () {
|
|
||||||
/* The initialize function gets called as soon as the plugin is
|
|
||||||
* loaded by Converse.js's plugin machinery.
|
|
||||||
*/
|
*/
|
||||||
const { _converse } = this;
|
|
||||||
const { api } = _converse;
|
|
||||||
|
|
||||||
api.settings.update({
|
|
||||||
archived_messages_page_size: '50',
|
|
||||||
message_archiving: undefined, // Supported values are 'always', 'never', 'roster' (https://xmpp.org/extensions/xep-0313.html#prefs)
|
|
||||||
message_archiving_timeout: 20000, // Time (in milliseconds) to wait before aborting MAM request
|
|
||||||
});
|
|
||||||
|
|
||||||
const MAMEnabledChat = {
|
const MAMEnabledChat = {
|
||||||
/**
|
/**
|
||||||
* Fetches messages that might have been archived *after*
|
* Fetches messages that might have been archived *after*
|
||||||
@ -98,6 +86,11 @@ converse.plugins.add('converse-mam', {
|
|||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
const result = await api.archive.query(query);
|
const result = await api.archive.query(query);
|
||||||
|
/**
|
||||||
|
* *Hook* which allows plugins to inspect and potentially modify the result of a MAM query
|
||||||
|
* from {@link MAMEnabledChat.fetchArchivedMessages}.
|
||||||
|
* @event _converse#MAMResult
|
||||||
|
*/
|
||||||
api.hook('MAMResult', this, { result, query });
|
api.hook('MAMResult', this, { result, query });
|
||||||
|
|
||||||
for (const message of result.messages) {
|
for (const message of result.messages) {
|
||||||
@ -127,6 +120,25 @@ converse.plugins.add('converse-mam', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
converse.plugins.add('converse-mam', {
|
||||||
|
|
||||||
|
dependencies: ['converse-rsm', 'converse-disco', 'converse-muc'],
|
||||||
|
|
||||||
|
|
||||||
|
initialize () {
|
||||||
|
/* The initialize function gets called as soon as the plugin is
|
||||||
|
* loaded by Converse.js's plugin machinery.
|
||||||
|
*/
|
||||||
|
_converse = this._converse;
|
||||||
|
|
||||||
|
api.settings.update({
|
||||||
|
archived_messages_page_size: '50',
|
||||||
|
message_archiving: undefined, // Supported values are 'always', 'never', 'roster' (https://xmpp.org/extensions/xep-0313.html#prefs)
|
||||||
|
message_archiving_timeout: 20000, // Time (in milliseconds) to wait before aborting MAM request
|
||||||
|
});
|
||||||
|
|
||||||
Object.assign(_converse.ChatBox.prototype, MAMEnabledChat);
|
Object.assign(_converse.ChatBox.prototype, MAMEnabledChat);
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ const { Strophe, sizzle } = converse.env;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The MUC utils object. Contains utility functions related to multi-user chat.
|
* The MUC utils object. Contains utility functions related to multi-user chat.
|
||||||
* @namespace stanza_utils
|
* @namespace muc_utils
|
||||||
*/
|
*/
|
||||||
const muc_utils = {
|
const muc_utils = {
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user