U4-9724 - Tiny MCE error when adding a link "Cannot read property 'href' of undefined"

Created by Jono Kingston 05 Apr 2017, 02:15:57 Updated by Sebastiaan Janssen 20 Jun 2017, 08:18:37

Tags: Backport

Is duplicated by: U4-9969

Is duplicated by: U4-10021

I upgraded from 7.5.11 to 7.6.0, and I get the following error when adding a link in Tiny MCE:

DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9qcXVlcnkubWluLmpzOy91bWJyYWNvL2xpYi9hbmd1bGFyLzE…:8 TypeError: Cannot read property 'href' of undefined at mceInsertLink (tinymce.min.js?umb__rnd=7.6.0-RC.1372569339:8) at Object.m [as execCommand] (tinymce.min.js?umb__rnd=7.6.0-RC.1372569339:8) at L.execCommand (tinymce.min.js?umb__rnd=7.6.0-RC.1372569339:12) at insertLink (plugin.min.js:221) at Object.callback (plugin.min.js:235) at Object.scope.submit (DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9qcXVlcnkubWluLmpzOy91bWJyYWNvL2xpYi9hbmd1bGFyLzE…:895) at DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9qcXVlcnkubWluLmpzOy91bWJyYWNvL2xpYi9hbmd1bGFyLzE…:9 at DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9qcXVlcnkubWluLmpzOy91bWJyYWNvL2xpYi9hbmd1bGFyLzE…:41 at Object.$eval (DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9qcXVlcnkubWluLmpzOy91bWJyYWNvL2xpYi9hbmd1bGFyLzE…:10) at Object.$apply (DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9qcXVlcnkubWluLmpzOy91bWJyYWNvL2xpYi9hbmd1bGFyLzE…:10)

Comments

Sebastiaan Janssen 05 Apr 2017, 06:37:25

Make sure to bump the version in ClientDependency.config (just make it 1 higher or lower).

Feel free to re-open this issue if that doesn't work for you. If it doesn't work, please produce steps to reproduce (what exactly are you clicking, what happens etc. screenshots/videos help too).


Jono Kingston 05 Apr 2017, 06:54:00

Thanks @sebastiaan , your comment made me realise that I didn't copy all of the new config files when upgrading. Sorry to waste your time, and thanks for your help. V7.6 is awesome by the way.


Florin Lazau 12 May 2017, 05:55:31

@jonokingston,

I have the same issue after upgrade to 7.6. Can you please advice me?

Thanks, Florin


Jono K 14 May 2017, 01:08:45

@f_lazau I just needed to copy all of the config files into the upgraded site. Also try Sebastiaan's suggestion of updating the version number in ClientDependency.config


Eric Schrepel 25 May 2017, 00:01:45

I'm getting this error also, having NuGet-upgraded 7.5.13 to 7.6.1; updating the version number in client.config didn't help, and all the config files appear to be present, and the tinymce.js file matches what's in the install folder. I can see in the Chrome dev window that it's correctly using the newer (updated) client version number, but the error still occurs even with hard cache reloading / restarting the site.

Any other thoughts? (I'm having to add links for our editors today because of this li'l bug).


Sebastiaan Janssen 25 May 2017, 08:21:08

Make sure to check that all files are correctly updated, I wrote a blog post about this a while ago: https://cultiv.nl/blog/how-to-diagnose-umbraco-upgrade-problems/


Matthew 25 May 2017, 13:45:20

This seems to have just cropped up out of the blue for me as well. I've been on 7.6.1 for the last week and I'm not sure what's changed. Configs have all been merged properly and ClientDependency has been recycled.

I noticed that the latest tinyMceConfig.config is missing the umbracolink? Could anyone enlighten me on what that did? I just removed it from my project but nothing's resolved.

EDIT: umbracolist -> umbracolink


Matthew 25 May 2017, 14:49:30

Fixed this by doing a more proper merge of my web.config at the site root.


Eric Schrepel 25 May 2017, 15:51:43

@kirschner@magnet.fsu.edu Do you mean the umbracolink line? I notice that missing from the 7.6.1 version, but maybe that's a typo on my end (umbracolink vs umbracolist)? Regardless, having it there or not isn't correcting this issue.


Eric Schrepel 25 May 2017, 16:04:36

Have followed Sebastiaan's guide mentioned above in other instances, and had followed the same procedures here (very careful config comparisons, hard cache reloads, etc.), to no effect. Really seems like something a bit broken since several folks reporting the same, and this is the first time I've had any tinyMCE-related issues when upgrading. Any files or data that would be helpful, I'm happy to provide.


Sebastiaan Janssen 25 May 2017, 16:23:50

Can you do a clean install and try? Surely if something is slightly broken you'd be able to repro on a clean install.

Also mention browser versions etc.


Eric Schrepel 25 May 2017, 22:52:32

Solved it for our situation. Clued in by @kirschner@magnet.fsu.edu comment above, I saw that our tinymceconfig had always had <plugin loadOnFrontend="true">umbracolink</plugin>, which I assumed was still needed in 7.6.1 even though the install version doesn't include it. So I removed it, and things work fine.

It does make upgrades tricky sometimes, because we're supposed to compare config files after NuGet updates, but unless there's commenting in the new config files (like "this plugin used to be required, removed as of version x.x.x"), it's hard to know what should exactly match up with the new configs. (Whining because I just want to "Update-Package UmbracoCms" but it takes more than that, usually. Still, updates working far easier via NuGet than manual updates from versions past.)


Sebastiaan Janssen 26 May 2017, 07:58:54

Great to hear, I will add it to the version-specific upgrade guides and will check if we can make a config transform for it, that should work!


Sebastiaan Janssen 26 May 2017, 08:04:08

FYI: we try to make it so that nuget upgrades do everything they can to make the upgrade successful, sometimes this is not possible though, for example if you've customized the validElements element, which we need to add some things to for this upgrade. For the rest we try to set the defaults so that you won't need to change anything after NuGet upgrades.


Sebastiaan Janssen 29 May 2017, 06:31:28

Unfortunately, I can't think of an XPath selector that will work with config transforms to be able to find this plugin. All we could do is remove all plugins and add the ones that we want, but that would then delete people's custom added plugins as well.

I've updated the upgrade guide both here https://our.umbraco.org/documentation/Getting-Started/Setup/Upgrading/version-specific and here https://our.umbraco.org/contribute/releases/761/


Sebastiaan Janssen 30 May 2017, 14:50:49

Update: after getting a PR to fix the issue with the umbracolink plugin, I realized what was going on here, I've left comments on the PR: https://github.com/umbraco/Umbraco-CMS/pull/1966

Note: since we can't automatically remove any reference to <plugin loadOnFrontend="true">umbracolink</plugin> in the config file, I think the proposed solution on the PR (leave plugin.min.js completely empty) is the best solution that will work the best for most people. The plugin should not be in your config, but if it accidentally is, it can defer to the correct behavior in our JS services.


Shannon Deminick 20 Jun 2017, 00:33:47

Ok, so a couple years ago when the Grid happened, in this revision the link picker was moved from a plugin to part of the tinymce service: 5d4f4376dd888e7b65d07c17f6245fcec744a1a2

I believe that mads probably didn't realize that the other plugin needed to be removed or updated but that's fine. Since then both sources have been maintained but of course there is no reason to keep maintaining the old plugin one.

@sebastiaan so yes, if we ship an empty file for plugin.min.js for the umbracolink plugin it should all 'just work' and it is what we expect since that file shouldn't be used and all functionality for the umbraco link is in the tinymce.service.js


Sebastiaan Janssen 20 Jun 2017, 08:17:12

Cool! Then it's fixed in: https://github.com/umbraco/Umbraco-CMS/commit/c27ca1fb0df4cb898cc69602c2dc6815ba687a5b


Sebastiaan Janssen 20 Jun 2017, 08:18:37

If anyone is still running into this issue, make sure ~/Umbraco/lib/tinymce/plugins/umbracolink/plugin.min.js is empty and then update the version in ClientDependency.config (just make it one higher or lower).


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.6.0

Due in version: 7.6.4

Sprint:

Story Points:

Cycle: 2