Make LinkControl show search results in same order as the results from server
-
Hello WordPress devs,
Greetings from China. We had a request from our client to modify the default behavior of the Gutenberg LinkControl component, to achieve:
- When search for a word “promotions” or “/promotions”, server needs to query for posts which permalink matches the search term. (This part is already handled in the php side).
- When the server sends back the results, we want to link previews in the LinkControl component to respect the order of the posts returned from the server, but as it seems with the default LinkControl behavior, it does some kind of suggestions on top of the results sending from the server, which ends up my first result from server is not the first item rendered in the search modal, please refer to the screenshot I made, hope it will make more sense.
I have been reading the source codes on the LinkControl block, but that doesn’t give me any ideas moving forward: https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/components/link-control/search-results.js
I would very much appreciate if anyone can point me to the right direction on how I should tackle this issue.
Screenshot link: https://ibb.co/Rb9HGGH
If above link doesn’t work, please check this one: https://postimg.cc/JyrCKTGq
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.