tinymce4 old-scool-toolbar
Posted: Thu 6. Oct 2016, 19:53
I have been using CMSimple a very long time (since the days of Peter Harteg), and I really misses the look of his editor (OEdit). Of course is it not useful in today's websites, but I have created an alternative, that is useful, at least for me.
First: I created a plugin in TinyMCE4, called stylebuttons: (I found this on the web):
toolbar1: "save | selectall | cut | copy | paste | undo | redo | code | alignleft | aligncenter | alignright | hr | image | link | unlink | charmap |",
toolbar2: " | style-h1 | style-h2 | style-h3 | style-h4 | style-p | bold | italic | underline | removeformat | bullist | numlist | subscript | superscript | outdent | indent | ",
and saved it under another name
and now I have a very neat editor, that looks like this:
http://birch-web.dk/Files/tinymce/screendump.png
The finished toolbar can be downloaded from here: http://birch-web.dk/Files/tinymce/Stylebuttons.7z Just extract the archive at the root of your site, and change tinymce's toolbar to "CMSimple" .
The only thing I miss is to figure out, is how to put text or symbol in the "select all" button
Regards
Henrik Birch
First: I created a plugin in TinyMCE4, called stylebuttons: (I found this on the web):
Then I edited the init_full.js, and replaced the toolbar section with this:TinyMCE formatting toolbar buttons
There's this WSIWYG editor called wysihtml5 that looks very nice. Unfortunatelly there's no table support so TinyMCE could be one of the alternative. I really like having buttons for each type of heading - less clicking to format the text. Unfortunatewlly in TinyMCE you have to deal with submenus for formatting. I would rather have plain toolbar buttons.
As you can see here the documentation is not very helpful on how to do it so I'd rather share the solution. Here's a plugin for having the formatting as plain toolbar buttons, just like in wysihtml5:
tinyMCE.PluginManager.add('stylebuttons', function(editor, url) {
['pre', 'p', 'code', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].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);
}
})
});
});
Now just add stylebuttons to your plugin list and any of style-p, style-h1, style-h2, style-h3, style-pre, style-code to your toolbar list. Eg:
tinyMCE.init({
selector: '#id',
toolbar: "undo redo | style-p style-h1 style-h2 style-h3 style-pre style-code",
plugins: "stylebuttons",
});
toolbar1: "save | selectall | cut | copy | paste | undo | redo | code | alignleft | aligncenter | alignright | hr | image | link | unlink | charmap |",
toolbar2: " | style-h1 | style-h2 | style-h3 | style-h4 | style-p | bold | italic | underline | removeformat | bullist | numlist | subscript | superscript | outdent | indent | ",
and saved it under another name
and now I have a very neat editor, that looks like this:
http://birch-web.dk/Files/tinymce/screendump.png
The finished toolbar can be downloaded from here: http://birch-web.dk/Files/tinymce/Stylebuttons.7z Just extract the archive at the root of your site, and change tinymce's toolbar to "CMSimple" .
The only thing I miss is to figure out, is how to put text or symbol in the "select all" button
Regards
Henrik Birch