diff --git a/src/tree.ts b/src/tree.ts index aa72670..01ddd67 100644 --- a/src/tree.ts +++ b/src/tree.ts @@ -78,6 +78,21 @@ export class NodeProp { /// `"Expression"` group). static group = new NodeProp({deserialize: str => str.split(" ")}) + /// Attached to nodes to indicate these should be + /// [displayed](https://codemirror.net/docs/ref/#language.syntaxTree) + /// in a bidirectional text isolate, so that direction-neutral + /// characters on their sides don't incorrectly get associated with + /// surrounding text. You'll generally want to set this for nodes + /// that contain arbitrary text, like strings and comments, and for + /// nodes that appear _inside_ arbitrary text, like HTML tags. When + /// not given a value, in a grammar declaration, defaults to + /// `"auto"`. + static isolate = new NodeProp<"rtl" | "ltr" | "auto">({deserialize: value => { + if (value && value != "rtl" && value != "ltr" && value != "auto") + throw new RangeError("Invalid value for isolate: " + value) + return (value as any) || "auto" + }}) + /// The hash of the [context](#lr.ContextTracker.constructor) /// that the node was parsed in, if any. Used to limit reuse of /// contextual nodes.