问题描述
Unhandled Runtime Error
TypeError: Cannot read property 'getIn' of undefined
Source
.next\static\chunks\pages\about.js (114:0) @ editOnInput
112 | leafKey = _DraftOffsetKey$decod.leafKey;
113 |
> 114 | var _editorState$getBlock = editorState.getBlockTree(blockKey).getIn([decoratorKey,'leaves',leafKey]),115 | start = _editorState$getBlock.start,116 | end = _editorState$getBlock.end;
117 |
Call Stack
HTMLUnkNownElement.callCallback
.next\static\chunks\main.js (3945:0)
invokeGuardedCallback
.next\static\chunks\main.js (4056:0)
executedispatch
.next\static\chunks\main.js (8243:0)
processdispatchQueue
.next\static\chunks\main.js (8288:0)
<unkNown>
.next\static\chunks\main.js (8508:0)
batchedEventUpdates
.next\static\chunks\main.js (3745:0)
attemptTodispatchEvent
.next\static\chunks\main.js (6005:0)
unstable_runWithPriority
.next\static\chunks\main.js (468:0)
discreteUpdates$1
.next\static\chunks\main.js (22413:0)
dispatchdiscreteEvent
.next\static\chunks\main.js (5889:0)
Show collapsed frames
为了测试目的,我构建了 Draftjs 最基本的简单方面,然后它产生了这个错误。
我所做的具体操作是点击富文本编辑器空间。
这是我的代码。
import React,{useState} from 'react'
import Style from "./about.module.css";
import Nav from "../../features/Nav"
import Bin from "../../bin/index"
import { EditorState,Editor,convertToRaw } from 'draft-js';
function About() {
const [draft,setDraft] = useState({
editorState: EditorState.createEmpty()
});
let onChange = (editorState) => {
const contentState = editorState.getCurrentContent();
console.log('content state',convertToRaw(contentState));
setDraft({
editorState,});
}
return (
<div>
<Nav/>
<div>
Hi
<Editor
style={{border:"1px solid black",backgorundColor:"yellow"}}
editorState={draft.editorState}
onChange={onChange}
/>
hi
</div>
</div>
)
}
export default About
我所做的只是 npx create-next-app --example with-redux-toolkit my-app && npm i draftjs(也卡在导航栏中)
然后制作了上述关于页面。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)