Steps to reproduce
type in app.workspace.activeLeaf.view.editor.setLine(0,"1")
in console, trying to access Editor.setLine().
Expected result
Set the 1st line to 1
Actual result
Uncaught TypeError: this.cm.setLine is not a function
at t.setLine (app.js:1)
at <anonymous>:1:38
Environment
- Operating system: macOS 11.2.3 (20D91)
- Obsidian version: 0.11.13
Additional information
Also, I haven’t found the similar function in https://codemirror.net/doc/manual.html#api, is there something I’ve missed?
Potential polyfill:
const setLine = (line: number, str: string) =>
editor.replaceRange(
str,
{ line, ch: 0 },
{ line, ch: Infinity }
);