wordpress-gutenberg - 如何在 React 应用程序中使用 front/gutenberg-js?
问题描述
我已经使用 create-react-app cli 创建了一个反应应用程序。该应用程序运行良好。我必须使用 wordpress 5 中的古腾堡编辑器。
在https://github.com/front/gutenberg-js中有一个仅 javascript 版本可用。问题是当我尝试 domReady 时,使用以下 import 语句编辑发布这些内容
import { domReady, editPost } from '@frontkom/gutenberg-js';
我的反应应用程序不工作,
下面是例外
gutenberg-js.js:104 Uncaught TypeError: Cannot read property 'createContext' of undefined
at Module.push../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:104)
at n (gutenberg-js.js:17)
at Module.push../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:45274)
at n (gutenberg-js.js:17)
at push../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:51)
at Object../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:52)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/components/PageEditor.js (HomeComponent.js:13)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/index.js (index.css?f3f6:45)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Object.0 (store.js:12)
at __webpack_require__ (bootstrap:781)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
期望进口应该起作用。
解决方案
推荐阅读
- php - TCPDF 和 PHPMailer PDF 被破坏
- javascript - 单选按钮不适合表格?
- firebase - 如何使用 Flutter 检查 Firestore 中是否已存在的文档 ID
- javascript - Jquery Inputmask保存错误的货币价值
- java - 如何在java应用程序中检测运行JVM的终端
- python - 选择选项菜单后保存输出(python - Tkinter)
- ubuntu - icu-config 无效但已安装
- android - Xamarin - Android 应用程序无法再访问网站
- ubuntu - 如何使用 curl 解决错误(安全)
- java - 总是在下一刻钟前四舍五入