Show space emoji in emojiboard
This commit is contained in:
parent
b5788a4f58
commit
b0741faa4d
3 changed files with 13 additions and 6 deletions
|
@ -203,10 +203,15 @@ function EmojiBoard({ onSelect, searchRef }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const room = initMatrix.matrixClient.getRoom(selectedRoomId);
|
const mx = initMatrix.matrixClient;
|
||||||
|
const room = mx.getRoom(selectedRoomId);
|
||||||
|
const parentIds = initMatrix.roomList.getAllParentSpaces(room.roomId);
|
||||||
|
const parentRooms = [...parentIds].map((id) => mx.getRoom(id));
|
||||||
if (room) {
|
if (room) {
|
||||||
const packs = getRelevantPacks(room.client, [room])
|
const packs = getRelevantPacks(
|
||||||
.filter((pack) => pack.getEmojis().length !== 0);
|
room.client,
|
||||||
|
[room, ...parentRooms],
|
||||||
|
).filter((pack) => pack.getEmojis().length !== 0);
|
||||||
|
|
||||||
// Set an index for each pack so that we know where to jump when the user uses the nav
|
// Set an index for each pack so that we know where to jump when the user uses the nav
|
||||||
for (let i = 0; i < packs.length; i += 1) {
|
for (let i = 0; i < packs.length; i += 1) {
|
||||||
|
|
|
@ -248,9 +248,9 @@ function getShortcodeToCustomEmoji(room) {
|
||||||
return allEmoji;
|
return allEmoji;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEmojiForCompletion(room) {
|
function getEmojiForCompletion(mx, rooms) {
|
||||||
const allEmoji = new Map();
|
const allEmoji = new Map();
|
||||||
getRelevantPacks(room.client, [room])
|
getRelevantPacks(mx, rooms)
|
||||||
.flatMap((pack) => pack.getEmojis())
|
.flatMap((pack) => pack.getEmojis())
|
||||||
.forEach((emoji) => {
|
.forEach((emoji) => {
|
||||||
allEmoji.set(emoji.shortcode, emoji);
|
allEmoji.set(emoji.shortcode, emoji);
|
||||||
|
|
|
@ -213,7 +213,9 @@ function RoomViewCmdBar({ roomId, roomTimeline, viewEvent }) {
|
||||||
setCmd({ prefix, suggestions: commands });
|
setCmd({ prefix, suggestions: commands });
|
||||||
},
|
},
|
||||||
':': () => {
|
':': () => {
|
||||||
const emojis = getEmojiForCompletion(mx.getRoom(roomId));
|
const parentIds = initMatrix.roomList.getAllParentSpaces(roomId);
|
||||||
|
const parentRooms = [...parentIds].map((id) => mx.getRoom(id));
|
||||||
|
const emojis = getEmojiForCompletion(mx, [mx.getRoom(roomId), ...parentRooms]);
|
||||||
const recentEmoji = getRecentEmojis(20);
|
const recentEmoji = getRecentEmojis(20);
|
||||||
asyncSearch.setup(emojis, { keys: ['shortcode'], isContain: true, limit: 20 });
|
asyncSearch.setup(emojis, { keys: ['shortcode'], isContain: true, limit: 20 });
|
||||||
setCmd({
|
setCmd({
|
||||||
|
|
Loading…
Add table
Reference in a new issue