{:uriI"file:///workspace/app/assets/javascripts/type_station/editables/text_html_editor.js.coffee?type=application/javascript&pipeline=self&id=48770f7732043a5bc65c9f8ea199f0b06deb663c5dde4a4f23956f14bf14536f:ET:load_pathI"&/workspace/app/assets/javascripts;T: filenameI"X/workspace/app/assets/javascripts/type_station/editables/text_html_editor.js.coffee;T: nameI",type_station/editables/text_html_editor;T:logical_pathI"4type_station/editables/text_html_editor.self.js;T:content_typeI"application/javascript;T: sourceI" (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', 'h4', 'h5', '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); ;T: metadata{ :dependencieso:Set: @hash} I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"jprocessors:type=application/javascript&file_type=application/javascript&engines=.coffee&pipeline=self;TTI"ffile-digest:///workspace/app/assets/javascripts/type_station/editables/text_html_editor.js.coffee;TTF: requiredo;;}F: stubbedo;;}F: linkso;;}F: charsetI" utf-8;F: digest"%=(DǏv3`2EMb3: lengthi :dependencies_digest"%qC@@ t#tQF:\[qDz_k:idI"E48770f7732043a5bc65c9f8ea199f0b06deb663c5dde4a4f23956f14bf14536f;F: mtimel+Y