Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Widgets /

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

HTML widget in 2.3.0


Reply


20 Posts   7399 Views

Avatar
ravid

Community Member, 6 Posts

12 January 2010 at 12:03am

Edited: 12/01/2010 12:08am

Modifying the tinymce-code is a quick and dirty way to fix this issue because it does not really solve the problem for a long time (update compatibility, etc.).
The proper solution is to alter the silverstripe code to make it remove the editor from tinymces list of active editors before removing the widgets html object from the dom.

You can leave your tiny_mce_src.js as it is and modify the “cms/javascript/WidgetAreaEditor.js” on line 126 like this (or use attached file):

Change

deleteWidget: function(widgetToRemove) {
   // Remove a widget from the used widgets column
   $('WidgetAreaEditor_usedWidgets').removeChild(widgetToRemove);
}

To

deleteWidget: function(widgetToRemove) {
   // Remove the widgets htmleditor areas from tinymces list
   jQuery(widgetToRemove).find('textarea[id]').each(function () {
      var tinyId = jQuery(this).attr('id');
      if (tinyMCE.get(tinyId)) {
         tinyMCE.execCommand('mceFocus', false, tinyId);
         tinyMCE.execCommand('mceRemoveControl', false, tinyId);
      }
   });
   // Remove a widget from the used widgets column
   $('WidgetAreaEditor_usedWidgets').removeChild(widgetToRemove);
}

I will commit this changes to silverstripe to have this problem removed permanently for the future.

Attached Files
Avatar
ravid

Community Member, 6 Posts

12 January 2010 at 12:36am

my previous post is related to silverstripe version 2.3.4

Avatar
Jeramie

Community Member, 34 Posts

5 February 2010 at 11:55am

I was able to correct the issue with Tiny MCE by applying the fix that FungshuiElephant referred to in this post http://www.silverstripe.org/widgets-2/show/258893?start=0#post261255

I am using SS 2.3.4 and dont have any other widgets in use, so I am not sure if it affects other widgets, but it loads the Tiny MCE HTML editor properly on every visit to the Widget admin area.

Avatar
CHD

Community Member, 218 Posts

18 January 2012 at 11:13pm

Edited: 18/01/2012 11:22pm

We got our widgets working on all pages eventually, here's our solution. Hopefully it helps!

http://www.clickheredigital.co.uk/blog/bad-widget-class-name-given-our-experience-with-widgets-on-any-silverstripe-page