取消注册格式类型

问题描述 投票:1回答:1

我正在尝试取消注册一些格式类型(corecode,corestrikethrough)。

我尝试了unregisterFormatType函数。它不起作用,控制台说这些类型不存在。

Format core/code is not registered.

这一行看起来像这样。

const {unregisterFormatType} = wp.richText;
unregisterFormatType("core/code");

我到底做错了什么?

wordpress wordpress-gutenberg
1个回答
0
投票

我想你必须等到格式被注册后才能取消注册。

所以像这样的东西就可以了。

wp.domReady(function () {
  wp.richText.unregisterFormatType('core/code')
})
© www.soinside.com 2019 - 2024. All rights reserved.