Setup hello-world as a plugin.
This commit is contained in:
parent
94c80a4071
commit
601312d08c
|
@ -21,8 +21,6 @@ import {PageBlock} from '../views/MarkdownBlock';
|
|||
import {ControlPanel} from '../admin/ControlPanel';
|
||||
import {ToggleSwitch} from '../admin/ToggleSwitch';
|
||||
import {pageStore, siteStore} from '../stores';
|
||||
// import {Greeting} from '../test-custom';
|
||||
|
||||
|
||||
@observer
|
||||
export class App extends Component {
|
||||
|
@ -94,8 +92,6 @@ export class App extends Component {
|
|||
</Switch>
|
||||
|
||||
<SiteFooter footer={ siteStore.config.footer } styler={ footerLocation } />
|
||||
{/*<Greeting name='from the future' />*/}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -15,7 +15,7 @@ import {BrowserRouter} from 'react-router-dom';
|
|||
import {appStatusStore, siteStore} from './stores';
|
||||
import {App} from './containers/App';
|
||||
import {enableLogging} from 'mobx-logger';
|
||||
import {registerPlugin} from './hello-world-plugin';
|
||||
import {registerPlugin} from './plugins/hello-world/plugin';
|
||||
|
||||
enableLogging();
|
||||
registerPlugin();
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
/*
|
||||
Hello world example plugin
|
||||
|
||||
@copyright (c) Copyright 2019 Dorian Pula
|
||||
@license AGPL v3
|
||||
@author Dorian Pula [dorian.pula@amber-penguin-software.ca]
|
||||
*/
|
||||
|
||||
|
||||
import {h} from 'preact'; /** @jsx h*/
|
||||
import registerCustomElement from 'preact-custom-element';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export const Greeting = ({ name = 'World' }) => {return (
|
||||
export const HelloWorld = ({ name = 'World' }) => {return (
|
||||
<p>Hello, {name}!</p>
|
||||
)};
|
||||
|
||||
Greeting.propTypes = {
|
||||
HelloWorld.propTypes = {
|
||||
name: PropTypes.string,
|
||||
};
|
||||
|
||||
|
@ -24,7 +33,7 @@ export const replacement = (match, p1) => {
|
|||
continue;
|
||||
}
|
||||
|
||||
let [head, value, ..._ ] = tag.split('=');
|
||||
let [head, value] = tag.split('=');
|
||||
value = value.trim();
|
||||
|
||||
if (value !== '' && (head === 'name' || head === 'id')) {
|
||||
|
@ -43,7 +52,5 @@ export const replacement = (match, p1) => {
|
|||
};
|
||||
|
||||
export const registerPlugin = () => {
|
||||
registerCustomElement(Greeting, tagName, ['name']);
|
||||
registerCustomElement(HelloWorld, tagName, ['name']);
|
||||
};
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ import highlighter from 'highlight.js';
|
|||
|
||||
import {pageStore, siteStore} from '../stores';
|
||||
import {themeStore} from '../themes/store';
|
||||
import {markdownPattern, replacement} from '../hello-world-plugin';
|
||||
import {markdownPattern, replacement} from '../plugins/hello-world/plugin';
|
||||
|
||||
export class MarkdownBlock extends Component {
|
||||
static get propTypes() {
|
||||
|
|
Loading…
Reference in New Issue