You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
188 lines
43 KiB
188 lines
43 KiB
'use strict';
|
|
|
|
var obsidian = require('obsidian');
|
|
|
|
/******************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */
|
|
|
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
}
|
|
|
|
class MyPlugin extends obsidian.Plugin {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.detailLineRegex = /\[\^(\d+)\]\:/;
|
|
this.reOnlyMarkers = /\[\^(\d+)\]/gi;
|
|
this.numericalRe = /(\d+)/;
|
|
}
|
|
onload() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
this.addCommand({
|
|
id: "insert-footnote",
|
|
name: "Insert and Navigate Footnote",
|
|
checkCallback: (checking) => {
|
|
if (checking)
|
|
return !!this.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
|
|
this.insertFootnote();
|
|
},
|
|
});
|
|
});
|
|
}
|
|
insertFootnote() {
|
|
const mdView = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
|
|
if (!mdView)
|
|
return false;
|
|
if (mdView.editor == undefined)
|
|
return false;
|
|
const doc = mdView.editor;
|
|
const cursorPosition = doc.getCursor();
|
|
const lineText = doc.getLine(cursorPosition.line);
|
|
const markdownText = mdView.data;
|
|
if (this.shouldJumpFromDetailToMarker(lineText, cursorPosition, doc))
|
|
return;
|
|
if (this.shouldJumpFromMarkerToDetail(lineText, cursorPosition, doc))
|
|
return;
|
|
return this.shouldCreateNewFootnote(lineText, cursorPosition, doc, markdownText);
|
|
}
|
|
shouldJumpFromDetailToMarker(lineText, cursorPosition, doc) {
|
|
// check if we're in a footnote detail line ("[^1]: footnote")
|
|
// if so, jump cursor back to the footnote in the text
|
|
// https://github.com/akaalias/obsidian-footnotes#improved-quick-navigation
|
|
let match = lineText.match(this.detailLineRegex);
|
|
if (match) {
|
|
let s = match[0];
|
|
let index = s.replace("[^", "");
|
|
index = index.replace("]:", "");
|
|
let footnote = s.replace(":", "");
|
|
let returnLineIndex = cursorPosition.line;
|
|
// find the FIRST OCCURENCE where this footnote exists in the text
|
|
for (let i = 0; i < doc.lineCount(); i++) {
|
|
let scanLine = doc.getLine(i);
|
|
if (scanLine.contains(footnote)) {
|
|
let cursorLocationIndex = scanLine.indexOf(footnote);
|
|
returnLineIndex = i;
|
|
doc.setCursor({
|
|
line: returnLineIndex,
|
|
ch: cursorLocationIndex + footnote.length,
|
|
});
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
shouldJumpFromMarkerToDetail(lineText, cursorPosition, doc) {
|
|
// Jump cursor TO detail marker
|
|
// check if the cursor is inside or left or right of a footnote in a line
|
|
// if so, jump cursor to the footnote detail line
|
|
// https://github.com/akaalias/obsidian-footnotes#improved-quick-navigation
|
|
// does this line have a footnote marker?
|
|
// does the cursor overlap with one of them?
|
|
// if so, which one?
|
|
// find this footnote marker's detail line
|
|
// place cursor there
|
|
let reOnlyMarkersMatches = lineText.match(this.reOnlyMarkers);
|
|
let markerTarget = null;
|
|
if (reOnlyMarkersMatches) {
|
|
for (let i = 0; i <= reOnlyMarkersMatches.length; i++) {
|
|
let marker = reOnlyMarkersMatches[i];
|
|
if (marker != undefined) {
|
|
let indexOfMarkerInLine = lineText.indexOf(marker);
|
|
if (cursorPosition.ch >= indexOfMarkerInLine &&
|
|
cursorPosition.ch <= indexOfMarkerInLine + marker.length) {
|
|
markerTarget = marker;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (markerTarget != null) {
|
|
// extract index
|
|
let match = markerTarget.match(this.numericalRe);
|
|
if (match) {
|
|
let indexString = match[0];
|
|
let markerIndex = Number(indexString);
|
|
// find the first line with this detail marker index in it.
|
|
for (let i = 0; i < doc.lineCount(); i++) {
|
|
let theLine = doc.getLine(i);
|
|
let lineMatch = theLine.match(this.detailLineRegex);
|
|
if (lineMatch) {
|
|
// compare to the index
|
|
let indexMatch = lineMatch[1];
|
|
let indexMatchNumber = Number(indexMatch);
|
|
if (indexMatchNumber == markerIndex) {
|
|
doc.setCursor({ line: i, ch: lineMatch[0].length + 1 });
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
shouldCreateNewFootnote(lineText, cursorPosition, doc, markdownText) {
|
|
// create new footnote with the next numerical index
|
|
let matches = markdownText.match(this.reOnlyMarkers);
|
|
let currentMax = 1;
|
|
if (matches != null) {
|
|
for (let i = 0; i <= matches.length - 1; i++) {
|
|
let match = matches[i];
|
|
match = match.replace("[^", "");
|
|
match = match.replace("]", "");
|
|
let matchNumber = Number(match);
|
|
if (matchNumber + 1 > currentMax) {
|
|
currentMax = matchNumber + 1;
|
|
}
|
|
}
|
|
}
|
|
let footNoteId = currentMax;
|
|
let footnoteMarker = `[^${footNoteId}]`;
|
|
let linePart1 = lineText.substr(0, cursorPosition.ch);
|
|
let linePart2 = lineText.substr(cursorPosition.ch);
|
|
let newLine = linePart1 + footnoteMarker + linePart2;
|
|
doc.replaceRange(newLine, { line: cursorPosition.line, ch: 0 }, { line: cursorPosition.line, ch: lineText.length });
|
|
let lastLineIndex = doc.lastLine();
|
|
let lastLine = doc.getLine(lastLineIndex);
|
|
while (lastLineIndex > 0) {
|
|
lastLine = doc.getLine(lastLineIndex);
|
|
if (lastLine.length > 0) {
|
|
doc.replaceRange("", { line: lastLineIndex, ch: 0 }, { line: doc.lastLine(), ch: 0 });
|
|
break;
|
|
}
|
|
lastLineIndex--;
|
|
}
|
|
let footnoteDetail = `\n[^${footNoteId}]: `;
|
|
if (currentMax == 1) {
|
|
footnoteDetail = "\n" + footnoteDetail;
|
|
doc.setLine(doc.lastLine(), lastLine + footnoteDetail);
|
|
doc.setCursor(doc.lastLine() - 1, footnoteDetail.length - 1);
|
|
}
|
|
else {
|
|
doc.setLine(doc.lastLine(), lastLine + footnoteDetail);
|
|
doc.setCursor(doc.lastLine(), footnoteDetail.length - 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = MyPlugin;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsIm1haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxyXG5Db3B5cmlnaHQgKGMpIE1pY3Jvc29mdCBDb3Jwb3JhdGlvbi5cclxuXHJcblBlcm1pc3Npb24gdG8gdXNlLCBjb3B5LC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TtcclxuICAgICAgICAgICAgICAgIGNhc2UgNzogb3AgPSBfLm9wcy5wb3AoKTsgXy50cnlzLnBvcCgpOyBjb250aW51ZTtcclxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IF8udHJ5cywgdCA9IHQubGVuZ3RoID4gMCAmJiB0W3QubGVuZ3RoIC0gMV0pICYmIChvcFswXSA9PT0gNiB8fCBvcFswXSA9PT0gMikpIHsgXyA9IDA7IGNvbnRpbnVlOyB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wWzBdID09PSAzICYmICghdCB8fCAob3BbMV0gPiB0WzBdICYmIG9wWzFdIDwgdFszXSkpKSB7IF8ubGFiZWwgPSBvcFsxXTsgYnJlYWs7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAob3BbMF0gPT09IDYgJiYgXy5sYWJlbCA8IHRbMV0pIHsgXy5sYWJlbCA9IHRbMV07IHQgPSBvcDsgYnJlYWs7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiBfLmxhYmVsIDwgdFsyXSkgeyBfLmxhYmVsID0gdFsyXTsgXy5vcHMucHVzaChvcCk7IGJyZWFrOyB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRbMl0pIF8ub3BzLnBvcCgpO1xyXG4gICAgICAgICAgICAgICAgICAgIF8udHJ5cy5wb3AoKTsgY29udGludWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgb3AgPSBib2R5LmNhbGwodGhpc0FyZywgXyk7XHJcbiAgICAgICAgfSBjYXRjaCAoZSkgeyBvcCA9IFs2LCBlXTsgeSA9IDA7IH0gZmluYWxseSB7IGYgPSB0ID0gMDsgfVxyXG4gICAgICAgIGlmIChvcFswXSAmIDUpIHRocm93IG9wWzFdOyByZXR1cm4geyB2YWx1ZTogb3BbMF0gPyBvcFsxXSA6IHZvaWQgMCwgZG9uZTogdHJ1ZSB9O1xyXG4gIC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GSVJTVCBPQ0NVUkVOQ0Ugd2hlcmUgdGhpcyBmb290bm90ZSBleGlzdHMgaW4gdGhlIHRleHRcclxuICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBkb2MubGluZUNvdW50KCk7IGkrKykge1xyXG4gICAgICAgIGxldCBzY2FuTGluZSA9IGRvYy5nZXRMaW5lKGkpO1xyXG4gICAgICAgIGlmIChzY2FuTGluZS5jb250YWlucyhmb290bm90ZSkpIHtcclxuICAgICAgICAgIGxldCBjdXJzb3JMb2NhdGlvbkluZGV4ID0gc2NhbkxpbmUuaW5kZXhPZihmb290bm90ZSk7XHJcbiAgICAgICAgICByZXR1cm5MaW5lSW5kZXggPSBpO1xyXG4gICAgICAgICAgZG9jLnNldEN1cnNvcih7XHJcbiAgICAgICAgICAgIGxpbmU6IHJldHVybkxpbmVJbmRleCxcclxuICAgICAgICAgICAgY2g6IGN1cnNvckxvY2F0aW9uSW5kZXggKyBmb290bm90ZS5sZW5ndGgsXHJcbiAgICAgICAgICB9KTtcclxuICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH1cclxuICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHJldHVybiBmYWxzZTtcclxuICB9XHJcblxyXG4gIHByaXZhdGUgc2hvdWxkSnVtcEZyb21NYXJrZXJUb0RldGFpbChcclxuICAgIGxpbmVUZXh0OiBzdHJpbmcsXHJcbiAgICBjdXJzb3JQb3NpdGlvbjogRWRpdG9yUG9zaXRpb24sXHJcbiAgICBkb2M6IEVkaXRvclxyXG4gICkge1xyXG4gICAgLy8gSnVtcCBjdXJzb3IgVE8gZGV0YWlsIG1hcmtlclxyXG4gICAgLy8gY2hlY2sgaWYgdGhlIGN1cnNvciBpcyBpbnNpZGUgb3IgbGVmdCBvciByaWdodCBvZiBhIGZvb3Rub3RlIGluIGEgbGluZVxyXG4gICAgLy8gaWYgc28sIGp1bXAgY3Vyc29yIHRvIHRoZSBmb290bm90ZSBkZXRhaWwgbGluZVxyX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gICAgICAgIG1hcmtlclRhcmdldCA9IG1hcmtlcjtcclxuICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9XHJcblxyXG4gICAgaWYgKG1hcmtlclRhcmdldCAhPSBudWxsKSB7XHJcbiAgICAgIC8vIGV4dHJhY3QgaW5kZXhcclxuICAgICAgbGV0IG1hdGNoID0gbWFya2VyVGFyZ2V0Lm1hdGNoKHRoaXMubnVtZXJpY2FsUmUpO1xyXG4gICAgICBpZiAobWF0Y2gpIHtcclxuICAgICAgICBsZXQgaW5kZXhTdHJpbmcgPSBtYXRjaFswXTtcclxuICAgICAgICBsZXQgbWFya2VySW5kZXggPSBOdW1iZXIoaW5kZXhTdHJpbmcpO1xyXG5cclxuICAgICAgICAvLyBmaW5kIHRoZSBmaXJzdCBsaW5lIHdpdGggdGhpcyBkZXRhaWwgbWFya2VyIGluZGV4IGluIGl0LlxyXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZG9jLmxpbmVDb3VudCgpOyBpKyspIHtcclxuICAgICAgICAgIGxldCB0aGVMaW5lID0gZG9jLmdldExpbmUoaSk7XHJcbiAgICAgICAgICBsZXQgbGluZU1hdGNoID0gdGhlTGluZS5tYXRjaCh0aGlzLmRldGFpbExpbmVSZWdleCk7XHJcbiAgICAgICAgICBpZiAobGluZU1hdGNoKSB7XHJcbiAgICAgICAgICAgIC8vIGNvbXBhcmUgdG8gdGhlIGluZGV4XHJcbiAgICAgICAgICAgIGxldCBpbmRleE1hdGNoID0gbGluZU1hdGNoWzFdO1xyXG4gICAgICAgICAgICBsZXQgaW5kZXhNYXRjaE51bWJlciA9IE51bWJlcihpbmRleE1hdGNoKTtcclxuICAgICAgICAgICAgaWYgKGluZGV4TWF0Y2hOdW1iZXIgPT0gbWFya2VySW5kZXgpIHtcclxuICAgICAgICAgICAgICBkb2Muc2V0Q3Vyc29yKHsgbGluZTogaSwgY2g6IGxpbm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