简体   繁体   中英

TinyMCE doesn't work on FireFox

I'm trying to use tinymce editor in my website but, afert inserting its code it doesnt work on firefox (on IE9 works well, no bugs etc.). This how my code look like:

<tr>
    <td class="ui-corner-left" style="width:200px; font-size:14px;color:#fff; background:#606060; padding:5px;">Wiadomość</td>
    <td class="ui-corner-right" style="font-size:14px; background:#eaeaea; padding:5px;">&nbsp;</td>
</tr>
<tr>
     <td>&nbsp;</td>
     <td style="padding:5px;"><textarea id="tinymce" name="wiadomosc" cols="50" rows="10" style="width:100%;"><?php echo set_value('wiadomosc'); ?></textarea>
     </td>
</tr> 

Declaration:

<script type="text/javascript" src="<?=base_url()?>js/tinymce/tinymce.min.js"></script>

And connecting with textarea:

tinyMCE.baseURL = "<?=base_url()?>js/tinymce/";
    tinymce.init({
    selector: "textarea",
    language : 'pl',
    menubar: false,
    convert_urls : false,
    relative_urls : false,
    plugins: "textcolor, code",
    toolbar: "undo,redo,|,bold,italic,underline,strikethrough,|,alignleft,aligncenter,alignright,alignjustify,|,cut,copy,paste,pastetext,pasteword,|,forecolor,|,code",
    }); 

This is what Firebug says:

Failed to load: http://192.168.200.233/js/tinymce//themes/modern/themeundefined.js
Failed to load: http://192.168.200.233/js/tinymce//plugins/code/pluginundefined.js
Failed to load: http://192.168.200.233/js/tinymce//plugins/textcolor/pluginundefined.js

Im using codeigniter and jQuery.

This code work good in 10 other files but not in this one, i have no idea why.

This can happen if TinyMCE cannot determine the correct suffix for its plugin / theme files. Usually this happens when you rename the TinyMCE main script file. Note that the TinyMCE script loader has a hard-coded list of recognized file names:

// Script types supported:
// tinymce.js tinymce.min.js tinymce.dev.js
// tinymce.jquery.js tinymce.jquery.min.js tinymce.jquery.dev.js
// tinymce.full.js tinymce.full.min.js tinymce.full.dev.js

so you might need to provide the default ".min" suffix programmatically if you really need to have a non-standard file name for the main TinyMCE script file:

tinymce.suffix = ".min"

Please try this code it will work 100%

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
 <script type="text/javascript">
    tinymce.init({
    selector: "textarea",
    theme: "modern",
    font_size_classes : "fontSize1, fontSize2, fontSize3, fontSize4, fontSize5, fontSize6",
    plugins: [
         "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
         "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
         "save table contextmenu directionality emoticons template paste textcolor"
   ],

   toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | sizeselect | fontselect | fontsize | fontsizeselect", 
   style_formats: [
        {title: 'Bold text', inline: 'b'},
        {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
        {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
        {title: 'Example 1', inline: 'span', classes: 'example1'},
        {title: 'Example 2', inline: 'span', classes: 'example2'},
        {title: 'Table styles'},
        {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
    ]
 });
</script>

<body>
<textarea name="text_box"></textarea>
</body>
</html>

embed the js inside the php.

or

you should find relative path to your js folder(not using base_url)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM