-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Direct messages : Add backdrop and spinner when submitting PostBlock.jsx : Adjust visibility selecter's design add i18n to MentionsList.jsx add comments to useMentions.js
- Loading branch information
Showing
6 changed files
with
72 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import { useMemo } from 'react'; | ||
import renderMentions from './renderMentions'; | ||
|
||
/** | ||
* | ||
* @param data The list of mentionable actors to be used in the mention suggestions. | ||
* e.g. : { | ||
* id: 'https://pod.provider/username', => the value that will be used in the "data-id" attribute of the generated link in the document | ||
* label: '@[email protected]' => will be displayed in the document and stored in the "data-label" of the link | ||
* } | ||
* @returns {{items: (function({query: *}): *), render: ((function(): {onKeyDown(*): (boolean|*), onStart: function(*): void, onExit(): void, onUpdate(*): void})|*)}} | ||
*/ | ||
const useMentions = data => { | ||
/** | ||
* Filters suggestions using the end user query (what is typed after a "@" in the text field) | ||
* @type {function({query: *}): *} | ||
*/ | ||
const items = useMemo( | ||
() => ({ query }) => data.filter(({ label }) => label.toLowerCase().includes(query.toLowerCase())).slice(0, 5) | ||
, [data] | ||
|