Allow wp_link_dialogue to open in contexts outside of the editor
|Reported by:||we_tell||Owned by:|
I use wp_link_dialogue within metaboxes to provide a nicer way for users to enter URL's. Its handy for say slideshows, or profiles that point to external sites.
wp_link_dialogue works perfectly on pages where an editor instance exists, but on pages that don't have editor instances it fails due to wplink.js looking for the global wpActiveEditor var, which of course doesn't exist as there is no editor. Aside from the js error, invoking the dialogue on pages with no editor involves calling _WP_Editors::wp_link_dialog(); directly to output the required html which isn't ideal, or calling wp_editor and using css to hide it, which just seems lame.
Ideally wp_link_dialogue should function independently of the editor.
- Amend wplink.js to allow wpActiveEditor to be undefined and pass in a seperate value for textfield to the open method. Con is that wp_link_dialog() still has to be invoked with a call to _WP_Editors::wp_link_dialog()
- Move wp_link_dialog into a seperate class, amend _WP_Editors to call this class and allow for a user defined textfield within wplink.js