{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+§ÉUI" length;Ti[ I" digest;TI"%a0de5c5fa7fb75dd9647ac4fe5d5bb61;FI" source;TI"[ (function() { var hasFontAwesome, haveFontAwesome, isIE, updateGlobalValue; hasFontAwesome = false; 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); }; haveFontAwesome = function() { var k, ref, ref1, stylesheet; if (!hasFontAwesome) { ref = document.styleSheets; for (k in ref) { stylesheet = ref[k]; if (stylesheet != null ? (ref1 = stylesheet.href) != null ? ref1.match(/font-awesome/g) : void 0 : void 0) { hasFontAwesome = true; break; } } } return hasFontAwesome; }; 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, disableToolbar: true, anchorInputPlaceholder: 'Type a link', imageDragging: false }; } else { this.$el.addClass('ts-block'); editorOptions = { buttons: ['bold', 'italic', 'underline', 'anchor', 'header1', 'header2', 'unorderedlist', 'orderedlist'], buttonLabels: (haveFontAwesome() ? 'fontawesome' : null), anchorInputPlaceholder: 'Type a link', imageDragging: false }; } this.editor = new MediumEditor(this.$el, editorOptions); this.editor.deactivate(); 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.activate(); 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.deactivate(); return this.$el.off('input'); }; return TextHtmlEditor; })(); }).call(this); ;TI"required_assets_digest;TI"%493bdcb1545d330a1838936153558502;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F