mirror of
https://github.com/outline/outline.git
synced 2026-01-29 22:58:49 -06:00
15 lines
389 B
TypeScript
15 lines
389 B
TypeScript
import { Schema } from "prosemirror-model";
|
|
|
|
/**
|
|
* Generate a map of text serializers for a given schema
|
|
* @param schema
|
|
* @returns Text serializers
|
|
*/
|
|
export function getTextSerializers(schema: Schema) {
|
|
return Object.fromEntries(
|
|
Object.entries(schema.nodes)
|
|
.filter(([, node]) => node.spec.toPlainText)
|
|
.map(([name, node]) => [name, node.spec.toPlainText])
|
|
);
|
|
}
|