Sha256: 1be29943ac247c7c9fcdc4a95902a58ade005c5e8c1c952073a0e7ccb150b342
Contents?: true
Size: 861 Bytes
Versions: 5
Compression:
Stored size: 861 Bytes
Contents
(($) => { const COMPONENT_SELECTOR = '[data-thredded-post-form]'; class ThreddedPostForm { constructor() { this.textareaSelector = 'textarea'; } init($nodes) { let $textarea = $nodes.find(this.textareaSelector); this.autosize($textarea); 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