@aeaton/react-prosemirror
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -75,14 +75,16 @@ 'use strict'; | ||
var keys = Object.keys(menu); | ||
var limit = keys.length - 1; | ||
return React.createElement( | ||
'div', | ||
{ className: classes.bar }, | ||
map(menu.marks, Button), | ||
React.createElement(Separator, null), | ||
map(menu.blocks, Button), | ||
React.createElement(Separator, null), | ||
map(menu.insert, Button), | ||
React.createElement(Separator, null), | ||
map(menu.history, Button), | ||
React.createElement(Separator, null), | ||
map(menu.table, Button) | ||
keys.map(function (key, index) { | ||
return React.createElement( | ||
'span', | ||
{ key: key }, | ||
map(menu[key], Button), | ||
index < limit && React.createElement(Separator, null) | ||
); | ||
}) | ||
); | ||
@@ -130,3 +132,3 @@ }; | ||
value: function render() { | ||
var menu = this.props.menu; | ||
var menu = this.props.options.menu; | ||
var state = this.state.state; | ||
@@ -143,5 +145,3 @@ | ||
}), | ||
React.createElement('div', { | ||
ref: this.createEditorView | ||
}) | ||
React.createElement('div', { ref: this.createEditorView }) | ||
); | ||
@@ -203,5 +203,3 @@ } | ||
value: function render() { | ||
var _props2 = this.props, | ||
options = _props2.options, | ||
menu = _props2.menu; | ||
var options = this.props.options; | ||
@@ -211,3 +209,2 @@ | ||
options: options, | ||
menu: menu, | ||
onChange: this.onChange | ||
@@ -214,0 +211,0 @@ }); |
{ | ||
"name": "@aeaton/react-prosemirror", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "A React component for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
@@ -18,11 +18,7 @@ ## Installation | ||
import { HtmlEditor } from '@aeaton/react-prosemirror' | ||
import * as options from '@aeaton/react-prosemirror-config-full' | ||
import { icons } from '@aeaton/react-prosemirror-icons-fontawesome' | ||
import * as options from '@aeaton/react-prosemirror-config-default' | ||
const menu = options.menu(options.schema, icons) | ||
const Editor = ({ value, onChange }) => ( | ||
<HtmlEditor | ||
options={options} | ||
menu={menu} | ||
value={value} | ||
@@ -29,0 +25,0 @@ onChange={onChange} |
@@ -25,3 +25,6 @@ import React from 'react' | ||
attributes: { | ||
class: classnames(baseClasses.ProseMirror, classes.ProseMirror) | ||
class: classnames( | ||
baseClasses.ProseMirror, | ||
classes.ProseMirror | ||
) | ||
} | ||
@@ -39,3 +42,3 @@ }) | ||
render () { | ||
const { menu } = this.props | ||
const { options: { menu } } = this.props | ||
const { state } = this.state | ||
@@ -51,5 +54,3 @@ | ||
<div | ||
ref={this.createEditorView} | ||
/> | ||
<div ref={this.createEditorView} /> | ||
</div> | ||
@@ -56,0 +57,0 @@ ) |
An editor for content stored as ProseMirror JSON. | ||
```js | ||
const options = require('@aeaton/react-prosemirror-config-full') | ||
const { icons } = require('@aeaton/react-prosemirror-icons-fontawesome') | ||
const options = require('@aeaton/react-prosemirror-config-default') | ||
const menu = options.menu(options.schema, icons) | ||
initialState = { | ||
@@ -18,3 +15,2 @@ doc: {} | ||
options={options} | ||
menu={menu} | ||
onChange={doc => setState({ doc })} | ||
@@ -21,0 +17,0 @@ /> |
@@ -43,3 +43,3 @@ import React from 'react' | ||
render () { | ||
const { options, menu } = this.props | ||
const { options } = this.props | ||
@@ -49,3 +49,2 @@ return ( | ||
options={options} | ||
menu={menu} | ||
onChange={this.onChange} | ||
@@ -52,0 +51,0 @@ /> |
@@ -6,7 +6,4 @@ An editor for content stored as HTML. | ||
```js | ||
const options = require('@aeaton/react-prosemirror-config-full') | ||
const { icons } = require('@aeaton/react-prosemirror-icons-fontawesome') | ||
const options = require('@aeaton/react-prosemirror-config-default') | ||
const menu = options.menu(options.schema, icons) | ||
initialState = { | ||
@@ -21,3 +18,2 @@ value: `<h1>This is a title</h1><p>This is a paragraph.</p>` | ||
options={options} | ||
menu={menu} | ||
value={state.value} | ||
@@ -24,0 +20,0 @@ onChange={value => setState({ value })} |
@@ -37,13 +37,13 @@ import React from 'react' | ||
const keys = Object.keys(menu) | ||
const limit = keys.length - 1 | ||
return ( | ||
<div className={classes.bar}> | ||
{map(menu.marks, Button)} | ||
<Separator /> | ||
{map(menu.blocks, Button)} | ||
<Separator /> | ||
{map(menu.insert, Button)} | ||
<Separator /> | ||
{map(menu.history, Button)} | ||
<Separator /> | ||
{map(menu.table, Button)} | ||
{keys.map((key, index) => ( | ||
<span key={key}> | ||
{map(menu[key], Button)} | ||
{index < limit && <Separator />} | ||
</span> | ||
))} | ||
</div> | ||
@@ -50,0 +50,0 @@ ) |
A React menu bar for a ProseMirror editor | ||
```js | ||
const options = require('@aeaton/react-prosemirror-config-full') | ||
const { icons } = require('@aeaton/react-prosemirror-icons-fontawesome') | ||
const { EditorState } = require('prosemirror-state') | ||
const options = require('@aeaton/react-prosemirror-config-default') | ||
const menu = options.menu(options.schema, icons); | ||
initialState = { | ||
@@ -15,3 +12,3 @@ state: EditorState.create(options) | ||
<MenuBar | ||
menu={menu} | ||
menu={options.menu} | ||
state={state.state} | ||
@@ -18,0 +15,0 @@ dispatch={transaction => { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
22091
378
31