{I" class:ETI"BundledAsset;FI"logical_path;TI"/type_station/editables/text_html_editor.js;FI" pathname;TI"X/workspace/app/assets/javascripts/type_station/editables/text_html_editor.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+R#HWI" length;Ti I" digest;TI"%ab6ff02baf7d03cef9debc286dfe1cc0;FI" source;TI" (function() { var isIE, updateGlobalValue; updateGlobalValue = function($el, value) { var match; match = "[data-ts-field=" + ($el.data('ts-field')) + "][data-ts-id=" + ($el.data('ts-id')) + "]"; $("input" + match).not($el).val(value); return $("" + match).not(':input').not($el).html(value); }; isIE = function() { return !!(navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0); }; this.TypeStation.TextHtmlEditor = (function() { function TextHtmlEditor(ts, $el1, data) { var editorOptions; this.ts = ts; this.$el = $el1; this.data = data; if (this.data.type === 'text') { this.$el.addClass('ts-block-text'); editorOptions = { disableReturn: true, toolbar: false, imageDragging: false }; } else { this.$el.addClass('ts-block'); editorOptions = { toolbar: { buttons: ['bold', 'italic', 'underline', 'anchor', 'h1', 'h2', 'h3', 'unorderedlist', 'orderedlist', 'removeFormat'] }, imageDragging: false }; } this.editor = new MediumEditor(this.$el, editorOptions); this.editor.destroy(); this.$el.attr('data-ts-id', this.data.id).attr('data-ts-field', this.data.field); } TextHtmlEditor.prototype.enable = function() { var eventName, self; this.editor.setup(); self = this; eventName = isIE() ? 'keyup' : 'input'; return this.$el.on(eventName, function() { var model; model = self.ts.getModel(self.data.url); if ($(this).is(':input')) { model.set(self.data.field, { field: self.data.field, value: $(this).val(), type: self.data.type }); return updateGlobalValue($(this), $(this).val()); } else { model.set(self.data.field, { field: self.data.field, value: $(this).html(), type: self.data.type }); return updateGlobalValue($(this), $(this).html()); } }); }; TextHtmlEditor.prototype.disable = function() { this.editor.destroy(); return this.$el.off('input'); }; return TextHtmlEditor; })(); }).call(this); ;TI"required_assets_digest;TI"%f5ab854c58d0e12e8b7b8d82e63fc719;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F