mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-22 06:53:25 +02:00
fix to remove need for core plugin to define a default renderMark
This commit is contained in:
@@ -29,10 +29,6 @@ The core plugin renders a default block and inline node, wrapping in a `<div>` a
|
|||||||
|
|
||||||
The default block node also controls its own placeholder logic, which is controlled via the [`<Editor>`](../components/editor.md)'s placeholder options.
|
The default block node also controls its own placeholder logic, which is controlled via the [`<Editor>`](../components/editor.md)'s placeholder options.
|
||||||
|
|
||||||
#### `renderMark`
|
|
||||||
|
|
||||||
The core plugin adds a default mark with an empty set of styles.
|
|
||||||
|
|
||||||
|
|
||||||
## Overriding Defaults
|
## Overriding Defaults
|
||||||
|
|
||||||
|
@@ -243,6 +243,8 @@ class Editor extends React.Component {
|
|||||||
const style = plugin.renderMark(mark, marks, this.state.state, this)
|
const style = plugin.renderMark(mark, marks, this.state.state, this)
|
||||||
if (style) return style
|
if (style) return style
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -101,14 +101,6 @@ function Plugin(options = {}) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a default mark renderer.
|
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const DEFAULT_MARK = {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the plugin.
|
* Return the plugin.
|
||||||
*/
|
*/
|
||||||
@@ -291,17 +283,6 @@ function Plugin(options = {}) {
|
|||||||
return node.kind == 'block'
|
return node.kind == 'block'
|
||||||
? DEFAULT_BLOCK
|
? DEFAULT_BLOCK
|
||||||
: DEFAULT_INLINE
|
: DEFAULT_INLINE
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The core `mark` renderer, with no styles.
|
|
||||||
*
|
|
||||||
* @param {Mark} mark
|
|
||||||
* @return {Object} style
|
|
||||||
*/
|
|
||||||
|
|
||||||
renderMark(mark) {
|
|
||||||
return DEFAULT_MARK
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user