AAForm.addTypeHandler('aa-ft-json-text', (el, defaultOptions, libs) => {

    var jsonLintFormat = libs.getLib('jsonLintFormat');

    let changeCb = (e) => {
        e.preventDefault();
        var formatted = jsonLintFormat(el.value);
        if (formatted) {
            // strip tags
            formatted = formatted.replace(/<\/?[^>]+(>|$)/g, "");
            el.value = formatted;
        }
    }

    let events = ['keyup', 'change', 'blur'];
    events.forEach((event) => el.addEventListener(event, changeCb));


    let aaFormComponent = {
        jsonLintFormat: jsonLintFormat,
        change: changeCb,
    };
    return aaFormComponent;
});