我正在创建非常简单的文本块。当我第一次添加时,该块工作正常。如果刷新页面并尝试编辑该块,则会显示消息“此块包含意外内容或无效内容”。我试图禁用htmlvalidation检查,但这无济于事。另外,在我单击“确定”之后:当前块和转换块之后包含相同的代码。
http://prntscr.com/lwv18b
http://prntscr.com/lwv1e1
这是我的index.js文件代码
<pre>
/**
* Block dependencies
*/
import icon from './icon';
import './style.css';
/**
* Internal block libraries
*/
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const { RichText } = wp.editor;
/**
* Register block
*/
export default registerBlockType(
'jsforwpblocks/richtext',
{
title: __('Bizbike Small Description', 'jsforwpblocks'),
description: __('Default title', 'jsforwpblocks'),
category: 'common',
icon: 'text',
keywords: [
__('Text', 'jsforwpblocks'),
__('Call to Action', 'jsforwpblocks'),
__('Message', 'jsforwpblocks'),
],
attributes: {
message: {
type: 'array', …Run Code Online (Sandbox Code Playgroud)