Package Exports
- @jswork/next-slate-plugin
- @jswork/next-slate-plugin/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jswork/next-slate-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
next-slate-plugin
Slate plugin manager.
installation
npm install -S @jswork/next-slate-plugin
apis
api | params | description |
---|---|---|
define | schema | Define a plugin. |
actived | node,plugins | Get actived plugin(s) from plugins. |
usage
import NxSlatePlugin from '@jswork/next-slate-plugin';
const Bold = NxSlatePlugin.define({
id: 'bold',
type: 'format',
serialize: {
output: (node, children) => {
return `<strong>${children}</strong>`;
}
}
});
const node = {
text: 'i am a bold text',
bold: true,
italic: true
};
const plugins = [{ id: 'paragraph' }, { id: 'bold' }, { id: 'italic' }, { id: 'blockquote'}];
const actived = NxSlatePlugin.actived(node, plugins);
/*
[
{ id: 'bold' },
{ id: 'italic' },
];
*/
full schema
{
id: null,
meta: {
title: null,
description: null
},
hotkey: null,
decorator: nx.stubValue,
serialize: {
input: nx.noop,
output: NxSlateDefaults.exporter
},
statics: {},
commands: {
is: nx.noop,
isHotkey: nx.noop,
activate: nx.noop,
deactivate: nx.noop,
toggle: nx.noop
},
events: {
keydown: nx.noop,
paste: nx.noop
},
render: nx.noop
}
license
Code released under the MIT license.