WordPress.org

Make WordPress Core

Ticket #19906: 19762-quicktags-docblock.diff

File 19762-quicktags-docblock.diff, 1.3 KB (added by jeremyclarke, 6 years ago)

update qt.addButton() dockblock in quicktags.dev.js

  • wp-includes/js/quicktags.dev.js

     
    275275         *
    276276         * Adds qt.Button or qt.TagButton depending on the args. The first three args are always required.
    277277         * To be able to add button(s) to Quicktags, your script should be enqueued as dependent
    278          * on "quicktags" and outputted in the footer. If you are echoing JS directly from PHP,
    279          * use add_action( 'admin_print_footer_scripts', 'output_my_js', 100 ) or add_action( 'wp_footer', 'output_my_js', 100 )
     278         * on "quicktags" and outputted in the footer.
     279         * If you are echoing JS directly from PHP use
     280         *      add_action( 'admin_print_footer_scripts', 'output_my_js', 100 )
     281         * or
     282         *      add_action( 'wp_footer', 'output_my_js', 100 )
     283         *     
     284         * If echoing the addButton calls directly instead of enqueing with the 'quicktags' dependency
     285         * make sure to check that the QTags object is defined first, otherwise your code will throw errors
     286         * when no editor is present:
     287         *      if ( typeof QTags != 'undefined' ) { QTags.addButton(...) }
    280288         *
    281289         * Minimum required to add a button that calls an external function:
    282290         *     QTags.addButton( 'my_id', 'my button', my_callback );