Short Tip: TinyMCE errors and Sugar.js

Published: Fri 14 November 2014
By ali In JavaScript.

Just in case you are using TinyMCE in your Rails project and something like this has ever happened to you:

tiny.gif

including both TinyMCE and Sugar.js is the culprit. Somehow Sugar.js's methods which are defined on native JavaScript objects interfere with TinyMCE (which is about 100k LOC, according to cloc, so don't bother debugging). Isolating the cause of the errors shown above did cost me several hours of desperate debugging, because they were not noticed for months, and I had to inspect every change that was made since it was reportedly working.

links