rawilk / laravel-form-components

Form components built for Tailwind & Livewire.
https://randallwilk.dev/docs/laravel-form-components
MIT License
386 stars 42 forks source link

Quill Options withToolbarButton Not Work #61

Closed moskoweb closed 1 year ago

moskoweb commented 2 years ago

Laravel Form Components Version

^7.1

Laravel Version

v8.83.10

Alpine Version

v3.3.2

Bug description

When adding a custom button from the Syntax error, I already tested on pages in white only with the component and returns the same error.

Taking the very example of the site.

Steps to reproduce

<x-quill :quill-options="QuillOptions::defaults()->withToolbarButton('variables', <<<HTML
    const cursorPosition = this.quill.getSelection().index;
    this.quill.insertText(cursorPosition, value);
    this.quill.setSelection(cursorPosition + value.length);
HTML, ['Option 1', 'Option 2']" />

Relevant log output

syntax error, unexpected token "endif", expecting end of file
rawilk commented 1 year ago

If you're able to, I'd recommend upgrading to v8 of the package, which was released today. I've slightly changed how to define custom toolbar buttons with quill, which is detailed here: https://randallwilk.dev/docs/laravel-form-components/v8/rich-text/quill#user-content-custom-toolbar-button

If you need to stay on v7, I'd recommend defining the toolbar button outside of the markup.

I'm going to close this issue, but feel free to re-open if you're still having issues with this.