Sha256: 03fea8e0605049997dcfda923987f65441873ceefa1dfceb910b54eabb301cca
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
// = require quill.min // = require_self $(() => { const $container = $('.editor-container'); const quillFormats = ['bold', 'italic', 'link', 'underline', 'header', 'list', 'video']; $container.each((idx, container) => { const toolbar = $(container).data('toolbar'); let quillToolbar = [ ['bold', 'italic', 'underline'], [{ list: 'ordered' }, { list: 'bullet' }], ['link', 'video', 'clean'] ]; if (toolbar === 'full') { quillToolbar = [ [{ header: [1, 2, 3, 4, 5, 6, false] }], ...quillToolbar ]; } const $input = $(container).siblings('input[type="hidden"]'); const quill = new Quill(container, { modules: { toolbar: quillToolbar }, formats: quillFormats, theme: 'snow' }); quill.on('text-change', () => { const text = quill.getText(); if (text === '\n') { $input.val(''); } else { $input.val(quill.root.innerHTML); } }); quill.root.innerHTML = $input.val(); }); });
Version data entries
6 entries across 6 versions & 1 rubygems