Sha256: 0b24e884c5f9a1c05124e06f57fd632658759d3353d3cbeb65dd562c49f39c9c
Contents?: true
Size: 972 Bytes
Versions: 5
Compression:
Stored size: 972 Bytes
Contents
//= require ./preview_area (($) => { const COMPONENT_SELECTOR = '[data-thredded-post-form]'; class ThreddedPostForm { constructor() { this.textareaSelector = 'textarea'; } init($nodes) { let $textarea = $nodes.find(this.textareaSelector); this.autosize($textarea); $nodes.each(function() { new ThreddedPreviewArea($(this)); }); new ThreddedMentionAutocompletion($).init($nodes); } autosize($textarea) { $textarea.autosize() } destroy($nodes) { $nodes.find(this.textareaSelector).trigger('autosize.destroy'); } } window.Thredded.onPageLoad(() => { const $nodes = $(COMPONENT_SELECTOR); if ($nodes.length) { new ThreddedPostForm().init($nodes); } }); document.addEventListener('turbolinks:before-cache', () => { const $nodes = $(COMPONENT_SELECTOR); if ($nodes.length) { new ThreddedPostForm().destroy($nodes); } }); })(jQuery);
Version data entries
5 entries across 5 versions & 1 rubygems