
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@marduke182/prosemirror-react-view
Advanced tools
This library is a full React implementation of the official [prosemirror-view](https://github.com/ProseMirror/prosemirror-view) package. Aims to implement a simple React Component that uses ProseMirror Data Model to render the document and bind the right
This library is a full React implementation of the official prosemirror-view package. Aims to implement a simple React Component that uses ProseMirror Data Model to render the document and bind the right events to synchronize the user selection and created ProseMirror transaction based on user inputs.
import { Node as ProseMirrorNode } from 'prosemirror-model';
import { Renderer, SchemaDOMSerializer, DecorationSet } from 'prosemirror-react-view';
interface Props {
node: ProseMirrorNode,
decorations: DecorationSet,
}
const MyRenderer: React.FC<Props> = ({ doc, decorations }) => {
return (
<SchemaDOMSerializer schema={mySchema} plugins={myPlugins}>
<Renderer doc={doc} decorations={decorations} />
</SchemaDOMSerializer>
)
}
import { Editor } from 'prosemirror-react-view';
interface Props {
onChange(node: ProseMirrorNode): void
}
const MyEditor: React.FC<Props> = ({ onChange }) => {
return (
<Editor
schema={mySchema}
initialDoc={doc}
plugins={myPlugins}
onChange={onChange}
/>
)
}
import {
Renderer,
Editor,
Editable
DomSerializer,
DOMSerializerContext,
useEditorState,
useEditorView,
} from 'prosemirror-react-view';
class CustomSerializer implements DomSerializer {
// implement
}
const MyToolbar: React.FC = () => {
const toolbarState = useEditorState(editorState => editorState.toolbarState);
const editorView = useEditorView();
return <Toolbar toolbar={toolbarState} editorView={editorView} />;
}
const CustomRenderer: React.FC = () => {
// Create my custom serializer instance
const customSerializer = useMemo(() => new CustomSerializer(), []);
// Extract my doc and my decorations from the ProseMirror Editor State
const doc = useEditorState(editorState => editorState.doc);
const decorations = useEditorState(editorState => editorState.decorations);
return (
<DOMSerializerContext value={customSerializer}>
<Renderer doc={doc} decorations={decorations} />
</DOMSerializerContext>
);
}
const MyAdvanceEditor: React.FC = () => {
return (
<Editor schema={mySchema} plugins={myPlugins}>
<MyToolbar />
<Editable>
<CustomRenderer/>
</Editable>
</Editor>
);
}
This project is highly inspired by these two projects:
beforeInput
strategy were based on this implementations.FAQs
This library is a full React implementation of the official [prosemirror-view](https://github.com/ProseMirror/prosemirror-view) package. Aims to implement a simple React Component that uses ProseMirror Data Model to render the document and bind the right
We found that @marduke182/prosemirror-react-view 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
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.