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

    let changeCb = (e) => {
        e.preventDefault();
        let 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));

    return {
        jsonLintFormat: jsonLintFormat,
        change: changeCb,
    };
});
