Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

SimpleHTMLEditorField in ModelAdmin?


Reply


3 Posts   1511 Views

Avatar
micahsheets

Community Member, 165 Posts

27 June 2009 at 8:53am

I may be trying to push SilverStipe way beyond it's intended purpose, but it is too late for me to go back now.

One thing I need to do is have an HTMLEditor on a DataObject I am managing with ModelAdmin. The normal HTMLEditorField has problems that SS don't seem to be in a hurry to fix. So I thought that maybe a workaround would be to use SimpleHTMLEditorField. So in my DataObject getCMSFields I replaced the HTMLEditorField with SimpleHTMLEditorField but while the normal one works some of the time the jwywiswg editor doesn't show up at all.

I have the newest DataObjectManager code installed on SS 2.3.2.

Is it possible that the problem that plagues tinymce in ModelAdmin also is the problem with the jwywiswg editor?

Avatar
BLU42 Media

Community Member, 71 Posts

14 July 2009 at 10:10am

I ran into the same problem for two client sites at the same time... so I really needed a fix for this. I realize that SS is not actively pursuing supporting HTMLEditorFields in ModelAdmin... but it sure would be a nice addition.

In ModelAdmin.js, around line 187 in 2.3.2... you'll see the form vars. Put the following line in before posting the data to save:

$('#right form textarea').each(function(){
   tinyMCE.execCommand('mceRemoveControl', false, $(this).attr('id'));
});

Hope it helps! Let me know how it works out for you.

John

Avatar
BLU42 Media

Community Member, 71 Posts

14 July 2009 at 4:48pm

I ended up adding a few more iterations of the previously mentioned code block in ModelAdmin.js:

* In the function around line 81 before $('ModelAdminPanel').load() is called
* At the start of both the goBack and goForward functions