feat(): export isBlockPlugin, isInlinePlugin, isMarkPlugin

This commit is contained in:
yanmao 2021-11-04 12:03:27 +08:00
parent 1e159ac2e4
commit 0e56e210cc
3 changed files with 24 additions and 11 deletions

View File

@ -8,6 +8,9 @@ import {
MarkPlugin,
InlinePlugin,
ListPlugin,
isBlockPlugin,
isInlinePlugin,
isMarkPlugin,
} from './plugin';
import Card from './card/entry';
import View from './view';
@ -46,6 +49,9 @@ export {
MarkPlugin,
InlinePlugin,
ListPlugin,
isBlockPlugin,
isInlinePlugin,
isMarkPlugin,
Card,
Toolbar,
Tooltip,

View File

@ -1,5 +1,10 @@
import ElementPluginEntry from './element';
import { SchemaBlock, BlockInterface, NodeInterface } from '../types';
import {
SchemaBlock,
BlockInterface,
NodeInterface,
PluginInterface,
} from '../types';
abstract class BlockEntry<T extends {} = {}>
extends ElementPluginEntry<T>
@ -52,3 +57,9 @@ abstract class BlockEntry<T extends {} = {}>
}
export default BlockEntry;
export const isBlockPlugin = (
plugin: PluginInterface,
): plugin is BlockInterface => {
return plugin.kind === 'block';
};

View File

@ -7,11 +7,10 @@ import {
} from '../types/plugin';
import Plugin from './base';
import ElementPlugin from './element';
import BlockPlugin from './block';
import InlinePlugin from './inline';
import BlockPlugin, { isBlockPlugin } from './block';
import InlinePlugin, { isInlinePlugin } from './inline';
import ListPlugin from './list';
import MarkPlugin from './mark';
import { BlockInterface } from '../types/block';
import MarkPlugin, { isMarkPlugin } from './mark';
import { isEngine } from '../utils';
class PluginModel implements PluginModelInterface {
@ -66,10 +65,7 @@ export {
InlinePlugin,
BlockPlugin,
ListPlugin,
};
export const isBlockPlugin = (
plugin: PluginInterface,
): plugin is BlockInterface => {
return plugin.kind === 'block';
isBlockPlugin,
isInlinePlugin,
isMarkPlugin,
};