Sha256: d0ebb3b13017228fd8ea8ff1079e349461ce7d75b6614c68606499ac0b5201d7
Contents?: true
Size: 1017 Bytes
Versions: 31
Compression:
Stored size: 1017 Bytes
Contents
import {Controller} from '@hotwired/stimulus' import {Editor} from '@tiptap/core' import {StarterKit} from '@tiptap/starter-kit' export default class RichTextArea extends Controller { connect() { const editorElement = document.querySelector('.tiptap-editor') if (editorElement) { new Editor({ element: editorElement, extensions: [StarterKit], content: 'Hello World!', editorProps: { attributes: { class: 'ariadne-prose ariadne-prose-sm sm:ariadne-prose lg:ariadne-prose-lg xl:ariadne-prose-2xl ariadne-m-5 focus:ariadne-outline-none' } } }) const tiptapValueContainer = document.querySelector('input[data-tiptap-value-container=true]') if (tiptapValueContainer) { const parentForm = editorElement.closest('form') parentForm?.addEventListener('submit', () => { tiptapValueContainer.setAttribute('value', editorElement.textContent || '') }) } } } }
Version data entries
31 entries across 31 versions & 1 rubygems