Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only one simplemde at a time #222

Closed
MarcBrillault opened this issue Nov 4, 2016 · 5 comments
Closed

Only one simplemde at a time #222

MarcBrillault opened this issue Nov 4, 2016 · 5 comments

Comments

@MarcBrillault
Copy link

MarcBrillault commented Nov 4, 2016

I encountered a bug, where only one simplemde editor is allowed on a page.

I'm quite new to github, I don't know how to push a corrected version of the file yet, but here is what I've done to fix it:

In src/resources/views/fields/simplemde.blade.php, the "new SimpleMDE" has to be out of the checkIfFieldIsFirstOfItsType, or it will only be triggered once.

@if ($crud->checkIfFieldIsFirstOfItsType($field, $fields))

    {{-- FIELD CSS - will be loaded in the after_styles section --}}
    @push('crud_fields_styles')
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
    @endpush

    {{-- FIELD JS - will be loaded in the after_scripts section --}}
    @push('crud_fields_scripts')
        <script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
    @endpush

@endif

@push('crud_fields_scripts')
    <script>
        var simplemde = new SimpleMDE({ element: $("#simplemde-{{ $field['name'] }}")[0] });
    </script>
@endpush
@tabacitu
Copy link
Member

tabacitu commented Nov 4, 2016

Totally right, @MarcBrillault , my bad. Thanks, fixed. A composer update should fix it for you too.

Cheers!

@MarcBrillault
Copy link
Author

Thanks !

@MarcBrillault
Copy link
Author

MarcBrillault commented Nov 4, 2016

I'm sorry @tabacitu but it doesn't work: as you didn't add the code into the @push('crud_fields_snippets'), no simpleMDE are displayed anymore !

tabacitu added a commit that referenced this issue Nov 6, 2016
@tabacitu
Copy link
Member

tabacitu commented Nov 6, 2016

Oh crap. Thanks a lot, really messed this up. Fixed and tested, thank you for the heads-up.

Cheers!

@MarcBrillault
Copy link
Author

Thanks, it works perfectly now.

This was referenced Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants