Jump to content
LAPS

How to "pick" pages as in this forum for @users?

Recommended Posts

Hi,

in the "body" inputfield for posting on this forum any user can be "picked" by start typing the '@' char and selecting the user in the showed list e.g. @ryan

How can I make that in/for my body CKEditor inputfields? Is there a PW module of which I am not aware?

Share this post


Link to post
Share on other sites
2 hours ago, LAPS said:

Is there a PW module of which I am not aware?

I don't think there's one. Google comes up with some interesting examples though (searching for CKEditor autocomplete or CKEditor mentions). Maybe some of the below could be a starting point?

  1. https://ckeditor.com/old//forums/CKEditor-3.x/Get-current-word-and-display-auto-complete-options 
  2. https://stackoverflow.com/questions/28377886/autocomplete-lists-in-ckeditor 
  3. https://web.liferay.com/fr/web/jose.balsas/blog/-/blogs/new-feature-for-liferay-7-autocomplete-lists-in-ckeditor 
  4. https://github.com/liferay/liferay-portal/tree/00f84a16ac1740dc7c2f5fd8efa2fa3c5b4a8b55/modules/frontend/frontend-editor/frontend-editor-ckeditor-web/src/main/resources/META-INF/resources/_diffs/plugins/autocomplete 
  5. http://navalgandhi1989.github.io/ckeditor-autocomplete-suggestions-plugin/ (a ready made plugin; demo didn't work for me)
  6. https://www.sencha.com/forum/showthread.php?291551-How-do-I-implement-autocomplete-as-I-type-in-a-textarea 

Rather than querying the server every time via Ajax to get suggestions, you could cache the suggestions client-side (in a hidden HTML element, local storage or JS config)

  • Like 2

Share this post


Link to post
Share on other sites

Thank you, @kongondo. It is a starting point.

In the meantime, hoping for other replies, I had a doubt: supposing that a CKEditor plugin exists for querying the server, to which URL/path of the PW installation the AJAX-HTTP requests should be directed to in order to find/return the pages?

Share this post


Link to post
Share on other sites
8 minutes ago, LAPS said:

to which URL/path of the PW installation the AJAX-HTTP requests should be directed to in order to find/return the pages?

Either create a dedicated, hidden, page or a custom ProcessModule to handle the request.

Share this post


Link to post
Share on other sites

What is your purpose for finding the pages within CKEditor? To link to them? In that case it takes a single click on the link button in the toolbar, then you have autocomplete in the "Link to URL" field.

Share this post


Link to post
Share on other sites
9 hours ago, Robin S said:

What is your purpose for finding the pages within CKEditor? To link to them? In that case it takes a single click on the link button in the toolbar, then you have autocomplete in the "Link to URL" field.

My main purpose is to make it smarter for users to finding and linking pages inline while typing, and also make the linked text not modifiable. For example, a user should be able to "mention"/"suggest" a page by title and the exact title should be added to the CKEditor content, just as made in this forum for @users. It should be clear for users that it is not just linked text but something more than that.

In the next future, I am also looking for retrieving some more page information on event "mouse over" the linked text.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...