Hi devs,
While fixing
http://jira.xwiki.org/browse/XWIKI-7889 I introduced an
API to resolve and serialize entity references on the client side
(JavaScript code). See
https://github.com/xwiki/xwiki-platform/commit/cfa8ec3315a32fed875949ff21a5….
XWiki Explorer tree has an input displayed at the bottom where you can
type a _pseudo_ entity reference which is parsed and the specified
entity is selected in the tree. The basic problem (very simplified)
was that this reference was parsed on the client side and the parsing
code did not handle special characters in entity name (no escaping).
Of course, I had to options:
* add a service (REST?) to resolve/serialize the reference on the server or
* (as I did) port part of the code from xwiki-platform-model (with
unit tests!) to JavaScript to be able to resolve/serialize entity
references on the client side.
There are pros and cons for each option but for me the main reason was
that it is painful to modify xwikiexplorer.js to make AJAX requests
each time you type into that input box (the tree node is selected as
you type). An almost complete rewrite was needed and since we're
looking to replace that tree I thought the second option was better.
Would be great if you can review my commit. I'm interested in the API
naming and places where I put the JS code. Also, I'm not sure where to
document the new API (that is if no one is against it).
Thanks,
Marius