Closed 534254884 closed 3 months ago
It is already possible, there is the index object which stores all the nodes by ID:
model.index.get(id);
If you console.log
some model, you will also see the index printed:
console.log('' + model);
will output something like this:
model
├─ root 0.0
│ └─ obj 2.1
│ ├─ "id"
│ │ └─ con 2.2 { "xyz" }
│ ├─ "text"
│ │ └─ str 2.3 { "hello" }
│ │ └─ StrChunk 2.4!5 len:5 { "hello" }
│ └─ "temperature"
│ └─ con 2.9 { 36.6 }
│
├─ index (4 nodes)
│ ├─ obj 2.1
│ ├─ con 2.2
│ ├─ str 2.3
│ └─ con 2.9
│
├─ view
│ └─ {
│ "id": "xyz",
│ "text": "hello",
│ "temperature": 36.6
│ }
│
└─ clock 1234.12
└─ 2.11
Can you provide a method to find the corresponding JsonNode through id: ITimestampStruct, so as to do some operations such as undo/redo with the information in JsonCrdtPatchOperation?