From 233690b24dfc5695d7d31928aa2e14f65050bdd2 Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Wed, 2 Dec 2009 05:20:13 +0000 Subject: [PATCH] BUGFIX: is tinyMCE is not loaded, we cannot call its function. This is specially important in a pop-up of ComplexTableField git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@94238 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/LeftAndMain.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 5a1d2d82..687b1f7a 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -881,14 +881,16 @@ function nullConverter(url) { Behaviour.register({ 'textarea.htmleditor' : { initialize : function() { - tinyMCE.execCommand("mceAddControl", true, this.id); - this.isChanged = function() { - return tinyMCE.getInstanceById(this.id).isDirty(); - } - this.resetChanged = function() { - inst = tinyMCE.getInstanceById(this.id); - if (inst) inst.startContent = tinymce.trim(inst.getContent({format : 'raw', no_events : 1})); - } + if(typeof tinyMCE != 'undefined'){ + tinyMCE.execCommand("mceAddControl", true, this.id); + this.isChanged = function() { + return tinyMCE.getInstanceById(this.id).isDirty(); + } + this.resetChanged = function() { + inst = tinyMCE.getInstanceById(this.id); + if (inst) inst.startContent = tinymce.trim(inst.getContent({format : 'raw', no_events : 1})); + } + } } } })