我想知道如何将可单击的链接添加到帮助文本?
el(
ToggleControl,
{
label: \'Toogle\',
help: \'<a href="https://.." >This will be escaped, I do not want that</a>\',
checked: props.attributes.toggle,
onChange: ( value ) => {
props.setAttributes( { toggle: value } );
},
}
)
基本上每个GB UI元素都有help
但这是对所有HTML的转义,我怎样才能阻止它转义呢?我有下面这样的代码在其他地方使用,当前的答案并不是我真正喜欢的解决方案。我基本上只需要在一些罕见的情况下纯文本和链接。我不知道如何在Gutenberg中创建包含链接元素的文本元素。我正在寻找一种解决方案,可以使用regex或其他东西将我在PHP中定义的HTML转换为我也可以在GB帮助文本中使用的内容。例如,可能会将链接转到降价或其他内容,然后在GB中创建保存元素。聪明的东西?还是我想得太多了?我可以在php中专门为GB定义它。但是我该如何定义它,以便可以使用它创建一个包含链接的元素。
<?php
...
\'description\' => sprintf(
// Translators: %1$s Providers
__( \'Post the URL of the video here. For %1$s and any <a href="%2$s">unlisted</a> video hosts paste their iframe embed codes.\', \'advanced-responsive-video-embedder\' ),
esc_html( $embed_code_only ),
esc_url( \'https://nextgenthemes.com/arve-pro/#video-host-support\' )
),