[wp-trac] [WordPress Trac] #19098: QTags.addButton not working according to the docblocks

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 31 20:24:49 UTC 2011


#19098: QTags.addButton not working according to the docblocks
--------------------------+-----------------------------
 Reporter:  amereservant  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.3
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Hi, I'm using the latest svn trunk for 3.3 and I was trying to modify the
 quicktags bar according to the recently re-written quicktags.js.

 Following the author's instructions in the docblock in quicktags.dev.js,
 [http://core.trac.wordpress.org/browser/trunk/wp-
 includes/js/quicktags.dev.js#L305] and hooking the
 '''admin_print_footer_scripts''' action hook, it doesn't render the added
 buttons.
 Here's my example code placed in my plugin's function file:


 {{{
 <?php
 if( !function_exists('_add_my_quicktags') ):

 function _add_my_quicktags()
 { ?>
 <script type="text/javascript">
 /* Add H1 Tag */
 QTags.addButton('h1', 'h1', '<h1>', '</h1>');
 </script>
 <?php }
 add_action('admin_print_footer_scripts', '_add_my_quicktags', 100);

 endif; // End of "!function_exists('_add_my_quicktags')"
 }}}

 I can view the source in the browser and it's outputting the code as it
 should.  I've also replaced the contents of '''quicktags.js''' with
 '''quicktags.dev.js''' and changed Lines
 [http://core.trac.wordpress.org/browser/trunk/wp-
 includes/js/quicktags.dev.js#L356 356-358] to the following to check if my
 buttons are being added:
 {{{
                 } else {
                         edButtons[edButtons.length] = btn;
                         if(id == 'h1') console.log(edButtons);
                 }
 }}}

 The answer was 'yes', but they still are not rendering.

 If I've missed something, please let me know, but I believe this seems to
 be a bug with the rewritten code.

 Thanks!

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19098>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list