18 lines
658 B
Markdown
18 lines
658 B
Markdown
<%*
|
|
if (this.app.workspace.activeLeaf.view.currentMode.type != "source"){this.app.commands.executeCommandById("markdown:toggle-preview");}
|
|
let editor = this.app.workspace.activeLeaf.view.editor;
|
|
let timestamp = tp.date.now("HH:mm");
|
|
let linePrefix = "\n- [ ] " + timestamp + " ";
|
|
editor.focus();
|
|
if (this.app.isMobile) {
|
|
editor.setCursor(editor.lastLine());
|
|
editor.replaceSelection(linePrefix)
|
|
editor.setCursor(editor.lastLine());;
|
|
} else {
|
|
const initialLines = editor.lineCount();
|
|
editor.setCursor({ line: initialLines, ch: 0 });
|
|
editor.replaceSelection(linePrefix);
|
|
const finalLines = editor.lineCount();
|
|
editor.setCursor({ ch: 0, line: finalLines });
|
|
}
|
|
%> |