[buddypress-trac] [BuddyPress Trac] #8001: Review at.js integration for updates and/or swapout
buddypress-trac
noreply at wordpress.org
Thu Jan 10 21:00:36 UTC 2019
#8001: Review at.js integration for updates and/or swapout
---------------------------+----------------------
Reporter: boonebgorges | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone: Up Next
Component: Core | Version:
Severity: normal | Resolution:
Keywords: needs-testing |
---------------------------+----------------------
Comment (by dcavins):
I'm attaching a patch that introduces Tribute in favor of At-who. I'm not
sure that this is a clear improvement (it trades one kind of complexity
for another). Thoughts:
• The division of labor is that the library watches the inputs we specify
for the trigger `@` and then compares the string after the `@` to the
values (user objects) you passed to it. It sorts the best match to the top
of the list and handles keyboard and mouse interaction with the results
list. Our wrapper handles the remote AJAX lookup and returns the fetched
user objects to Tribute.
• This library is large (48KB transfer and ~200KB unzipped) and does a lot
more than we really need, like fuzzy matching from a list of
possibilities. Our most typical case is a set of AJAX-fetched options in
response to a query, so everything is a match. The only time that the
fuzzy matching is used in our case is when the user is interacting with
the pre-constructed friends list (generated by php and stored in the JS
object BP_Suggestions.friends), which happens rarely.
• Tribute gives each match a score to order the results. It would be cool
to influence those results so that your friends are always on top. (Then
we could also stop pre-caching friends in php.)
• I was not able to get Tribute to work with the TinyMCE editor window. It
seems possible, but I ran out of will in this session. (Also, what about
Gutenberg blocks?)
• I ran into some issues within Tribute where I thought I could pass
options in to change the behavior and output, but the promising sub module
options were hardcoded in the main module, so things that looked like
options actually weren't. I imagine Zurb would consider accepting pull
requests that were reasonable. (They'd actively like help with improving
how the library works with TinyMCE, for instance.)
So, Tribute is promising, but maybe overkill for what we need (and not as
flexible/easy to work with as we'd like). Let me know what you think.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8001#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list