
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.