U4-1853 - Tinymce with the format dropdown added as soon as you interact with it the content tree stops working [Uncaught TypeError: Cannot set property 'href' of undefined (anonymous function) DependencyHandler.axd:57] Chrome Only..

Created by Mike Chambers 06 Mar 2013, 14:27:57 Updated by Marc Love 23 Oct 2014, 10:33:47

So we've added the format drop down by updating the tinymce.config stylePicker images/editor/showStyles.png umbracocss 20

formatPicker images/editor/showFormats.png formatselect 21 {code}

This has worked fine from 4.52 to 4.7 in our experience

but now we have the issue where you use the format drop down to set h2 or h3 etc on RTE content and from that point on even after publish save/interacting with other tinymce options... as soon as you click on the content tree to move to another node nothing happens and console reports

Uncaught TypeError: Cannot set property 'href' of undefined (anonymous function) DependencyHandler.axd:57 This is from 4.11 onwards.. but we skipped 4.9/4.10 so could also happen there.

below is the codeblock that seems to be the reference.

Umbraco.Sys.registerNamespace("Umbraco.Application");(function($){Umbraco.Application.ClientManager=function(){return{_isDirty:false,_isDebug:false,_mainTree:null,_appActions:null,_historyMgr:null,_rootPath:"/umbraco",_modal:new Array(),historyManager:function(){if(!this._historyMgr){this._historyMgr=new Umbraco.Controls.HistoryManager();} return this._historyMgr;},setUmbracoPath:function(strPath){this._debug("setUmbracoPath: "+ strPath);this._rootPath=strPath;},mainWindow:function(){return top;},mainTree:function(){if(this._mainTreenull){if(this.mainWindow().jQuerynull||this.mainWindow().jQuery(".umbTree").length0||this.mainWindow().jQuery(".umbTree").UmbracoTreeAPI()null){var tmpTree=;var treeProps=["init","setRecycleBinNodeId","clearTreeCache","toggleEditMode","refreshTree","rebuildTree","saveTreeState","syncTree","childNodeCreated","moveNode","copyNode","findNode","selectNode","reloadActionNode","getActionNode","setActiveTreeType","getNodeDef"];for(var p in treeProps){tmpTree[treeProps[p]]=function(){return false;};} this._mainTree=tmpTree;} else} return this._mainTree;},appActions:function(){if(this._appActionsnull){if(typeof this.mainWindow().appActions'undefined'){this._appActions=new Umbraco.Application.Actions();} else this._appActions=this.mainWindow().appActions;} return this._appActions;},uiKeys:function(){return this.mainWindow().uiKeys;},contentFrameAndSection:function(app,rightFrameUrl),200);},contentFrame:function(strLocation){this._debug("contentFrame: "+ strLocation);if(strLocationnull||strLocation""){if(typeof this.mainWindow().right!="undefined"){return this.mainWindow().right;} else{return this.mainWindow();}} else{if(strLocation.substr(0,1)!="/"){strLocation=this._rootPath +"/"+ strLocation;} else if(strLocation.length>=this._rootPath.length&&strLocation.substr(0,this._rootPath.length)!=this._rootPath){strLocation=this._rootPath +"/"+ strLocation;} this._debug("contentFrame: parsed location: "+ strLocation);var self=this;window.setTimeout(function(){if(typeof self.mainWindow().right!="undefined"){self.mainWindow().right.location.href=strLocation;} else{self.mainWindow().location.href=strLocation;}},200);}},openModalWindow:function(url,name,showHeader,width,height,top,leftOffset,closeTriggers,onCloseCallback){if(window==this.mainWindow()||!this.mainWindow().UmbClientMgr){var m=new Umbraco.Controls.ModalWindow();this._modal.push(m);m.open(url,name,showHeader,width,height,top,leftOffset,closeTriggers,onCloseCallback);} else{if(this.mainWindow().UmbClientMgr){this.mainWindow().UmbClientMgr.openModalWindow.apply(this.mainWindow().UmbClientMgr,[url,name,showHeader,width,height,top,leftOffset,closeTriggers,onCloseCallback]);} else{return;}}},closeModalWindow:function(rVal){if(this._modal!=null&&this._modal.length>0){this._modal.pop().close(rVal);} else else{return;}} else if(typeof window.parent.UmbClientMgr!="undefined") mgr.closeModalWindow.call(mgr,rVal);}},_debug:function(strMsg){if(this._isDebug){Sys.Debug.trace("UmbClientMgr: "+ strMsg);}},get_isDirty:function(){return this._isDirty;},set_isDirty:function(value)}}})(jQuery);var UmbClientMgr=new Umbraco.Application.ClientManager();

and seems to be eroring here self.mainWindow().right.location.href=strLocation;

Any help much appreciated.


Mike Chambers 06 Mar 2013, 14:47:25

Updated this as appears to be chrome only issue. (ff/opera/ie/safari all fine)

Shannon Deminick 08 Apr 2013, 18:32:05

Can you set debug='true' in your web.config so that CDF is disabled, then the JS error will tell you what file/class is at fault.

Dan White 08 Apr 2013, 18:43:07

UmbracoClientManager.js line 136.

Also interesting: it doesn't happen when preview_styles is set to false in tinymce config. I don't know if that means it has to do with the getPreviewCss function in editor_template_src.js.

Mads Krohn 23 May 2013, 21:50:36

Would really like an update on this one. Been running in to it for weeks without knowing the root cause. Such a pain this one is :(

Can Koluman 16 Apr 2014, 14:34:41

I ran into this now as well for a 6.0.6 project.

It appears an unknown bug is leading to this:

Prior to selecting a format: top.frames.length 2 top.frames[0].name "right" top.frames[1].name "umbModalBoxIframe"

After selecting a format: top.frames.length 2 top.frames[0].name "h6" top.frames[1].name "umbModalBoxIframe"

Note that the correct frame name, which should be 'right' has been over-written, along with its properties...

Can Koluman 16 Apr 2014, 15:46:55

OK, it turns out the issue originates from a scope collision involving the 'name' variable. The 'name' variable is not initialised, and then when it is assigned locally, the assignment is actually global.

In umbraco_client\Tinymce3\Themes\Umbraco\editor_template_src.js,

function getPreviewCss(....

  • var previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;
  • var name, previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;

Should resolve this issue. Cheers.

Can Koluman 16 Apr 2014, 15:53:23

Hi Shannon, I am sending this your way as you had responded originally, it appears the error was introduced in v 4.11.x and is present through 6.1.6. Cheers again.

Shannon Deminick 22 Apr 2014, 08:01:58

Good find, seems the same issue exists in that js file for the variable "previewStyles". Will fix some of these JS discrepancies up in this file. Hard to tell whats happened with this file based on it's history but there's a few ugly JS issues in there.

Can Koluman 22 Apr 2014, 08:22:29

Cheers. Many thanks for the fix.

Mads Krohn 22 Apr 2014, 08:22:55

13 month wait time, 20 minute fix time, someone should have made a PR a loooong time ago :P

Priority: Major

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Very Easy

Category: UI

Backwards Compatible: True

Fix Submitted: Inline code

Affected versions: 4.11.0, 4.11.1, 4.11.2, 4.11.3, 4.11.4, 6.0.1, 4.11.5, 6.0.2, 4.11.6, 6.0.3

Due in version: 6.2.0


Story Points: