A world-class math input for the web
1import { CaretNode, h, t, VNode } from "@caret-js/core";
2import { MathExpressionTag } from "../tags/mathExpression";
3
4export class SubtractNode extends CaretNode {
5 constructor(public minuend: CaretNode, public subtrahend: CaretNode) {
6 super();
7 this.addTag(new MathExpressionTag());
8 }
9
10 static from(minuend: CaretNode, subtrahend: CaretNode): SubtractNode {
11 return new SubtractNode(minuend, subtrahend);
12 }
13
14 toDebugMathML(): VNode {
15 return h(
16 "mrow",
17 {},
18 this.minuend.toDebugMathML(),
19 h("mo", {}, t("-")),
20 this.subtrahend.toDebugMathML()
21 );
22 }
23}