Recent Topics

how to trigger TINYMCE editor to custom field in admin panel



  • Hi, is anyone how to initialize the TinyMCE Editor to our custom field? I have added a field at Configuration -> Email and I was following the template of Edit Product but it is not working. I am not sure did I miss out something else. Thank You in advance.

    @push('scripts')
        <script src="{{ asset('vendor/webkul/admin/assets/js/tinyMCE/tinymce.min.js') }}"></script>
    
        <script>
            $(document).ready(function () {
                $('#channel-switcher, #locale-switcher').on('change', function (e) {
                    $('#channel-switcher').val()
                    var query = '?channel=' + $('#channel-switcher').val() + '&locale=' + $('#locale-switcher').val();
    
                    window.location.href = "{{ route('admin.configuration.index', [request()->route('slug'), request()->route('slug2')]) }}" + query;
                })
            });
            tinymce.init({
                    selector: 'textarea',
                    height: 200,
                    width: "100%",
                    plugins: 'image imagetools media wordcount save fullscreen code table lists link hr',
                    toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor link hr | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent  | removeformat | code | table',
                    image_advtab: true
                });
        </script>
    @endpush
    

    11e5bfe6-4bb0-472b-83ca-0283698555aa-Screenshot 2022-03-30 at 3.25.51 PM.png



  • Hi,

    You just need to add that snippet to the configuration page. It will work as it will trigger the text area.


Log in to reply