Comments (4)
Someone here seems to have this problem too https://laracasts.com/discuss/channels/filament/filament-custom-rich-editor-javascript-not-loading-in-modal-relation-manager?page=1&replyId=935999
I found the problem again, but not a solution.
a little help would be appreciated π
from filament.
Would it help to use AlpineJS for initialisation? I had some load issues,possibly due to server-side rendering with JS in a livewire component/blade template. I ended up fixing it with something like:
<div x-data="my_component">
<!-- All of your component stuff in here -->
</div>
@script
Alpine.data("my_component", () => {
return {
init() {
// All of your logic in here, sans the window.addEventListener wrapper
}
}
}
@endscript
My understanding is that Alpine.js calls the 'init()' function after the related div with the x-data is rendered on the browser, so I think it might make everything happen in the right order. Please let me know if I'm wrong...
from filament.
I don't think @assets
is a thing that we have added support for? Have you tried the Livewire @script
directive as above?
Also, I would really appreciate it if you did not open more issues for questions about building custom fields, these aren't Filament bugs and belong in Discussions or Discord. If you do find a Filament bug then of course an issue is fine
from filament.
@BatthewZ thx for this way, the JS is execute but I have always the same problem : I get only one ID on two fields from modal. I would like to execute the JS on each custom field. But in my console.log, I have only the same last ID...
@danharrin I understand, I thought it was a bug because on a resource it's perfect, on modal I can get ID on each custom field. I tried @assets
because I search a way to execute the JS on each field from modal... :-)
Modal:
MentionsRichEditor::make('one_sentence')
->id('one_sentence')
->mentionsItems($form)
->fileAttachmentsDisk('media')
->label('One sentence'),
MentionsRichEditor::make('description')
->id('description')
->mentionsItems($form)
->fileAttachmentsDisk('media')
->label('Description'),
View:
<div x-data="my_component">
@include('filament-forms::components.rich-editor')
</div>
@assets
<script src="{{ url('js/libs/Tribute/Tribute.min.js') }}"></script>
<link href="{{ url('css/libs/Tribute/Tribute.min.css') }}" rel="stylesheet">
@endassets
@script
<script>
Alpine.data("my_component", () => {
return {
init() {
// All of your logic in here, sans the window.addEventListener wrapper
const id = '{{ $getId() }}';
console.log(id);
}
}
});
</script>
@endscript
from filament.
Related Issues (20)
- type hinting fix HOT 1
- type hinting fix HOT 1
- Inconsistent Type Hinting in StatsOverviewWidget/Stat.php HOT 10
- close-modal event fires multiple times HOT 1
- How to add a small brandLogo when sidebar is collapsed ?
- Tab with 2 or more custom components thows livewire error on click of actions HOT 6
- KeyValue field updates state from the second time
- Builder bug with addActionBetween HOT 1
- Spatie Translatable + FileUpload image won't work with RelationManager HOT 4
- Modal Blade component has a problem with Nesting Components HOT 1
- Tenant Pages Livewire Component Error HOT 1
- SelectFilter has no selectablePlaceholder() method HOT 2
- try to import a file larger than 1MB, a validation error will occur. HOT 7
- Template Filament project doesn't work HOT 5
- MDE behaves differently when submitted via mouse click vs keyBinding
- modalDescription method doesn't update view for Create action requiresConfirmation overlay HOT 3
- requiredwith does not work with FileUpload
- ImageEntry not show stacked images HOT 2
- Header action of table open modal only after 2 (two) clicks HOT 20
- bug login expired HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filament.