I"x (function() { $.extend(Alchemy.Tinymce, { customConfigs: {}, getDefaultConfig: function(id) { var config; config = this.defaults; config.language = Alchemy.locale; config.selector = "#tinymce_" + id; config.init_instance_callback = this.initInstanceCallback; return config; }, getConfig: function(id, selector) { var editor_config; editor_config = this.customConfigs[selector]; if (editor_config) { return $.extend({}, this.getDefaultConfig(id), editor_config); } else { return this.getDefaultConfig(id); } }, init: function(ids) { var i, id, len, results; results = []; for (i = 0, len = ids.length; i < len; i++) { id = ids[i]; results.push(this.initEditor(id)); } return results; }, initWith: function(options) { tinymce.init($.extend({}, this.defaults, options)); }, initEditor: function(id) { var config, spinner, textarea; textarea = $("#tinymce_" + id); if (textarea.length === 0) { Alchemy.log_error("Could not initialize TinyMCE for textarea#tinymce_" + id + "!"); return; } config = this.getConfig(id, textarea[0].classList[1]); if (config) { spinner = Alchemy.Spinner.small(); textarea.closest('.tinymce_container').prepend(spinner.spin().el); return tinymce.init(config); } else { return Alchemy.debug('No tinymce configuration found for', id); } }, initInstanceCallback: function(inst) { var $this, parent; $this = $("#" + inst.id); parent = $this.closest('.element-editor'); parent.find('.spinner').remove(); return inst.on('change', function(e) { return Alchemy.setElementDirty(parent); }); }, remove: function(ids) { var editor, i, id, len, results; results = []; for (i = 0, len = ids.length; i < len; i++) { id = ids[i]; editor = tinymce.get("tinymce_" + id); if (editor) { results.push(editor.remove()); } else { results.push(void 0); } } return results; }, removeFrom: function(selector) { $(selector).each(function() { var elem; elem = tinymce.get(this.id); if (elem) { elem.remove(); } }); } }); }).call(this); :ET