How to update the basic schema's paragraph to support line-height and text-align?

I tried the following code to update the basic schema but it says “cannot set property ‘line-height’ of undefined”. I am using TypeScript btw. Not sure if this is the right way to update the schema?

(schema.spec.nodes as OrderedMap<NodeSpec>).get("paragraph").attrs[
  "line-height"
] = { default: 1 };

Just going in an changing properties on schema/document/library objects will rarely work in ProseMirror. You have to create a new Schema instance, and use the OrderedMap methods to manipulate the set of node specs to hold the structure you want.

Thanks. Managed to get it working with the following code.

const paragraphSpec: NodeSpec = {
  content: "inline*",
  group: "block",
  parseDOM: [{ tag: "p" }],
  toDOM(node) {
  return [
   "p",
   {
     style: `text-align:${node.attrs["text-align"]};line-height:${node.attrs["line-height"]}`
   },
   0
  ];
},
attrs: {
  "line-height": { default: 1 },
  "text-align": { default: "left" }
}
};  
const updatedNodes = (schema.spec.nodes as OrderedMap<NodeSpec>)
   .remove("paragraph")
   .addBefore("blockquote", "paragraph", paragraphSpec);