Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/>
)
})}
)
})
/**
* Prop types.
*
* @type {Object}
*/
Text.propTypes = {
annotations: ImmutableTypes.map.isRequired,
block: SlateTypes.block,
decorations: ImmutableTypes.list.isRequired,
editor: Types.object.isRequired,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
style: Types.object,
}
/**
* A memoized version of `Text` that updates less frequently.
*
* @type {Component}
*/
const MemoizedText = React.memo(Text, (prev, next) => {
return (
// PERF: There are cases where it will have
* @type {Component}
*/
class DefaultPlaceholder extends React.Component {
/**
* Property types.
*
* @type {Object}
*/
static propTypes = {
editor: Types.object.isRequired,
isSelected: Types.bool.isRequired,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
readOnly: Types.bool.isRequired,
state: SlateTypes.state.isRequired,
}
/**
* Render.
*
* @return {Element}
*/
render() {
const { editor, state } = this.props
if (!editor.props.placeholder) return null
if (state.document.getBlocks().size > 1) return null
const style = {
*/
class Placeholder extends React.Component {
/**
* Property types.
*
* @type {Object}
*/
static propTypes = {
children: Types.any.isRequired,
className: Types.string,
firstOnly: Types.bool,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node,
state: SlateTypes.state.isRequired,
style: Types.object,
}
/**
* Default properties.
*
* @type {Object}
*/
static defaultProps = {
firstOnly: true,
}
/**
* Should the placeholder update?
*
* @type {Component}
*/
class DefaultPlaceholder extends React.Component {
/**
* Property types.
*
* @type {Object}
*/
static propTypes = {
editor: Types.object.isRequired,
isSelected: Types.bool.isRequired,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
readOnly: Types.bool.isRequired,
state: SlateTypes.state.isRequired,
}
/**
* Render.
*
* @return {Element}
*/
render() {
const { editor, state } = this.props
if (!editor.props.placeholder) return null
if (state.document.getBlocks().size > 1) return null
*
* @type {Component}
*/
class Void extends React.Component {
/**
* Property types.
*
* @type {Object}
*/
static propTypes = {
block: SlateTypes.block,
children: Types.any.isRequired,
editor: Types.object.isRequired,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
readOnly: Types.bool.isRequired,
}
/**
* Debug.
*
* @param {String} message
* @param {Mixed} ...args
*/
debug = (message, ...args) => {
const { node } = this.props
const { key, type } = node
const id = `${key} (${type})`
debug(message, `${id}`, ...args)
* @type {Component}
*/
class Void extends React.Component {
/**
* Property types.
*
* @type {Object}
*/
static propTypes = {
block: SlateTypes.block,
children: Types.any.isRequired,
editor: Types.object.isRequired,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
readOnly: Types.bool.isRequired,
}
/**
* Debug.
*
* @param {String} message
* @param {Mixed} ...args
*/
debug = (message, ...args) => {
const { node } = this.props
const { key, type } = node
const id = `${key} (${type})`
debug(message, `${id}`, ...args)
}
OverlayFormManager.defaultProps = {
showEditButton: true
}
OverlayFormManager.propTypes = {
showEditButton: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
children: PropTypes.func.isRequired,
component: PropTypes.node,
preview: PropTypes.node,
extra: PropTypes.node,
attributes: PropTypes.object,
editor: PropTypes.shape({
change: PropTypes.func.isRequired
}).isRequired,
node: SlatePropTypes.node.isRequired
}
export default OverlayFormManager
* Prop types.
*
* @type {Object}
*/
Leaf.propTypes = {
annotations: ImmutableTypes.list.isRequired,
block: SlateTypes.block.isRequired,
decorations: ImmutableTypes.list.isRequired,
editor: Types.object.isRequired,
index: Types.number.isRequired,
leaves: Types.object.isRequired,
marks: SlateTypes.marks.isRequired,
node: SlateTypes.node.isRequired,
offset: Types.number.isRequired,
parent: SlateTypes.node.isRequired,
text: Types.string.isRequired,
}
/**
* A memoized version of `Leaf` that updates less frequently.
*
* @type {Component}
*/
const MemoizedLeaf = React.memo(Leaf, (prev, next) => {
return (
next.block === prev.block &&
next.index === prev.index &&
next.marks === prev.marks &&
next.parent === prev.parent &&
next.text === prev.text &&
* @type {Component}
*/
class Node extends React.Component {
/**
* Property types.
*
* @type {Object}
*/
static propTypes = {
annotations: ImmutableTypes.map.isRequired,
block: SlateTypes.block,
decorations: ImmutableTypes.list.isRequired,
editor: Types.object.isRequired,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node,
readOnly: Types.bool.isRequired,
selection: SlateTypes.selection,
}
/**
* Temporary values.
*
* @type {Object}
*/
tmp = {
nodeRefs: {},
}
/**
/**
* Prop types.
*
* @type {Object}
*/
Leaf.propTypes = {
annotations: ImmutableTypes.list.isRequired,
block: SlateTypes.block.isRequired,
decorations: ImmutableTypes.list.isRequired,
editor: Types.object.isRequired,
index: Types.number.isRequired,
leaves: Types.object.isRequired,
marks: SlateTypes.marks.isRequired,
node: SlateTypes.node.isRequired,
offset: Types.number.isRequired,
parent: SlateTypes.node.isRequired,
text: Types.string.isRequired,
}
/**
* A memoized version of `Leaf` that updates less frequently.
*
* @type {Component}
*/
const MemoizedLeaf = React.memo(Leaf, (prev, next) => {
return (
next.block === prev.block &&
next.index === prev.index &&
next.marks === prev.marks &&