从官方文档中我了解了两种方法:通过其键获取实体并获取最后创建的实体.在我的例子中,我还需要一种方法来访问当前ContentState中的所有实体.有没有什么方法可以执行此操作?如果没有,是否有一个可以提供所有实体密钥?谢谢
我有一个文件树,就像app/components/forms/components/formError/components
我需要编写一条规则来测试.scss仅位于根目录components或scene文件夹中的所有文件。我怎样才能做到这一点?当前规则是下一个:
{
test: /.*\/(components|scenes)\/.*\.scss$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[local]___[hash:base64:5]',
},
}, {
loader: 'sass-loader',
}],
}
Run Code Online (Sandbox Code Playgroud)
但找不到所需的文件
我想在块后添加新行.我目前的功能是下一个:
_insert_new_block(editorState) {
const selection = editorState.getSelection();
const newBlock = new ContentBlock({
key: genKey(),
type: 'unstyled',
text: ' ',
characterList: List()
});
const contentState = editorState.getCurrentContent();
const new_block_map = contentState.getBlockMap().set(newBlock.key, newBlock);
const newContentState = contentState.set('blockMap', new_block_map);
const new_contentState = contentState.merge({
blockMap: new_block_map,
selectionBefore: selection.merge({
anchorKey: newBlock.key,
anchorOffset: 0,
focusKey: newBlock.key,
focusOffset: 0,
isBackward: false
}),
selectionAfter: selection
});
return EditorState.push(
editorState,
new_contentState,
'insert-fragment'
);
}
Run Code Online (Sandbox Code Playgroud)
新内容插入到我的内容的末尾但是当我点击新创建的块时我收到此错误 -
getUpdatedSelectionState.js:38 Uncaught TypeError: Cannot read property 'get' of undefined
Run Code Online (Sandbox Code Playgroud)
和错误所在的文件
'use strict';
var …Run Code Online (Sandbox Code Playgroud)