From 0826d25d6f6cbd0c7e8ee16fb3ab680a85b8d895 Mon Sep 17 00:00:00 2001 From: Robert Clark Date: Mon, 17 Oct 2022 10:35:38 -0400 Subject: [PATCH] Fix absolute positioned mentions Currently mentions are positioned to show up under the cursor, however clicking on any of those mentions does not actually insert anything since the trix-blur event happens first. This fixes the issue by not collapsing on trix-blur. --- README.md | 3 +-- app/models/user.rb | 2 +- app/views/messages/_form.html.erb | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 63dfaf25..f2ccdcd6 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ with the [link_to][] helper: Since the mentions are entirely String-based, they won't include any information related to a `User` record's identifier. We'll need to add -support for resolveing records based on the `params[:id]` path +support for resolving records based on the `params[:id]` path parameter. The generated `UsersController#set_user` helper method queries rows by @@ -930,7 +930,6 @@ or on escape: + action: " + keydown->mentions#collapseOnEscape + keydown->mentions#collapseOnCursorExit -+ trix-blur->mentions#collapse + " } %> diff --git a/app/models/user.rb b/app/models/user.rb index 52d3aa39..35bc13ea 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,7 @@ class User < ApplicationRecord include ActionText::Attachable scope :username_matching_handle, ->(handle) { where <<~SQL, handle.delete_prefix("@") + "%" } - username LIKE ? + username ILIKE ? SQL def to_trix_content_attachment_partial_path diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index a41e05ec..abc3eb1c 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -18,7 +18,6 @@ action: " keydown->mentions#collapseOnEscape keydown->mentions#collapseOnCursorExit - trix-blur->mentions#collapse " } %>