Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » SimpleTinyMCE field not working--javascript problem

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 879 Views
  • theoldlr
    Avatar
    Community Member
    103 Posts

    SimpleTinyMCE field not working--javascript problem Link to this post

    My SimpleTinyMCEField has no buttons. I'm getting a JS error in firebug that points to '$(function(){' in this script:

    <script type="text/javascript">//<![CDATA[

    $(function() {
    $('#DataObjectManager_Popup_AddForm_Biography').tinymce({
    plugins : 'safari,paste',
    theme : 'advanced',
    theme_advanced_buttons1 : 'bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,styleselect,formatselect',theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,link,unlink,anchor,image,|,code',theme_advanced_buttons3 : '',theme_advanced_buttons4 : '',
    theme_advanced_toolbar_location : 'top',
    theme_advanced_toolbar_align : 'left',
    theme_advanced_statusbar_location : 'bottom',
    theme_advanced_resizing : false,
    paste_auto_cleanup_on_paste : true,
    paste_remove_spans: true,
    paste_remove_styles: true,
    content_css : ''

    });
    });

    //]]></script>

    I'm not sure how to fix this--I have no custom JS in the CMS here, it's all SS (2.4.5) and DOM (using r540)
    Nothing jumps out at me immediately here except that it mentions 'safari' and I'm using firefox. It is on a mac though.
    Any ideas? Thanks!

  • s!m
    Avatar
    Community Member
    9 Posts

    Re: SimpleTinyMCE field not working--javascript problem Link to this post

    Hi theoldlr,

    I've come across the same problem this morning, so I decided to share my simple solution:

    The problem is, that sometimes not only jQuery but also prototype is included in the CMS, but both libraries are using the '$'-sign for different things, so the simple solution is to replace

    $(function() {


    with

    jQuery(function($) {


    in line 186 in SimpleTinyMCEField.php
    and you should have your SimpleTinyMCEField working...

    @UncleCheese: I've attached a patch for this, maybe it would be useful to include this in dom's trunk...
    link: http://pastie.org/1659285

    879 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.