import hideButKeepRequireBehavior from "../util/hide_but_required_behavior";

AAForm.addTypeHandler('aa-ft-text-rich', (el, defaultOptions, libs)=>{
    var aaFormComponent = (async () => {
        return await libs.getLib('ckeditor')
            .create(el, defaultOptions)
            .then(editor => {
                let textarea = editor.sourceElement;
                hideButKeepRequireBehavior(textarea);

                return editor;
            })
            .catch(error => {
                console.error(error);
            });
    })();

    return aaFormComponent;
});
AAForm.setTypeDefaultOptions('aa-ft-text-rich', AAFormConfig.config['aa-ft-text-rich']);
