# Create a New Schema

This article describes how you can create a new [ProseMirror schema](https://www.telerik.com/blazor-ui/documentation/components/editor/prosemirror-schema/overview) for the Editor to use. Creating a new schema is useful if you want to change the majority of the default schema.

## Prerequisites

To work with ProseMirror, make sure you are familiar with:

* JavaScript—ProseMirror is a JavaScript library and the schema uses JavaScript syntax.
* <a href="https://prosemirror.net/docs/guide/#schema" target="_blank">ProseMirror Schema</a>—The schema structure and its children (<a href="https://prosemirror.net/docs/ref/#model.NodeType" target="_blank">nodes</a> and <a href="https://prosemirror.net/docs/ref/#model.MarkType" target="_blank">marks</a>).

Modifying the ProseMirror Schema is outside of the Editor scope and we do not provide support for such customizations.

## Basics

The Editor accepts a custom ProseMirror schema through its `Schema` parameter. Set this `string` parameter to the name of a JavaScript function that:

* Is declared in the global scope (the `window` object).
* Returns an instance of the <a href="https://prosemirror.net/docs/ref/#model.Schema" target="_blank">ProseMirror `Schema` class</a>(the updated schema). You can access this class from the `ProseMirror` object of the event arguments.
* Accepts a single argument.

The Editor will call this function and will pass an argument object that contains the following properties:

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Property      | Description                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `getSchema`   | A function that returns the current <a href="https://prosemirror.net/docs/ref/#model.Schema" target="_blank">`Schema` object</a>. Before the Editor is initialized, the returned `Schema` object is the default schema of the Editor. After the Editor is initialized, the returned `Schema` object is the updated schema. If you don't provide a custom schema, this function always returns the default schema. |
| `getView`     | A function that returns the currently used instance of the <a href="https://prosemirror.net/docs/ref/#view.EditorView" target="_blank">`EditorView` object</a>. Before the Editor is initialized, the view (the result of the function) is null.                                                                                                                                                                  |
| `ProseMirror` | An object that contains various ProseMirror classes and functions.                                                                                                                                                                                                                                                                                                                                                |

> You can set a custom schema only once during initialization of the Editor component. Further changes to the schema will not take effect and the component will continue using the initial custom or built-in schema.

## Plugin Dependencies

Some of the ProseMirror plugins that the Editor uses by design depend on specific nodes in the default ProseMirror schema of the Editor. To get a collection of the default plugins, use the [`getPlugins` function](https://www.telerik.com/blazor-ui/documentation/components/editor/prosemirror-plugins#adding-a-custom-plugin).

When creating a new schema from scratch, it is possible to get an exception if you do not include the needed nodes in your custom schema.

You have several options in this case:

* Include the corresponding nodes in your custom schema.
* Get the collection of default plugins and remove the plugins that require the missing node.
* Pass a [custom empty collection of plugins to the Editor](https://www.telerik.com/blazor-ui/documentation/components/editor/prosemirror-plugins) to override the built-in ones.

Note that with the last two options you will lose the functionality that comes with the plugin(s) you remove.

## Creating a New Schema

The following example shows how to:

* Create a new instance of the `Schema` object and include several nodes and marks in it. The new schema supports only a couple of HTML elements such as `<p>`, `<ul>`, `<ol>` and `<a>`.
* Remove a plugin that requires a node which is not part of your schema. The new Schema in this example does not include `<ol>` or `<ul>` elements, so we are removing the plugin that requires these nodes.
* Return the updated schema, so the Editor can use it.

> caption Create New ProseMirror Schema

```RAZOR
<demo metaUrl="client/editor/prosemirror-schema/create-new-schema/" height="550"></demo>
```

## See Also

* [Live Demo: Editor - ProseMirror Schema](https://demos.telerik.com/blazor-ui/editor/prosemirror-schema)
* [Modify the Default Schema](https://www.telerik.com/blazor-ui/documentation/components/editor/prosemirror-schema/modify-default-schema)


