QTags.addButton
-
The QTags.addButton is throwing an uncaught reference error of “QTags is not defined” in my Admin area. Is this a known issue?
Thanks!
The page I need help with: [log in to see the link]
-
Thank you for reporting this bug. After scrambling to investigate it—the presence of the “footnotes” button seems to be limited to the Classic Editor, and the button doesn’t seem to work there although it has recently been reported to do so—I can only tell that the same or a similar bug must have been known around 2017 because back then a fix was implemented in templates/dashboard/editor-button.php:
* Adds a check to ensure the quicktags script is available * preventing undefined error if no quicktags script
It doesn’t seem to be effective though, given this template file doesn’t even seem to be loaded, and the original HTML version templates/dashboard/editor-button.html, that probably causes the error message you are seeing, remained unfixed.
However I don’t get the error message despite having debug mode and checking also the browser console, on a page with the Classic Editor.
I wonder also how quicktags could be missing given there is support for it in wp-admin/js, and the other buttons are working fine.
Despite my label I’m not the plugin’s author, only functionally a maintenance programmer and basically a user coming up with a bunch of bug fixes 3?months ago. The only thing I can figure out at this point is to port the fix to JavaScript and add the check right in the original template’s inline script. But this is only for the text editor, not the visual editor:
/** * adds a new button to the plain text editor * * @edit 2.5.4d1 try to fix uncaught reference error of “QTags is not defined” * * @reporter @dpartridge * @bugreport https://www.ads-software.com/support/topic/qtags-addbutton/ */ if ( QTags ) { QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnotes', MCI_Footnotes_text_editor_callback ); }
If you would like to test whether this works out as expected, please download and install the current development version from https://downloads.www.ads-software.com/plugin/footnotes.zip
Also I’d love to learn how you managed to get the error message to show up, and where it displays in your Admin.
Thank you.
- This reply was modified 3 years, 10 months ago by pewgeuges.
Sorry for not testing sooner in WordPress 5.6, where the error occurs; no error in WP?5.5 and WP?5.7. In WP?5.6.2, clicking the
footnote
button in the Classic?Editor Text mode doesn’t work, and gives an AJAX 404 error. Clicking thefn
button in Visual mode does not ouput any error, it works correctly.Doing the same in the preceding WP version (5.5.3) or in the following one (5.7) works in both modes and doesn’t output anything in the console.
Also in WP?5.6.2, the error occurs regardless whether in templates/dashboard/editor-button.html the if statement is added or not:
if ( QTags ) { QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnote', MCI_Footnotes_text_editor_callback ); }
For Footnotes v1.6.5, a desperate attempt was made to solve the same problem so the issue pre-existed in then-WordPress, until WordPress fixed it more or less successfully, then definitely(?).
As in current WP?5.7 this problem seems solved I’ll mark this topic as resolved; if you continue to encounter issues, please feel free to use it or open a new one and we’ll strive to get a solution.
Thanks for reporting and helping fix the numerous bugs (now a few less than previously) in Footnotes.
Best regards.
I reopen this bug since it appears again since wordpress 5.8
I see the message in chrome dev console when browsing administration panels.
You may try the following function, as advised by WordPress:
if ( wp_script_is('quicktags' ) ) { QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnote', MCI_Footnotes_text_editor_callback ); }
Thanks!
- This reply was modified 3 years, 3 months ago by JCV. Reason: added fix
Many thanks for this fix! I’m sure that the plugin authors will add it in the code. As you mentioned in https://www.ads-software.com/support/topic/qtags-addbutton-take-two/, this topic is on the brink of closure, so we’ll follow up in take two.
Best regards.
- This reply was modified 3 years, 3 months ago by pewgeuges.
- The topic ‘QTags.addButton’ is closed to new replies.