Ticket #1552 (closed enhancement: no action needed)
linkValidator config option
| Reported by: | guest | Owned by: | gogo |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Xinha Core | Version: | trunk |
| Severity: | normal | Keywords: | |
| Cc: | ethan.jucovy@… |
Description
My application uses Xinha as an editing frontend to a backend that also uses a ((double paren wiki syntax)) for internal page links. The user's input is treated as HTML, but ((wiki links)) are also processed by the backend. We also allow the user to create HTML links in their documents using Xinha.
We've built a [custom Linker-replacement plugin] which includes complex, application-specific validation to prevent the user from inserting an HTML link within a ((wiki link)). If the validation fails, the user receives an alert and the link-creation dialog box does not pop up.
Aside from this validator, our plugin is identical to the Linker.
It would be nice to have a config option for passing in a linkValidator function. This function would be called by both Linker and by InsertLink. That way Xinha users could provide custom link validators without having to build whole plugins, and the validators could be attached to the link-creation action regardless of which linker is being used.
I've attached an implementation with documentation.
I'm curious whether there is a better approach -- like listening to a generic "button has been pressed" event and conditionally cancelling the action?
