TinyMCE and Comfy 1.8?

54 views
Skip to first unread message

Kevin Broderick

unread,
Aug 26, 2015, 9:38:33 PM8/26/15
to comfortable-mexican-sofa
I've inherited a Comfy 1.8 install that's part of a custom app running on Rails 3.1 (so we won't be switching to a newer version of Comfy until we can upgrade the whole app, which is a ways off).

I'd like to see about swapping the WYSIWIG editor to TinyMCE, but the wiki posts that apparently used to exist on the subject appear to be gone (I found a couple of links to pages on the GitHub wiki, but they redirected to the root page of the current CMS wiki). From what I've seen, I believe the general theory is to upload the TinyMCE script to the server and then install a modified app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee, but I was hoping that there might be a walkthrough still out there somewhere that I missed in my Googling (as learning from someone else's work is usually more efficient than straight-up trial and error).

Thanks,
Kevin

Kevin Broderick

unread,
Aug 27, 2015, 2:38:49 PM8/27/15
to comfortable-mexican-sofa
Since I've got it working on my installation now, here's a quick overview of the steps I took:
a) install the tinymce-rails gem (https://github.com/spohlenz/tinymce-rails), including creating a tinymce.yml as instructed
b) create an app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee file in my app
c) adjust (b) to suit, namely modifying the window.CMS.wysiwig block to:

window.CMS.wysiwyg = ->
  $('textarea[data-rich-text]').each (i, element) ->
    $(element).addClass("tinymce")
  tinyMCE.init({
    selector: 'textarea[data-rich-text]',
    menubar: false,
    plugins: "link image code",
    toolbar: "undo redo | cut copy paste | styleselect formatselect | bullist numlist blockquote | bold italic | removeformat | image | link | code",
    convert_urls: false,
    content_css: "/assets/newpub/style.css,/assets/newpub/discoveryfont.css"
  });

I'm not sure that adding the tinymce class to the textfields is necessary (I don't think it is with the selector provided in the tinymce init), and obviously some of the config options are a matter of preference in a given application, but overall the installation was quick and mostly painless.
Reply all
Reply to author
Forward
0 new messages