filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.72k stars 2.91k forks source link

disableToolbarButtons not working with Markdown Editor #7646

Closed iRajul closed 1 year ago

iRajul commented 1 year ago

Package

filament/filament

Package Version

v3.0.16

Laravel Version

v10.18.0

Livewire Version

v3.0.beta7

PHP Version

PHP 8.1

Problem description

disableToolbarButtons is not working in Markdown field Following code not working.

MarkdownEditor::make('name')
    ->disableToolbarButtons([
        'blockquote',
        'strike',
    ])

I tried to fix it but did not get an idea why includes function is not available.

Expected behavior

Only disables button should be hide but the whole editor is not visible.

Steps to reproduce

Install reproduction repo using composer install and go to 'http://localhost/admin/users/1/edit

You will see only horizontal line instead of editor .

image

Reproduction repository

https://github.com/iRajul/filament-markdown-bug

Relevant log output

Stack trace in console :
Uncaught (in promise) TypeError: s.includes is not a function
    at Proxy.getToolbar (markdown-editor.js?v=3.0.16.0:51:19984)
    at Proxy.init (markdown-editor.js?v=3.0.16.0:51:19192)
    at livewire.js?id=99a05389:882:25
    at tryCatch (livewire.js?id=99a05389:838:14)
    at evaluate (livewire.js?id=99a05389:862:34)
    at Function.<anonymous> (livewire.js?id=99a05389:3165:29)
    at flushHandlers (livewire.js?id=99a05389:996:48)
    at stopDeferring (livewire.js?id=99a05389:1001:7)
    at deferHandlingDirectives (livewire.js?id=99a05389:1004:5)
    at Object.initTree (livewire.js?id=99a05389:1187:5)
iRajul commented 1 year ago

Thanks for the fix. I learn something new.