
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
draftmirror
Advanced tools
DraftMirror provides a Draft.js-like API on top of ProseMirror.
$ npm install draftmirror
var DraftMirror = require('draftmirror');
var MyApp = React.createClass({
getInitialState: function() {
return {
editorState: DraftMirror.EditorState.createFromJSON(schema, defaultJson)
}
},
onChange: function(newEditorState) {
this.setState({
editorState: newEditorState
});
},
render: function() {
return <DraftMirror
editorState={this.state.editorState}
onChange={this.onChange}
/>;
}
});
var newEditorState = DraftMirror.StyleUtils.toggleInlineStyle(editorState, 'strong');
DraftMirror allows the extension of ProseMirror syntax using custom React widgets:
var DraftMirror = require('draftmirror');
var schema = DraftMirror.schema;
var MyWidgetComponent = React.createClass({
render: function() {
return <div>...</div>;
}
});
var MyWidget = DraftMirror.createWidget({
component: MyWidgetComponent
});
const mySchema = new Schema({
nodes: schema.nodeSpec.addBefore('image', 'mywidget', {
type: MyWidget, group: "inline"
}),
marks: schema.markSpec
});
You can ask to render tooltips by providing a callback function as prop getTooltip. You callback should have such signature:
/**
* Return tooltip depending on context
*
* @param {DraftMirror.SelectionContext} context The current context
* @return {DraftMirror.Tooltip}
*/
function getTooltip(context) {
return {
component: <ReactComponent>,
props: <Object>
position: 'bottom' | 'center' | 'right' | 'left',
type: 'mark' | 'node',
className: <String>, // Additionnal class for the div
};
}
FAQs
React component for ProseMirror providing a Draft.js like API
We found that draftmirror demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.