Open zthomas opened 8 years ago
Draft editor has a prop blockRenderMap
it allows you to pass a custom Map.
in my project i change all heading tags to "p" elements or "unstyled":
const customBlockRendering = map({
'header-one': {
element: 'p'
},
'header-two': {
element: 'p'
},
'header-three': {
element: 'p'
},
'header-four': {
element: 'p'
},
'header-five': {
element: 'p'
},
'header-six': {
element: 'p'
}
});
const extendedBlockRenderMap = DefaultDraftBlockRenderMap.merge(customBlockRendering);
<Editor
blockRenderMap={extendedBlockRenderMap}
...
/>
I'm pretty new to react-rte and I wonder if somebody already imported the feature to copy and paste Word text.
While not perfect, I've found running the editor state through https://github.com/thibaudcolas/draftjs-filters both allows you to whitelist which components to accept and produces better looking results from pasted text than the default behavior.
What's the best way to control what type of inline or block components can be pasted into the
I noticed that react-rte is able to keep ul, li, a, h1 etc on paste and I've been digging through the source and I can't seem to find what exactly controls that. Is there anyway to control that right now or maybe someone can just point me to where react-rte is handling this.
TinyMCE has an option to filter what type of element is allowed, I'm trying to do the same here.
Thanks!