- Forums
- Scripts
- Tinymce Cannot Load Default /themes/modern/theme.js
if you cannot make tinymce plugin work on your first installation, and you are getting an error this page will help you. [4645], Last Updated: Mon Jun 24, 2024
Ellaham
Wed Feb 01, 2017
0 Comments
2074 Visits
recently installed tinymce wysiwyg text editor for my textareas and when i first installed it, i doesnt work because it cannot find the default theme.
looking at the console i see a 404 error that says /themes/modern/theme.js doesn't exist.
from what i can tell, the path is wrong, because its showing the path as: http://www.example.com//themes/modern/theme.js
i researched it at tinymce.com and found some settings that didnt work, for example:
https://www.tinymce.com/docs/configure/url-handling/#qhowdoiconvertmyurlstorelativeabsoluteorabsolutewithdomain
i could not make it work with
relative_urls : true,
document_base_url : "http://www.example.com/path1/"
relative_urls : false,
remove_script_host : true,
document_base_url : "http://www.example.com/path1/"
or
relative_urls : false,
remove_script_host : false,
document_base_url : "http://www.example.com/path1/"
after trying and trying, finally found the solution here:
http://stackoverflow.com/questions/4412589/tinymce-paths-how-to-specify-where-to-load-things-like-editor-plugin-js
so all you need to add is tinyMCE.baseURL = "your/path/";
thats it, it should work
this ia good configuration i use in admin_inc/admin-functions.js
usage : <textarea class="tinymce"></textarea>
$( '.tinymce' ).livequery(function(){
$.get( "admin_inc/tinymce/js/tinymce/tinymce.min.js", function( data ) {
//$( ".result" ).html( data );
// alert( "Load was performed." );
//http://stackoverflow.com/questions/4412589/tinymce-paths-how-to-specify-where-to-load-things-like-editor-plugin-js
tinyMCE.baseURL = "admin_inc/tinymce/js/tinymce";// trailing slash important
//http://stackoverflow.com/questions/19761857/how-to-take-heading-h1-h2-h3-directly-on-toolbar-in-tinymce-4
tinyMCE.PluginManager.add('stylebuttons', function(editor, url) {
['pre', 'p', 'code', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' , 'b' ].forEach(function(name){
editor.addButton("style-" + name, {
tooltip: "Toggle " + name,
text: name.toUpperCase(),
onClick: function() { editor.execCommand('mceToggleFormat', false, name); },
onPostRender: function() {
var self = this, setup = function() {
editor.formatter.formatChanged(name, function(state) {
self.active(state);
});
};
editor.formatter ? setup() : editor.on('init', setup);
}
})
});
});
tinyMCE.init({
selector: '.tinymce' // change this value according to your HTML,
// theme : "simple" will go to themes/simple/theme.js
,toolbar: "undo redo | style-p style-h1 style-h2 style-h3 style-pre style-code | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
plugins: "stylebuttons",
});
});
//var text = window.getSelection().toString();
//alert('hello');
});