LAPS Posted January 20, 2018 Share Posted January 20, 2018 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? Link to comment Share on other sites More sharing options...
kongondo Posted January 21, 2018 Share Posted January 21, 2018 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? https://ckeditor.com/old//forums/CKEditor-3.x/Get-current-word-and-display-auto-complete-options https://stackoverflow.com/questions/28377886/autocomplete-lists-in-ckeditor https://web.liferay.com/fr/web/jose.balsas/blog/-/blogs/new-feature-for-liferay-7-autocomplete-lists-in-ckeditor 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 http://navalgandhi1989.github.io/ckeditor-autocomplete-suggestions-plugin/ (a ready made plugin; demo didn't work for me) 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) 2 Link to comment Share on other sites More sharing options...
LAPS Posted January 21, 2018 Author Share Posted January 21, 2018 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? Link to comment Share on other sites More sharing options...
kongondo Posted January 21, 2018 Share Posted January 21, 2018 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. Link to comment Share on other sites More sharing options...
LAPS Posted January 21, 2018 Author Share Posted January 21, 2018 I see it really hard to implement the feature almost from scratch. I added it to the wishlist. Link to comment Share on other sites More sharing options...
Robin S Posted January 21, 2018 Share Posted January 21, 2018 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. Link to comment Share on other sites More sharing options...
LAPS Posted January 21, 2018 Author Share Posted January 21, 2018 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now