nathancox / silverstripe-customhtmleditorfield

A couple of hacks to allow per-editor content styles and TinyMCE configurations in SilverStripe 3
16 stars 8 forks source link

TinyMCE popups break globally on 3.1.8 #13

Open Tangdongle opened 9 years ago

Tangdongle commented 9 years ago

When adding a new config and setting on an HTMLEditorField, popups cease to function on the default HTMLEditorField. This includes, Link, HTML Editor, Special Character Editor and the Table button.

nathancox commented 9 years ago

So far I can't seem to reproduce this. Can you give me some example code that's not working for you?

stevie-mayhew commented 9 years ago

@Tangdongle - it might be because the code I provided you with changes the body class of the editor, perhaps try removing the line $footerField->setBodyClass('banner-content'); from the configuration and see if that works?

Tangdongle commented 9 years ago

Using this config: $simpleConfig = HTMLEditorConfig::get('simple'); $simpleConfig->setButtonsForLine(1, array( 'bold', 'underline', 'link', 'unlink', )); $simpleConfig->setButtonsForLine(2, array());

And with this set on the editor: $simpleHTMLEditor = new HTMLEditorField('c1', ''); $simpleHTMLEditor->setEditorConfig('simple');

And with a 'simple' HTMLEditorField and SS' default Content HTMLEditorField on the same tab. Edit: It seems it only occurs when you refresh the CMS, yet functions fine when you move between pages.

nathancox commented 9 years ago

A bit of experimenting tells me the problem seems to be HTMLEditorConfig::get('simple');. Just having that in there causes error even if there's no associated field.

I'll look into it further but as a quick fix this seems to work:

$simpleConfig =  CustomHtmlEditorConfig::copy('simple', 'cms');

I suspect the problem is that initialising a blank config (even with CustomHtmlEditorConfig::copy('simple', 'simple'); makes it miss some required setting that's in the cms config.