"use strict";
(function ($) {
    $.field_editor = function (element, options) {
        var defaults = {
            input_name: "",
            editor_type: ""
        }
        var plugin = this;
        plugin.settings = {}
        var $element = $(element), 
            element = element;
        plugin.init = function () {
            plugin.settings = $.extend({}, defaults, options);
            let editor_type=plugin.settings.editor_type;
            let input_name=plugin.settings.input_name;
            if(editor_type==="ckeditor")
            {

                CKEDITOR.replace( input_name,{
                    removePlugins : "iframe",
                    allowedContent: true,
                } );
                CKEDITOR.config.fillEmptyBlocks=false;
                CKEDITOR.config.tabSpaces = 0;
            }

        }
        plugin.example_function = function () {
        };
        plugin.init();
    }
    
    $.fn.field_editor = function (options) {
        
        return this.each(function () {
            
            if (undefined == $(this).data('field_editor')) {
                var plugin = new $.field_editor(this, options);
                $(this).data('field_editor', plugin);
            }
        });
    }
})(jQuery);
