Skip to content

Instantly share code, notes, and snippets.

@grebaldi
Last active April 29, 2016 08:21
Show Gist options
  • Save grebaldi/d5a687ab1da88d64621ec5946a98ca68 to your computer and use it in GitHub Desktop.
Save grebaldi/d5a687ab1da88d64621ec5946a98ca68 to your computer and use it in GitHub Desktop.
How runtime dependencies could work for Guevara
export default Neos => {
const {React, Components, api} = Neos;
const {Component} = React;
const {Button, Input, PageTree} = Components;
//
// How to connect this to the store? Should we expose @connect?
//
return class MyCustomComponent extends Component {
render() {
return (
<div>
<Input placeholder="Search for pages..." />
<PageTree />
<Button onClick={() => api.searchFor(...)}>Search!</Button>
</div>
);
}
};
};
import neos from 'neos';
import myCustomComponentFactory from './myEditor';
//
// Some Mechanism to make the UI aware of the extension
//
neos.ui.registerCustomInspectorEditorFactory(myCustomComponentFactory);
//
// This would be a separate npm package, that you'll need
// as a dependency in order to use
//
//
// Check for global neos API
//
if (window.neos === undefined) {
throw new Error('Neos API not found!');
}
//
// Check for version constraint
//
if (!isCompatibleVersion(window.neos.version)) {
console.warn(`Detected incompatible JSAPI ${window.neos.version}`);
}
export default window.neos;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment