Skip Navigation

[Resolved] Views – Uncaught TypeError: Cannot read property 'split' of undefined in WYSIWYG

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Christian Cox 4 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1360559

I am trying to: Add a link to a bullet point via the wp visual editor in inside a bullet list

Link to a page where the issue can be seen:
hidden link but only in the wp admin

I expected to see: no jquery conflict issue.

Instead, I got:
Uncaught TypeError: Cannot read property 'split' of undefined
at zw.<anonymous> (VM357 views.js:232)
at dp.c.fire (VM340 tinymce.min.js:2)
at zw.fire (VM340 tinymce.min.js:2)
at zw.<anonymous> (VM474 plugin.min.js:1)
at dp.c.fire (VM340 tinymce.min.js:2)
at zw.fire (VM340 tinymce.min.js:2)
at Uh.nodeChanged (VM340 tinymce.min.js:2)
at zw.nodeChanged (VM340 tinymce.min.js:2)
at zw.<anonymous> (VM340 tinymce.min.js:2)
at dp.c.fire (VM340 tinymce.min.js:2)

issues seems to be here:
if ( linkNode ) {
$linkNode = editor.$( linkNode );
nodeClass = $linkNode.attr( 'class' ).split( ' ' );

maybe better to check if node exist before referencing it.
if ( linkNode ) {
$linkNode = editor.$( linkNode );
if( $linkNode.hasAttr( 'class' ){
nodeClass = $linkNode.attr( 'class' ).split( ' ' );
}

i am running most up to date toolset plugins and have tried switching to default theme and issue still persist.

#1360883

Hi, I'd like to try to reproduce this problem locally but in my first few tests I wasn't able to see a JavaScript error. Can you tell me a bit more?
- Is this the main post editor area, or a WYSIWYG custom field?
- Are you editing a post or a Content Template, View, etc?
- Are you adding an external link or searching for an internal page link?
- Are you using the Classic editor or the Block editor?
- Can you attach a full screenshot so I can see everything that's going on?

Thanks!

#1362009
Screen Shot 2019-10-15 at 9.09.38 AM.png

I've attached a screenshot. It only happening when trying to add a link to a bullet list. It simply won't open so it happens before you are able to add ant type of link. It is in the default WYSIWYG editor. There is not view being used on this page. We're using the classic editor. I've tried default theme and same issue. I've also deactivate views and confirmed the the issue goes away.

#1362215

It seems the spit is occurring because of an extra div tag that does not contain a class. If you remove the div or add a class it will work fine. Of course, removing the div is fine, but the plugin code is assuming that all users will know to add a class. Which assume a lot for people learning html and that are learning WordPress and proper html semantics.

Adding a conditional to your plugin to check if class exist would probably solve this use case.

if( $linkNode.hasAttr( 'class' ){
nodeClass = $linkNode.attr( 'class' ).split( ' ' );
}
<div>
<ul>
 	<li>Interdisciplinary Asian Studies major/minor: Dr. Dwayne Dixon.</li>
 	<li>Arab Cultures major & Arabic minor: Dr. I Jonathan Kief.</li>
 	<li>Chinese major/minor: Dr. Gang Yue.</li>
 	<li>Hebrew minor: Dr. Yaron Shemer</li>
 	<li>South Asian Studies major & Hindi-Urdu minor: Dr. Afroz Taj</li>
 	<li>Japanese major/minor: Dr. Dwayne Dixon.</li>
 	<li>Korean minor: Dr. I Jonathan Kief</li>
 	<li>Persian minor: Dr. Claudia Yaghoobi</li>
 	<li>Middle Eastern Languages minor: Dr. Yaron Shemer</li>
</ul>
</div>
#1362281

Thanks for the extra information. I'm able to reproduce this issue on one of my local test sites but not on a site created from scratch. I'll need to put some additional time into this tomorrow and give you an update when I have some more information to share.

#1362773

Okay I was able to figure out how to reproduce the issue consistently. In my local tests, it has to do with whether or not the Toolset Blocks plugin was ever active on the site. Until I activated Toolset Blocks, I could not reproduce the problem. Then once I had activated Blocks even just once, I could continue to reproduce the problem even after Blocks was deleted from the site. I'm asking my 2nd tier support team for some clarification on how to handle a problem introduced by a beta that continues to affect the site after the beta is uninstalled. I'll let you know what I find out.

#1364945

Hi, just a quick update to let you know my 2nd tier support team has escalated this issue to our developers. I'll keep you up-to-date here and let you know when I have additional information to share.

#1436181

Hi, I have been informed by my second tier support team that this issue should be resolved in the latest versions of Views and Blocks. Please be sure your site is updated to use the latest plugin versions, and let me know if the problem is not fully resolved. Thanks for your patience!