Widget fixes (#162)
* Make string the default widget if none is specified * Linting fixes for PreviewPane * Linting fixes for ControlPane * Add date widget * Fix name of date control class * Fix spaces in list control with no fields * Fix linting error for List Control * Fix linting errors in raw editor * Add Select widget * Fix linting error
This commit is contained in:
committed by
Cássio Souza
parent
0338e5c9c2
commit
d81d0d416f
23
src/index.js
23
src/index.js
@ -39,3 +39,26 @@ for (const method in registry) {
|
||||
}
|
||||
window.createClass = React.createClass;
|
||||
window.h = React.createElement;
|
||||
|
||||
const buildtInPlugins = [{
|
||||
label: 'Image',
|
||||
id: 'image',
|
||||
fromBlock: match => match && {
|
||||
image: match[2],
|
||||
alt: match[1],
|
||||
},
|
||||
toBlock: data => ``,
|
||||
toPreview: (data) => {
|
||||
return <img src={data.image} alt={data.alt} />;
|
||||
},
|
||||
pattern: /^!\[([^\]]+)\]\(([^\)]+)\)$/,
|
||||
fields: [{
|
||||
label: 'Image',
|
||||
name: 'image',
|
||||
widget: 'image',
|
||||
}, {
|
||||
label: 'Alt Text',
|
||||
name: 'alt',
|
||||
}],
|
||||
}];
|
||||
buildtInPlugins.forEach(plugin => registry.registerEditorComponent(plugin));
|
||||
|
Reference in New Issue
Block a user