• It looks there’s no possibility in visual editor to add option “default” to <track> (video subtitles) like <video><track … default /></video>. When adding “default” in code editor and switching again on visual editor an error is reported. How to deal with it ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    There’s a function applied to all content that restricts what HTML is allowed. I’ve not verified, but I suspect the “default” attribute for track tags is not in that list. You can alter the list (a PHP array actually) through the “wp_kses_allowed_html” filter hook.

    Thread Starter slawek60

    (@slawek60)

    In allowedposttags array in wp-includes/kses.php option “default” is included and “track” only occurs once in this file…

    Moderator bcworkz

    (@bcworkz)

    If the attribute is allowed by kses, blocks also have a validation routine that can be more stringent than kses. It’s likely the video block’s validation routine is what is preventing a “default” attribute.

    I’m not a block developer, but I’m unaware of a way to override block validation like we can with kses. I think your only options are to either ignore the error; place all the video HTML into a custom HTML block and not use the video block; or create your own custom block with less stringent validation.

    You could also raise an issue at the Gutenberg project’s GitHub site requesting the video block allow “default” attribute in added tracks. It will not help you in the short term, but in the long run it’ll benefit everyone if and when the issue is addressed. Note there are nearly 5k open issues. Addressing this could take a while.

    Thread Starter slawek60

    (@slawek60)

    For now, before editing pages with videos (and subtitles) in visual editor I switch into code editor and remove all “defaults” from tracks ?? After making changes in visual editor I switch again in code editor and add all “defaults” back.
    I hope video block will be improved soon!

    Thanks @bcworkz

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Video block, subtitles option’ is closed to new replies.