Hi, I have submit my second commit of the project, it contains four small
commits:
1. Make patch for the suggestions given by review comments of Marius for my
last commit.
2. Add some wiki editor(textarea) related utility functions for WikiEditor
object, it is useful when intergate the suggestion box to the editor.
3. Codes for the second and third part of my plan this week:
(a). Implement the function that requests the list of wiki pages
matching some prefix user input. BUT, don't actually query the database,
instead simply return a dummy list from the server.
(b). Implement the function that displays the list of wiki pages where
the caret is. But I use the suggestion box I have already implemented before
this week, instead of writing a plain HTML list inside a DIV.
4. Make a patch for modifying the suggestion json format for link suggestion
box
Here I want to explain how I Implement the function that displays the list
of wiki pages where the caret is.
When the suggestor started, I add a mask which duplicate the same content
with the same size, position and also same style of the textarea. When user
types triggers, for example, type "[[" for link suggestion, the mask will be
updated for two things:
(1). update the content to syncronized with the values in textarea. And also
surround the trigger with a "span" mark, for example, for "[[", it
will be
surrounded by <span id="suggestion_mark">[[</span>. It is useful for
recorde
the trigger and get its offset position which is the right place to show the
suggestion box.
(2). update the position of the mask include the scrollTop of the mask to
syncronizied with the textarea.
I use the LinkSuggestionBox which I have implemented last week to show the
suggestion results, it can be shown in the right place now. But the
navigation of the result item by up and down key does not work now, I have
found the problem and I will refine it in next commits.
--
Best wishes,
许凌志(Jame Xu)
MOE KLINNS Lab and SKLMS Lab, Xi'an Jiaotong University
Department of Computer Science and Technology, Xi’an Jiaotong University