Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » SimpleHTMLEditorField in ModelAdmin?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1441 Views
  • micahsheets
    Avatar
    Community Member
    164 Posts

    SimpleHTMLEditorField in ModelAdmin? Link to this post

    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?

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: SimpleHTMLEditorField in ModelAdmin? Link to this post

    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

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: SimpleHTMLEditorField in ModelAdmin? Link to this post

    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

    1441 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.