Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aeaton/react-prosemirror

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aeaton/react-prosemirror - npm Package Compare versions

Comparing version 0.9.2 to 0.9.3

18

dist/index.js

@@ -569,6 +569,8 @@ module.exports =

_this.createEditorView = function (node) {
_this.view = new _prosemirrorView.EditorView(node, {
state: _this.state.state,
dispatchTransaction: _this.dispatchTransaction
});
if (!_this.view) {
_this.view = new _prosemirrorView.EditorView(node, {
state: _this.state.state,
dispatchTransaction: _this.dispatchTransaction
});
}
};

@@ -592,7 +594,9 @@

value: function render() {
return this.props.render({
var editor = _react2.default.createElement('div', { ref: this.createEditorView });
return this.props.render ? this.props.render({
state: this.state.state,
dispatch: this.dispatchTransaction,
editor: _react2.default.createElement('div', { ref: this.createEditorView })
});
editor: editor
}) : editor;
}

@@ -599,0 +603,0 @@ }]);

{
"name": "@aeaton/react-prosemirror",
"version": "0.9.2",
"version": "0.9.3",
"description": "A React component for ProseMirror",

@@ -30,2 +30,3 @@ "main": "dist",

"css-loader": "^0.28.7",
"react-styleguidist": "^6.0.32",
"rimraf": "^2.6.2",

@@ -43,4 +44,6 @@ "style-loader": "^0.19.0",

"prebuild": "rimraf dist",
"build": "webpack --progress"
"build": "webpack --progress && npm run styleguide:build",
"styleguide": "styleguidist server",
"styleguide:build": "styleguidist build"
}
}

@@ -19,18 +19,34 @@ ## Installation

import React from 'react'
import { HtmlEditor } from '@aeaton/react-prosemirror'
import { options } from '@aeaton/react-prosemirror-config-default'
const CustomEditor = ({ value, onChange }) => (
<HtmlEditor
options={options}
value={value}
onChange={onChange}
/>
)
export default CustomEditor
```
Use a `render` prop to add the menu bar:
```js
import React from 'react'
import { HtmlEditor, MenuBar } from '@aeaton/react-prosemirror'
import { options, menu } from '@aeaton/react-prosemirror-config-default'
const render = ({ editor, state, dispatch }) => (
<div>
<MenuBar menu={menu} state={state} dispatch={dispatch}/>
{editor}
</div>
);
const CustomEditor = ({ value, onChange }) => (
<HtmlEditor
options={options}
render={render}
value={value}
onChange={onChange}
render={({ editor, state, dispatch }) => (
<div>
<MenuBar menu={menu} state={state} dispatch={dispatch}/>
{editor}
</div>
)}
/>

@@ -41,2 +57,1 @@ )

```

@@ -17,6 +17,8 @@ import React from 'react'

createEditorView = node => {
this.view = new EditorView(node, {
state: this.state.state,
dispatchTransaction: this.dispatchTransaction
})
if (!this.view) {
this.view = new EditorView(node, {
state: this.state.state,
dispatchTransaction: this.dispatchTransaction
})
}
}

@@ -32,7 +34,9 @@

render () {
return this.props.render({
const editor = <div ref={this.createEditorView} />
return this.props.render ? this.props.render({
state: this.state.state,
dispatch: this.dispatchTransaction,
editor: <div ref={this.createEditorView} />
})
editor
}) : editor
}

@@ -39,0 +43,0 @@ }

@@ -7,9 +7,2 @@ An editor for content stored as ProseMirror JSON.

const render = ({ editor, state, dispatch }) => (
<div style={{background:'#eee',padding:5}}>
<MenuBar menu={menu} state={state} dispatch={dispatch}/>
{editor}
</div>
);
initialState = {

@@ -19,2 +12,7 @@ doc: {}

const editorStyle = {
background: '#eee',
padding: 5
};
<div>

@@ -26,3 +24,8 @@ <h2>Input</h2>

onChange={doc => setState({ doc })}
render={render}
render={({ editor, state, dispatch }) => (
<div style={editorStyle}>
<MenuBar menu={menu} state={state} dispatch={dispatch}/>
{editor}
</div>
)}
/>

@@ -29,0 +32,0 @@

@@ -9,9 +9,2 @@ An editor for content stored as HTML.

const render = ({ editor, state, dispatch }) => (
<div style={{background:'#eee',padding:5}}>
<MenuBar menu={menu} state={state} dispatch={dispatch}/>
{editor}
</div>
);
initialState = {

@@ -21,2 +14,7 @@ value: `<h1>This is a title</h1><p>This is a paragraph.</p>`

const editorStyle = {
background: '#eee',
padding: 5
};
const onChange = value => {

@@ -31,5 +29,10 @@ setState({ value })

options={options}
render={render}
value={state.value}
onChange={onChange}
render={({ editor, state, dispatch }) => (
<div style={editorStyle}>
<MenuBar menu={menu} state={state} dispatch={dispatch}/>
{editor}
</div>
)}
/>

@@ -36,0 +39,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc