From abf49bc04d19f1c188cd02ca79e9e4049ff95a4a Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 8 Jan 2025 23:45:25 -0500 Subject: [PATCH] wip --- server/routes/api/suggestions/suggestions.ts | 23 +++++++++++--------- shared/editor/components/Styles.ts | 5 +++++ shared/editor/nodes/Mention.tsx | 1 + 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/server/routes/api/suggestions/suggestions.ts b/server/routes/api/suggestions/suggestions.ts index 0e0d709e31..eac32db6db 100644 --- a/server/routes/api/suggestions/suggestions.ts +++ b/server/routes/api/suggestions/suggestions.ts @@ -35,17 +35,20 @@ router.post( suspendedAt: { [Op.eq]: null, }, - [Op.and]: { - [Op.or]: [ - Sequelize.literal( - `unaccent(LOWER(email)) like unaccent(LOWER(:query))` - ), - Sequelize.literal( - `unaccent(LOWER(name)) like unaccent(LOWER(:query))` - ), - ], - }, + [Op.and]: query + ? { + [Op.or]: [ + Sequelize.literal( + `unaccent(LOWER(email)) like unaccent(LOWER(:query))` + ), + Sequelize.literal( + `unaccent(LOWER(name)) like unaccent(LOWER(:query))` + ), + ], + } + : {}, }, + order: [["name", "ASC"]], replacements: { query: `%${query}%` }, offset, limit, diff --git a/shared/editor/components/Styles.ts b/shared/editor/components/Styles.ts index abc958a7b1..f46826f8d6 100644 --- a/shared/editor/components/Styles.ts +++ b/shared/editor/components/Styles.ts @@ -303,6 +303,11 @@ width: 100%; gap: 4px; vertical-align: bottom; + &:hover { + text-decoration: none; + cursor: default; + } + &.mention-user::before { content: "@"; } diff --git a/shared/editor/nodes/Mention.tsx b/shared/editor/nodes/Mention.tsx index f63cc61f1b..88e748f8f0 100644 --- a/shared/editor/nodes/Mention.tsx +++ b/shared/editor/nodes/Mention.tsx @@ -46,6 +46,7 @@ export default class Mention extends Extension { { tag: `.${this.name}`, preserveWhitespace: "full", + priority: 100, getAttrs: (dom: HTMLElement) => { const type = dom.dataset.type; const modelId = dom.dataset.id;