2020-10-22 03:01:39 +08:00
|
|
|
import { Extensions } from '../types'
|
|
|
|
import { Extension } from '../Extension'
|
2020-11-16 18:19:43 +08:00
|
|
|
import { Node } from '../Node'
|
|
|
|
import { Mark } from '../Mark'
|
2020-10-22 03:01:39 +08:00
|
|
|
|
|
|
|
export default function splitExtensions(extensions: Extensions) {
|
2020-11-16 16:43:17 +08:00
|
|
|
const baseExtensions = extensions.filter(extension => extension instanceof Extension) as Extension[]
|
2020-11-16 18:19:43 +08:00
|
|
|
const nodeExtensions = extensions.filter(extension => extension instanceof Node) as Node[]
|
|
|
|
const markExtensions = extensions.filter(extension => extension instanceof Mark) as Mark[]
|
2020-10-22 03:01:39 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
baseExtensions,
|
|
|
|
nodeExtensions,
|
2020-10-22 03:13:38 +08:00
|
|
|
markExtensions,
|
2020-10-22 03:01:39 +08:00
|
|
|
}
|
|
|
|
}
|