monsieurbiz / SyliusRichEditorPlugin

This plugin add a rich editor on fields to be able to drag and drop elements and edit it.
MIT License
65 stars 37 forks source link

Add documentation about standalone WYSIWYG #121

Open jacquesbh opened 3 years ago

jacquesbh commented 3 years ago

We could add this in the documentation to help people using the simple wysiwyg (pell) as a standalone field, not only in UI Elements.

<script type="text/javascript">
    (function () {
        document.addEventListener('DOMContentLoaded', () => {
            let wysiwyg = new MonsieurBizRichEditorWysiwyg({
                actions: [
                    'bold',
                    'italic',
                    'underline',
                    'ulist',
                    'olist',
                    'heading1',
                    'heading2',
                    {
                        name: 'heading3',
                        icon: '<b>H<sub>3</sub></b>',
                        title: 'Heading 3',
                        result: () => wysiwyg.exec('formatBlock', '<h3>')
                    },
                    'link'
                ]
            });
            let forms = document.querySelectorAll('form.form');
            forms.forEach(function (form) {
                wysiwyg.load(form);
            });
        });
    })();
</script>
vincentemagma commented 1 year ago

I agree, very helpful thank you!