impress-org / givewp

GiveWP - The #1 Donation Plugin for WordPress. Easily accept donations and fundraise using your WordPress website.
https://givewp.com/
GNU General Public License v3.0
339 stars 191 forks source link

fix: prevent console error when using shortcode button #3594

Closed raftaar1191 closed 5 years ago

raftaar1191 commented 6 years ago

User Story

As an Admin I should be able to insert the shortcode into the pages via shortcode button

Notes: This issue comes when the site is running WordPress 4.9.8 version

Current Behavior

I currently getting console error when inserting shortcode via shortcode button.

Expected Behavior

I expect no console error

Slack Chat Link: https://givewp.slack.com/archives/C0FAGC83C/p1533894649000241

Steps to Reproduce

Check the video

Visuals

Testing with WordPress Version 4.9.8 Video Link: https://screencast-o-matic.com/watch/cFj62wqjYj

image

Testing with WordPress Version 4.9.7 Video Link: https://screencast-o-matic.com/watch/cFj62EqjYJ

Related

https://secure.helpscout.net/conversation/635893526/23051?folderId=848135

Environment

WordPress System Info ### WordPress Environment ### Home URL: http://givewp.local Site URL: http://givewp.local WP Version: 4.9.8 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US Permalink Structure: /%postname%/ Show on Front: posts Table Prefix Length: wp_ Table Prefix Length: 3 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, give_subscription ### Server Environment ### Hosting Provider: DBH: localhost, SRV: givewp.local TLS Connection: Connection uses TLS 1.2 TLS Connection: Probably Okay Server Info: nginx/1.10.1 PHP Version: 7.0.3 PHP Post Max Size: 1,000 MB PHP Time Limit: 900 PHP Max Input Vars: 3000 PHP Max Upload Size: 1,000 MB cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40. SUHOSIN Installed: – MySQL Version: ❌ 5.5.55 - We recommend a minimum MySQL version of 5.6. See: WordPress Requirements Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Give Configuration ### Give Version: 2.2.3 Give Cache: Enabled Database Updates: All DB Updates Completed. Give Cache: Enabled Give Cache: ✔New Donation✔Donation Receipt✔New Offline Donation✔Offline Donation Instructions✔New User Registration✔User Registration Information✔Email access✔Daily Email Report✔Weekly Email Report✔Monthly Email Report✔Renewal Receipt Email✔Subscription Cancelled Email✔Subscription Completed Email❌Subscription Reminder Email✔Subscriptions Email Access Upgraded From: – Test Mode: Enabled Currency Code: USD Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: http://givewp.local/donation-confirmation/ Failure Page: http://givewp.local/donation-failed/ Donation History Page: http://givewp.local/donation-history/ Give Forms Slug: /donations/ Enabled Payment Gateways: Test Donation, Offline Donation, Stripe - Credit Card Default Payment Gateway: Test Donation PayPal IPN Verification: Enabled PayPal IPN Notifications: N/A Donor Email Access: Enabled ### Active Give Add-ons ### Give - 2Checkout Gateway: ❌ Unlicensed – by WordImpress – 1.1.1 Give - Authorize.net Gateway: ❌ Unlicensed – by WordImpress – 1.3.3 Give - AWeber: ❌ Unlicensed – by WordImpress – 1.0.2 Give - Braintree Gateway: ❌ Unlicensed – by WordImpress – 1.2 Give - CCAvenue Gateway: ❌ Unlicensed – by WordImpress – 1.0.1 Give - ConvertKit: ❌ Unlicensed – by WordImpress – 1.0.1 Give - Currency Switcher: ❌ Unlicensed – by WordImpress – 1.2.2 Give - Display Donors: ❌ Unlicensed – by WordImpress, LLC – 1.0 Give - Dwolla Gateway: ❌ Unlicensed – by WordImpress – 1.1.2 Give - Email Reports: ❌ Unlicensed – by WordImpress – 1.1.2 Give - Fee Recovery: ❌ Unlicensed – by WordImpress – 1.7.2 Give - Form Countdown: ❌ Unlicensed – by WordImpress – 1.0 Give - Form Field Manager: ❌ Unlicensed – by WordImpress – 1.4.0 Give - Gift Aid: ❌ Unlicensed – by WordImpress – 1.1.6 Give - Google Analytics Donation Tracking: ❌ Unlicensed – by WordImpress – 1.1.4 Give - MailChimp: ❌ Unlicensed – by WordImpress – 1.4 Give - Manual Donations: ❌ Unlicensed – by WordImpress – 1.4.1 Give - PayPal Pro Gateway: ❌ Unlicensed – by WordImpress – 1.1.5 Give - PDF Receipts: ❌ Unlicensed – by WordImpress – 2.3.0 Give - Razorpay: ❌ Unlicensed – by WordImpress – 1.1.4 Give - Recurring Donations: ❌ Unlicensed – by WordImpress – 1.7.2 Give - Stripe Gateway: ❌ Unlicensed – by WordImpress – 2.0.10 Give - Tributes: ❌ Unlicensed – by WordImpress – 1.4.2 Give - Zapier: ❌ Unlicensed – by WordImpress – 1.1.2 ### Other Active Plugins ### ### Inactive Plugins ### BuddyPress: by The BuddyPress Community – 3.0.0 Caldera Forms: by Caldera Labs – 1.5.9.1 Charitable: by WP Charitable – 1.6.1 Debug Bar: by wordpressdotorg – 0.9 Debug Bar Console: by koopersmith – 0.3 Debug Bar Cron: by Zack Tollman, Helen Hou-Sandi – 0.1.2 Debug Bar Extender: by Thorsten Ott, Automattic – 0.5 Developer: by Automattic – 1.2.6 Duplicate Post: by Enrico Battocchi – 3.2.2 Email Cop: by Ashfame – 0.1.1 Give - Donation Upsells for WooCommerce: by WordImpress – 1.0.1 Give - Paymill Gateway: by WordImpress – 1.1 Gravity Forms: by rocketgenius – 2.2.6 Gravity Forms Signature Add-On: by Rocketgenius – 3.4 Loco Translate: by Tim Whitlock – 2.1.4 Log Deprecated Notices: by Andrew Nacin – 0.4 Log Viewer: by Markus Fischbacher – 14.05.04 Monster Widget: by Automattic – 0.3 PHP Compatibility Checker: by WP Engine – 1.4.5 Polylang: by Frédéric Demarle – 2.3.6 qTranslate-X: by qTranslate Team – 3.4.6.8 Query Monitor: by John Blackbourn & contributors – 3.0.1 Rewrite Rules Inspector: by Daniel Bachhuber, Automattic – 1.2.1 User Switching: by John Blackbourn & contributors – 1.3.1 WooCommerce: by Automattic – 3.4.1 WordPress Beta Tester: by Peter Westwood – 1.2.2 WP Hide & Security Enhancer: by Nsp Code – 1.4.9.1 WPML Multilingual CMS: by OnTheGoSystems – 3.9.4 WP Rollback: by WordImpress – 1.5.1 WPS Hide Login: by WPServeur, NicolasKulka, tabrisrp – 1.3.4.2 ### Theme ### Name: Twenty Seventeen Version: 1.7 Author URL: https://wordpress.org/ Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme
raftaar1191 commented 6 years ago

Testing this when new WordPress version is release

kevinwhoffman commented 5 years ago

@kakshak Please test using Give v2.3.0 and latest WordPress v4.9.8. Confirm whether you are able to replicate or close otherwise.

kakshak commented 5 years ago

@kevinwhoffman I am able to reproduce this issue in Give v2.3.0 and latest WordPress v4.9.8 but I am not able to reproduce this issue in EDD v2.9.8 plugin.

Visual

edd-shortcode

kevinwhoffman commented 5 years ago

@kakshak If the EDD shortcode generator does not produce the same error in Text mode, then this is a problem we should be able to fix. It is not a WordPress core limitation if other plugins are handling it successfully. Please investigate the cause and resolve.

kakshak commented 5 years ago

@kevinwhoffman I've looked over it for 2+ hours but didn't find the cause of the issue. If you want then I can invest more time in it. Please let me know your thoughts on this.

kevinwhoffman commented 5 years ago

Summing up what we know about the issue so far:

Steps to Reproduce

  1. Go to the post editor of a Post or Page.
  2. Switch the editor mode from Visual to Text.
  3. Reload the page.
  4. Attempt to enter any Give shortcode via the shortcode builder button.
  5. See console error: Uncaught TypeError: Cannot read property 'getRng' of undefined.

Since the shortcode builder is essentially broken for anyone using the text editor (which many admins do), I think this warrants further investigation and a fix. @DevinWalker and I will discuss and provide instructions.

kevinwhoffman commented 5 years ago

@DevinWalker is going to look at the WP 4.9.8 release notes to see if we can uncover a change to TinyMCE that may be causing this. We're looking to resolve before Give 2.3.0.

kevinwhoffman commented 5 years ago

Research Update

WP 4.9.8 release notes indicate that TinyMCE was updated in this release.

See the TinyMCE changelog. WordPress 4.9.6 included TinyMCE 4.7.11, WordPress 4.9.8 updated to TinyMCE 4.8.0, despite the title of this ticket.

To summarize, TinyMCE was upgraded from 4.7.11 to 4.8.0 so I am reviewing the changes that occurred between those releases on the TinyMCE changelog to see if I can find the cause.

kevinwhoffman commented 5 years ago

@DevinWalker I did not see anything obvious in the TinyMCE changelog that would explain this issue. It's also proving very difficult to debug because of the minimized TinyMCE script in WP core. There is no unminified version.

Maybe you can take one more look at it before 2.3.0. Otherwise the existing workaround is to recommend the Visual editor for anyone who contacts support.

kevinwhoffman commented 5 years ago

Discussed with @DevinWalker. Closing as wontfix because it is limited to the text mode of the classic editor. Existing workaround is to change to visual mode.