[wp-trac] [WordPress Trac] #25471: Allow wp_link_dialogue to open in contexts outside of the editor
WordPress Trac
noreply at wordpress.org
Wed Oct 2 22:35:39 UTC 2013
#25471: Allow wp_link_dialogue to open in contexts outside of the editor
-------------------------+-------------------------------------
Reporter: we_tell | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 3.6.1
Severity: normal | Keywords: needs-patch 2nd-opinion
-------------------------+-------------------------------------
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.
Approaches
1. 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()
2. 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
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25471>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list