<?php

return [
    'encoding' => 'UTF-8',
    'finalize' => true,
    'cachePath' => storage_path('app/purifier'),
    'cacheFileMode' => 0755,
    'settings' => [
        'default' => [
            'HTML.Doctype' => 'HTML 4.01 Transitional',
            'Cache.SerializerPath' => storage_path('app/purifier'),
            'HTML.Allowed' => implode(',', [
                'p[class|style]',
                'br',
                'strong',
                'em',
                's',
                'u',
                'h1[class|style]',
                'h2[class|style]',
                'h3[class|style]',
                'h4[class|style]',
                'h5[class|style]',
                'h6[class|style]',
                'blockquote[class|style]',
                'code[class]',
                'pre[class]',
                'ul[class|style]',
                'ol[class|style]',
                'li[class|style]',
                'a[href|title|target|rel|class]',
                'img[src|alt|title|width|height|class|style]',
                'table[class|style]',
                'thead',
                'tbody',
                'tr',
                'th[class|style]',
                'td[class|style]',
                'hr',
                'div[class|style]',
                'span[class|style]',
                'iframe[src|width|height|frameborder|title|style]',
            ]),
            'Attr.AllowedRel' => 'nofollow,noopener,noreferrer',
            'HTML.SafeIframe' => true,
            'URI.SafeIframeRegexp' => '%^https?://(www\\.youtube\\.com/embed/|www\\.youtube-nocookie\\.com/embed/|player\\.vimeo\\.com/video/)%',
            'CSS.AllowTricky' => true,
            'CSS.Trusted' => true,
        ],
        /*
         * Custom definition to allow data-* attributes.
         * HTMLPurifier doesn't support data-* attributes natively,
         * so we register them as custom attributes.
         */
        'custom_definition' => [
            'id' => 'tiptap-custom',
            'rev' => 2,
            'debug' => false,
            'elements' => [],
            'attributes' => [
                ['div', 'data-type', 'Text'],
                ['div', 'data-layout', 'Text'],
                ['div', 'data-youtube', 'Text'],
                ['div', 'data-embed', 'Text'],
            ],
        ],
    ],
];
