Skip to content
Closed
6 changes: 2 additions & 4 deletions docs/Api_Methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,11 @@ If the cursor is before the plus this method would return:
{
latex: 'a+b',
startIndex: 1,
endIndex: 1,
opaqueSnapshot: {...}
endIndex: 1
}
```

You can pass the result of `.selection()` back into `.selection()` to restore a cursor / selection. This works by taking a snapshot of the selection you currently have and recording
enough information to restore it within `opaqueSnapshot`. You should not peek inside of `opaqueSnapshot` or permanently store it. This is valid only for this version of MathQuill. This selection is also only valid if the MQ's latex is identical. The MQ can go through changes, but when you try to restore the selection the current latex must match the latex when the selection snapshot was created.
You can pass the result of `.selection()` back into `.selection()` to restore a cursor / selection.

```js
// this would work
Expand Down
5 changes: 0 additions & 5 deletions src/mathquill.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ declare namespace MathQuill {
latex: string;
startIndex: number;
endIndex: number;
opaqueSnapshot: {
uncleanedLatex: string;
cursorInsertPath: string;
signedSelectionSize: number;
};
};

interface BaseMathQuill {
Expand Down
2 changes: 1 addition & 1 deletion src/publicapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function getInterface(v: number): MathQuill.v3.API | MathQuill.v1.API {
return this;
}

return this.__controller.exportLatexSelection();
return this.__controller.exportLatexSelection().selection;
}
html() {
return this.__controller.root
Expand Down
Loading