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.
186 lines
41 KiB
186 lines
41 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 numbers = [];
|
|
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);
|
|
numbers[i] = matchNumber;
|
|
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(), footnoteDetail.length - 1);
|
|
}
|
|
}
|
|
|
|
module.exports = MyPlugin;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsIm1haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyohICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXHJcbkNvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLlxyXG5cclxuUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBm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cnR5LmNhbGwocywgcCkpIHRbcF0gPSBzW3BdO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdDtcclxuICAgIH1cclxuICAgIHJldHVybiBfX2Fzc2lnbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19yZXN0KHMsIGUpIHtcclxuICAgIHZhciB0ID0ge307XHJcbiAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkgJiYgZS5pbmRleE9mKHApIDwgMClcclxuICAgICAgICB0W3BdID0gc1twXTtcclxuICAgIGlmIChzICE9IG51bGwgJiYgdHlwZW9mIE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgPT09IFwiZnVuY3Rpb25cIilcclxuICAgICAgICBmb3IgKHZhciBpID0gMCwgcCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMocyk7IGkgPCBwLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgIGlmIChlLmluZGV4T2YocFtpXSkgPCAwICYmIE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChzLCBwW2ldKSlcclxuICAgICAgICAgICAgICAgIHRbcFtpXV0gPSBzW3BbaV1dO1xyXG4gICAgICAgIH1cclxuICAgIHJldHVybiB0O1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19kZWNvcmF0ZShkZWNvcmF0b3JzLCB0YXJnZXQsIGtleSwgZGVzYykge1xyXG4gICAgdmFyIGMgPSBhcmd1bWVudHMubGVuZ3RoLCByID0gYyA8IDMgPyB0YXJnZXQgOiBkZXNjID09PSBudWxsID8gZGVzYyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBrZXkpIDogZGVzYywgZDtcclxuICAgIGlmICh0eXBlb2YgUmVm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7IGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISh0ID0gXy50cnlzLCB0ID0gdC5sZW5ndGggPiAwICYmIHRbdC5sZW5ndGggLSAxXSkgJiYgKG9wWzBdID09PSA2IHx8IG9wWzBdID09PSAyKSkgeyBfID0gMDsgY29udGludWU7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAob3BbMF0gPT09IDMgJiYgKCF0IHx8IChvcFsxXSA+IHRbMF0gJiYgb3BbMV0gPCB0WzNdKSkpIHsgXy5sYWJlbCA9IG9wWzFdOyBicmVhazsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChvcFswXSA9PT0gNiAmJiBfLmxhYmVsIDwgdFsxXSkgeyBfLmxhYmVsID0gdFsxXTsgdCA9IG9wOyBicmVhazsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICh0ICYmIF8ubGFiZWwgPCB0WzJdKSB7IF8ubGFiZWwgPSB0WzJdOyBfLm9wcy5wdXNoKG9wKTsgYnJlYWs7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAodFsyXSkgXy5vcHMucG9wKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgXy50cnlzLnBvcCgpOyBjb250aW51ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvcCA9IGJvZHkuY2FsbCh0aGlzQXJnLCBfKTtcclxuICAgICAgICB9IGNhdGNoIChlKSB7IG9wID0gWzYsIGVdOyB5ID0gMDsgfSBmaW5hbGx5IHsgZiA9IHQgPSAwOyB9XHJcbiAgICAgICAgaWYgKG9wWzBdICYgNSkgdGhyb3cgb3BbMV07IHJldHVybiB7IHZhbHVlOiBvcFswXSA/IG9wWzFdIDogdm9pZCAwLCBkb25lOiB0cnVlIH07XHJcbiAgICB9XHJcbn1cclxuXHJcbmV4cG9ydCB2YXIgX19jcmVhdGVCaW5kaW5nID0gT2JqZWN0LmNyZWF0ZSA/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VwbGFjZShcIlteXCIsIFwiXCIpO1xyXG4gICAgICBpbmRleCA9IGluZGV4LnJlcGxhY2UoXCJdOlwiLCBcIlwiKTtcclxuICAgICAgbGV0IGZvb3Rub3RlID0gcy5yZXBsYWNlKFwiOlwiLCBcIlwiKTtcclxuXHJcbiAgICAgIGxldCByZXR1cm5MaW5lSW5kZXggPSBjdXJzb3JQb3NpdGlvbi5saW5lO1xyXG4gICAgICAvLyBmaW5kIHRoZSBGSVJTVCBPQ0NVUkVOQ0Ugd2hlcmUgdGhpcyBmb290bm90ZSBleGlzdHMgaW4gdGhlIHRleHRcclxuICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBkb2MubGluZUNvdW50KCk7IGkrKykge1xyXG4gICAgICAgIGxldCBzY2FuTGluZSA9IGRvYy5nZXRMaW5lKGkpO1xyXG4gICAgICAgIGlmIChzY2FuTGluZS5jb250YWlucyhmb290bm90ZSkpIHtcclxuICAgICAgICAgIGxldCBjdXJzb3JMb2NhdGlvbkluZGV4ID0gc2NhbkxpbmUuaW5kZXhPZihmb290bm90ZSk7XHJcbiAgICAgICAgICByZXR1cm5MaW5lSW5kZXggPSBpO1xyXG4gICAgICAgICAgZG9jLnNldEN1cnNvcih7XHJcbiAgICAgICAgICAgIGxpbmU6IHJldHVybkxpbmVJbmRleCxcclxuICAgICAgICAgICAgY2g6IGN1cnNvckxvY2F0aW9uSW5kZXggKyBmb290bm90ZS5sZW5ndGgsXHJcbiAgICAgICAgICB9KTtcclxuICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH1cclxuICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHJldHVybiBmYWxzZTtcclxuICB9XHJcblxyXG4gIHByaXZhdGUgc2hvdWxkSnVtcEZyb21NYXJrZXJUb0RldGFpbChcclxuICAgIGxpbmVUZXh0OiBzdHJpbmcsXHJcbiAgICBjdXJzb3JQb3NpdGlvbjogRWRpdG9yUG9zaXRpb24sXHJcbiAgICBkb2M6IEVka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A9IGxpbmVUZXh0LmluZGV4T2YobWFya2VyKTtcclxuICAgICAgICAgIGlmIChcclxuICAgICAgICAgICAgY3Vyc29yUG9zaXRpb24uY2ggPj0gaW5kZXhPZk1hcmtlckluTGluZSAmJlxyXG4gICAgICAgICAgICBjdXJzb3JQb3NpdGlvbi5jaCA8PSBpbmRleE9mTWFya2VySW5MaW5lICsgbWFya2VyLmxlbmd0aFxyXG4gICAgICAgICAgKSB7XHJcbiAgICAgICAgICAgIG1hcmtlclRhcmdldCA9IG1hcmtlcjtcclxuICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9XHJcblxyXG4gICAgaWYgKG1hcmtlclRhcmdldCAhPSBudWxsKSB7XHJcbiAgICAgIC8vIGV4dHJhY3QgaW5kZXhcclxuICAgICAgbGV0IG1hdGNoID0gbWFya2VyVGFyZ2V0Lm1hdGNoKHRoaXMubnVtZXJpY2FsUmUpO1xyXG4gICAgICBpZiAobWF0Y2gpIHtcclxuICAgICAgICBsZXQgaW5kZXhTdHJpbmcgPSBtYXRjaFswXTtcclxuICAgICAgICBsZXQgbWFya2VySW5kZXggPSBOdW1iZXIoaW5kZXhTdHJpbmcpO1xyXG5cclxuICAgICAgICAvLyBmaW5kIHRoZSBmaXJzdCBsaW5lIHdpdGggdGhpcyBkZXRhaWwgbWFya2VyIGluZGV4IGluIGl0LlxyXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZG9jLmxpbmVDb3VudCgpOyBpKyspIHtcclxuICAgICAgICAgIGxldCB0aGVMaW5lID0gZG9jLmdldExpbmUoaSk7XHJcbiAgICAgICAgICBsZXQgbGluZU1hdGNoID0gdGhlTGluZS5tYXRjaCh0aGlzLmRldGFpbExpbmVSZWdleCk7XHJcbiAgICAgICAgICBpZiAobGluZU1hdGNoKSB7XHJcbiAgICAgICAgICAgIC8vIGNvbXBhcmUgdG8gdGhlIGluZGV4XHJcbiAgIC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