{I" class:ETI"ProcessedAsset;FI"logical_path;TI"(type_station/editables/text_html.js;FI" pathname;TI"n/Users/richardadams/github/type_station/app/assets/javascripts/type_station/editables/text_html.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+Ô.âTI" length;Tic I" digest;TI"%e74cb31449a22ac188dae2c4ad7edb4d;FI" source;TI"c (function() { var hasFontAwesome, haveFontAwesome, updateGlobalValue; hasFontAwesome = false; updateGlobalValue = function($el, value) { var match; match = "[data-ts-key=" + ($el.data('ts-key')) + "][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, stylesheet, _ref, _ref1; 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; }; window.TS.EditableText = (function() { function EditableText(_at_elements) { this.elements = _at_elements; this.editor = new MediumEditor(this.elements, { disableReturn: true, buttons: ['bold', 'italic', 'underline', 'anchor'], buttons: [], anchorInputPlaceholder: 'Type a link' }); this.editor.deactivate(); } EditableText.prototype.enable = function() { this.editor.activate(); return this.elements.on('input', function() { var model; model = window.TS.getModel($(this).data('ts-url')); if ($(this).is(':input')) { model.set($(this).data('ts-key'), { field: $(this).data('ts-key'), value: $(this).val(), type: 'text' }); return updateGlobalValue($(this), $(this).val()); } else { model.set($(this).data('ts-key'), { field: $(this).data('ts-key'), value: $(this).html(), type: 'text' }); return updateGlobalValue($(this), $(this).html()); } }); }; EditableText.prototype.disable = function() { this.editor.deactivate(); return this.elements.off('input'); }; return EditableText; })(); window.TS.EditableHtml = (function() { function EditableHtml(_at_elements) { this.elements = _at_elements; this.editor = new MediumEditor(this.elements, { buttons: ['bold', 'italic', 'underline', 'anchor', 'header1', 'header2', 'unorderedlist', 'orderedlist'], buttonLabels: (haveFontAwesome() ? 'fontawesome' : null), anchorInputPlaceholder: 'Type a link' }); this.editor.deactivate(); } EditableHtml.prototype.enable = function() { this.editor.activate(); return this.elements.on('input', function() { var model; model = window.TS.getModel($(this).data('ts-url')); if ($(this).is(':input')) { model.set($(this).data('ts-key'), { field: $(this).data('ts-key'), value: $(this).val(), type: 'html' }); return updateGlobalValue($(this), $(this).val()); } else { model.set($(this).data('ts-key'), { field: $(this).data('ts-key'), value: $(this).html(), type: 'html' }); return updateGlobalValue($(this), $(this).html()); } }); }; EditableHtml.prototype.disable = function() { this.editor.deactivate(); return this.elements.off('input'); }; return EditableHtml; })(); }).call(this); ;TI"dependency_digest;TI"%e3f672e3d22ae9f78ea82dd90fce38c1;FI"required_paths;T[I"n/Users/richardadams/github/type_station/app/assets/javascripts/type_station/editables/text_html.js.coffee;FI"dependency_paths;T[{I" path;TI"n/Users/richardadams/github/type_station/app/assets/javascripts/type_station/editables/text_html.js.coffee;FI" mtime;TI"2015-02-16T17:54:28+00:00;TI" digest;TI"%c8a43bdbd0318788f3ade1b90bf27592;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F