Jump to:

23378 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Firefox 11 and multiple TinyMCE HTMLTextFields

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1900 Views
  • bartvanirsel
    Avatar
    Community Member
    94 Posts

    Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    Hi,

    I had a problem with multiple TinyMCE editors in the latest release of Firefox (11) not being displayed.
    Silverstripe 3 wont have this problem, because TinyMCE will probably be the latest version.

    For anyone who had the same problem, i found a temporarily solution for Silverstripe 2.4:

    in your _config.php include a custom js file for the cms:

    LeftAndMain::require_javascript('mysite/javascript/cms.js');

    in this javacsript add the folowing:

    Behaviour.register({
    '#Form_EditForm' : {
    initialize : function() {
    this.observeMethod('PageLoaded', this.adminPageHandler);
    this.adminPageHandler();
    },
    adminPageHandler : function() {

    jQuery(window).load( function() {
    jQuery(".mceEditor .mceLayout").each(function(i,ele){
    jQuery("#"+ele.id).css('width',jQuery("#"+ele.id).width()+10)
    });
    });

    }
    }
    });

    Credits for the fix for older tinmce version in firefox 11 go to:
    http://stackoverflow.com/questions/9837629/tinymce-and-firefox-11

    Hope this helps you.

    Cheers,

    Bart

  • bartvanirsel
    Avatar
    Community Member
    94 Posts

    Re: Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    Above solution does not work after all, hope anyone else did manage to solve it

  • bartvanirsel
    Avatar
    Community Member
    94 Posts

    Re: Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    Kind of a lonely conversation with myself but the js needs to be the following to fix it:

    Behaviour.register({
    '#Form_EditForm' : {
    initialize : function() {
    this.observeMethod('PageLoaded', this.adminPageHandler);
    this.adminPageHandler();
    },
    adminPageHandler : function() {

    },
    onload : function() {
    jQuery(".mceEditor .mceLayout").each(function(i,ele){
    jQuery("#"+ele.id).css('width',jQuery("#"+ele.id).width()+1)
    });
    }
    }
    });

    cheers,

    Bart

  • MartinDoornekamp
    Avatar
    Community Member
    1 Post

    Re: Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    Thanks Bart!

  • edski
    Avatar
    Community Member
    12 Posts

    Re: Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    Thanks, Bart - I've been looking out for a fix for this!

    Has anyone resolved it for front end forms? We've got some sites with fairly complicated forms for end users and the same thing happens.

  • edski
    Avatar
    Community Member
    12 Posts

    Re: Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    We've managed to figure this out, albeit slightly crudely. In the ss template file add the following:

    <script type="text/javascript">

          var FIREFOX = /Firefox/i.test(navigator.userAgent);
          if (FIREFOX) {
             jQuery(window).load( function() {
                
                jQuery(".mceEditor .mceLayout iframe").each(function(i,ele){
                   jQuery(this).css('width',jQuery(this).width()+1);
                });
             });
          }
       </script>

  • edski
    Avatar
    Community Member
    12 Posts

    Re: Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    The issue is also happening when using a DataObjectManager popup with multiple editors.

    Has anyone experienced the same issue?

  • edski
    Avatar
    Community Member
    12 Posts

    Re: Firefox 11 and multiple TinyMCE HTMLTextFields Link to this post

    This patch is crude, but it works! Essentially add a literal field to the DataObjectManager popup with the appropriate JS in it:

    class MyDataObject extends DataObject{

    $FFpatch = '<script type="text/javascript">var FIREFOX = /Firefox/i.test(navigator.userAgent);if (FIREFOX) {jQuery(window).load( function() {jQuery(".mceEditor .mceLayout iframe").each(function(i,ele){jQuery(this).css(\'width\',jQuery(this).width()+1);});});}</script>';

    public function getCMSFields_forPopup()
    {
    ...
    return new FieldSet(
    ...
    new LiteralField("FFPatch", $FFpatch)
    );

    }
    }

    1900 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.