Open hadmut opened 6 years ago
Try removing the space between function
and the parameters:
setup: 'function(ed) { ... }'
yeah. that helps. interesting. Almost all programming examples come with a space (e.g. https://www.tiny.cloud/docs/advanced/creating-a-custom-button/ and js is none of my common programming languages.)
However, this brings me one step further into the next problem. I'm calling my own function
function mytinymcesetup(editor) {
console.info("Start mytinymcesetup");
console.info(editor);
editor.addButton('mybutton', {
text: 'My button',
onclick: function () {
editor.insertContent(' <b>It\'s my button!</b> ');
}
});
console.info("End mytinymcesetup");
}
which is run after fixing that problem (output seen on the console), but that button I need to create is not created.
Is it possible that tinymce-rails overrides that?
yeah. that helps. interesting. Almost all programming examples come with a space (e.g. https://www.tiny.cloud/docs/advanced/creating-a-custom-button/ and js is none of my common programming languages.)
My personal coding preference is for no space there (hence the current behaviour). However I'd definitely accept a PR to change that and accept whitespace between function
and (
.
which is run after fixing that problem (output seen on the console), but that button I need to create is not created. Is it possible that tinymce-rails overrides that?
I think what you may need to do is add it explicitly to the toolbar if you haven't already. That's the only thing that comes to my mind right now.
Hi, (I'm not experienced with tinymce so far).
I'm currently working on a rails project with tinymce, using the tinymce-rails 4.8.2. It works as long as I configure through the config/tinymce.yml only.
Now I needed to add custom buttons and, following some examples given in the web therefore added an init function, but even a simple
setup: function (ed) { }
or
setup: 'function (ed) { }'
in the config/tinymce.yml causes the editor to fail and to issue
tinymce.self-1c5f1e7…e19.js?body=1:25152 Uncaught TypeError: Cannot read property 'apply' of undefined
on the console. Unfortunately the docs for the gem don't mention how to custom-setup the editor.
regards