XeNote/posts/.obsidian/plugins/completed-area/main.js
web-meister a97a7b4f33 ...
2021-03-04 00:33:38 +03:00

352 lines
61 KiB
JavaScript

'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.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
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());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
var CompletedAreaSettingTab = /** @class */ (function (_super) {
__extends(CompletedAreaSettingTab, _super);
function CompletedAreaSettingTab(app, plugin) {
var _this = _super.call(this, app, plugin) || this;
_this.defaultHeaderLevel = "2";
_this.defaultHeaderName = "Completed";
_this.plugin = plugin;
return _this;
}
CompletedAreaSettingTab.prototype.display = function () {
var _this = this;
var containerEl = this.containerEl;
containerEl.empty();
new obsidian.Setting(containerEl)
.setName("Header level")
.setDesc("number of `#`s in the header.")
.addText(function (text) {
return text
.setPlaceholder(_this.defaultHeaderLevel)
.setValue(_this.plugin.setting.completedAreaHierarchy)
.onChange(function (value) {
if (_this.isHierarchyValid(value)) {
_this.plugin.setting.completedAreaHierarchy =
value || _this.defaultHeaderLevel;
_this.plugin.saveData(_this.plugin.setting).then(function () {
text.setValue(value);
});
}
else {
new obsidian.Notice("Header level's number not valid!");
}
});
});
new obsidian.Setting(containerEl)
.setName("Header name")
.setDesc("where the completed items be extracted to.")
.addText(function (text) {
return text
.setPlaceholder(_this.defaultHeaderName)
.setValue(_this.plugin.setting.completedAreaName)
.onChange(function (value) {
_this.plugin.setting.completedAreaName =
value || _this.defaultHeaderName;
_this.plugin.saveData(_this.plugin.setting);
text.setValue(value);
});
});
new obsidian.Setting(containerEl)
.setName("Show icon on left sidebar")
.addToggle(function (toggle) {
toggle.setValue(_this.plugin.setting.showIcon).onChange(function (value) {
_this.plugin.setting.showIcon = value;
_this.plugin.saveData(_this.plugin.setting);
new obsidian.Notice("Reload the app to see icon " + (value ? "added" : "removed") + ".");
});
});
};
CompletedAreaSettingTab.prototype.isHierarchyValid = function (hierarchyLevel) {
var e_1, _a;
var validLevels = [1, 2, 3, 4, 5, 6];
try {
for (var validLevels_1 = __values(validLevels), validLevels_1_1 = validLevels_1.next(); !validLevels_1_1.done; validLevels_1_1 = validLevels_1.next()) {
var validNum = validLevels_1_1.value;
if (Number(hierarchyLevel) === validNum || hierarchyLevel === "") {
return true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (validLevels_1_1 && !validLevels_1_1.done && (_a = validLevels_1.return)) _a.call(validLevels_1);
}
finally { if (e_1) throw e_1.error; }
}
return false;
};
return CompletedAreaSettingTab;
}(obsidian.PluginSettingTab));
var CompletedAreaSetting = /** @class */ (function () {
function CompletedAreaSetting() {
this.completedAreaHierarchy = "2";
this.completedAreaName = "Completed";
this.todoAreaName = "Todo";
this.showIcon = true;
this.sortedBy = "Asc";
}
return CompletedAreaSetting;
}());
obsidian.addIcon("completed-area", '<g id="icon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><rect id="Rectangle" stroke="currentColor" stroke-width="8" x="20" y="20" width="60" height="60" rx="10"></rect><path d="M68.7153857,33.5033079 L72.0903697,35.8858648 C72.5415551,36.2043773 72.6491076,36.8283407 72.3305951,37.2795261 L72.2641586,37.3636708 L48.720426,64.1010398 C46.5305195,66.5880005 42.7391695,66.8288105 40.2522088,64.638904 C40.1258491,64.5276373 40.0042287,64.4111011 39.8876706,64.2896051 L28.6056533,52.5296259 C28.258873,52.1681543 28.2330404,51.6058741 28.5452158,51.2141283 L31.9837559,46.899139 C32.3279438,46.467221 32.9571019,46.3961018 33.3890199,46.7402897 C33.4274056,46.7708786 33.4634871,46.8042521 33.4969719,46.8401396 L42.8381754,56.8516325 C43.5917202,57.6592488 44.8572913,57.7030825 45.6649076,56.9495377 L45.7632746,56.8511374 L67.4072774,33.6382921 C67.7482521,33.2726022 68.3069198,33.2149531 68.7153857,33.5033079 Z" id="Path" fill="currentColor" fill-rule="nonzero"></path></g>');
var CompletedAreaPlugin = /** @class */ (function (_super) {
__extends(CompletedAreaPlugin, _super);
function CompletedAreaPlugin() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.completedItemRegx = /(\n?- \[x\] .*)/g;
return _this;
}
CompletedAreaPlugin.prototype.onload = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.setting = new CompletedAreaSetting();
return [4 /*yield*/, this.loadSetting()];
case 1:
_a.sent();
if (this.setting.showIcon) {
this.addRibbonIcon("completed-area", "Completed Area", function () {
_this.editSource();
});
}
this.addCommand({
id: "completed-area-shortcut",
name: "Extracted completed items.",
hotkeys: [{ modifiers: ["Ctrl"], key: "Enter" }],
callback: function () {
_this.editSource();
},
});
this.addSettingTab(new CompletedAreaSettingTab(this.app, this));
return [2 /*return*/];
}
});
});
};
CompletedAreaPlugin.prototype.loadSetting = function () {
return __awaiter(this, void 0, void 0, function () {
var loadedSetting;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.loadData()];
case 1:
loadedSetting = _a.sent();
if (loadedSetting) {
this.setting.completedAreaHierarchy =
loadedSetting.completedAreaHierarchy;
this.setting.completedAreaName = loadedSetting.completedAreaName;
this.setting.todoAreaName = loadedSetting.todoAreaName;
this.setting.showIcon = loadedSetting.showIcon;
}
else {
this.saveData(this.setting);
}
return [2 /*return*/];
}
});
});
};
CompletedAreaPlugin.prototype.editSource = function () {
var _a, _b;
var activeLeaf = (_a = this.app.workspace.activeLeaf) !== null && _a !== void 0 ? _a : null;
if (activeLeaf) {
var source = activeLeaf.view.sourceMode;
var sourceText = source.get();
var todoRegx = /-\s\[[\sx]\]\s/gi;
var toggledText = this.toggleElement(todoRegx, this.replaceTodo);
var completedItems = (_b = this.extractCompletedItems(toggledText)) !== null && _b !== void 0 ? _b : null;
if (completedItems) {
var newText = this.refactorContent(toggledText, completedItems);
source.set(newText, false);
}
}
else {
new obsidian.Notice("Please active a leaf first.");
}
};
CompletedAreaPlugin.prototype.replaceTodo = function (startWith) {
return startWith === "- [ ] " ? "- [x] " : "- [ ] ";
};
CompletedAreaPlugin.prototype.extractCompletedItems = function (text) {
var completedItems = [];
if (text) {
completedItems = text.match(this.completedItemRegx);
if (!completedItems) {
new obsidian.Notice("No completed todos found.");
return;
}
return completedItems;
}
};
CompletedAreaPlugin.prototype.refactorContent = function (content, items) {
var completedArea = this.formatItems(items, content);
console.log(completedArea);
var header = this.completedAreaHeader.trimStart();
var newContent = content
.replace(this.completedItemRegx, "") // Remove completed items in main text
.trimStart()
.trimEnd();
return this.isCompletedAreaExisted(content)
? newContent.replace(header, "" + header + completedArea)
: newContent + completedArea;
};
CompletedAreaPlugin.prototype.formatItems = function (items, content) {
var completedArea = "";
var header = this.makeCompletedHeader(content);
items[0] = (items[0][0] === "\n" ? "" : "\n") + items[0];
completedArea = items.reduce(function (prev, current) {
return prev + current;
}, header);
return completedArea;
};
CompletedAreaPlugin.prototype.makeCompletedHeader = function (content) {
this.completedAreaHeader =
"\n" +
"#".repeat(Number(this.setting.completedAreaHierarchy)) +
(" " + this.setting.completedAreaName);
return this.isCompletedAreaExisted(content)
? "" // if completed header already exists
: this.completedAreaHeader;
};
CompletedAreaPlugin.prototype.isCompletedAreaExisted = function (content) {
return !!content.match(RegExp(this.completedAreaHeader));
};
CompletedAreaPlugin.prototype.toggleElement = function (re, subst) {
var activeLeaf = this.app.workspace.activeLeaf;
var editor = activeLeaf.view.sourceMode.cmEditor;
var selection = editor.somethingSelected();
var selectedText = this.getSelectedText(editor);
var newString = selectedText.content.replace(re, subst);
editor.replaceRange(newString, selectedText.start, selectedText.end);
// Keep cursor in the same place
if (selection) {
editor.setSelection(selectedText.start, {
line: selectedText.end.line,
ch: editor.getLine(selectedText.end.line).length,
});
}
return activeLeaf.view.sourceMode.get();
};
CompletedAreaPlugin.prototype.getSelectedText = function (editor) {
if (editor.somethingSelected()) {
// Toggle to-dos under the selection
var cursorStart = editor.getCursor(true);
var cursorEnd = editor.getCursor(false);
var content = editor.getRange({ line: cursorStart.line, ch: 0 }, { line: cursorEnd.line, ch: editor.getLine(cursorEnd.line).length });
return {
start: { line: cursorStart.line, ch: 0 },
end: {
line: cursorEnd.line,
ch: editor.getLine(cursorEnd.line).length,
},
content: content,
};
}
else {
// Toggle the todo in the line
var lineNr = editor.getCursor().line;
var contents = editor.getDoc().getLine(lineNr);
var cursorStart = {
line: lineNr,
ch: 0,
};
var cursorEnd = {
line: lineNr,
ch: contents.length,
};
var content = editor.getRange(cursorStart, cursorEnd);
return { start: cursorStart, end: cursorEnd, content: content };
}
};
return CompletedAreaPlugin;
}(obsidian.Plugin));
module.exports = CompletedAreaPlugin;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIj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c2UgMTogdCA9IG9wOyBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgNDogXy5sYWJlbCsrOyByZXR1cm4geyB2YWx1ZTogb3BbMV0sIGRvbmU6IGZhbHNlIH07XHJcbiAgICAgICAgICAgICAgICBjYXNlIDU6IF8ubGFiZWwrKzsgeSA9IG9wWzFdOyBvcCA9IFswXTsgY29udGludWU7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDc6IG9wID0gXy5vcHMucG9wKCk7IF8udHJ5cy5wb3AoKTsgY29udGludWU7XHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghKHQgPSBfLnRyeXMsIHQgPSB0Lmxlbmd0aCA+IDAgJiYgdFt0Lmxlbmd0aCAtIDFdKSAmJiAob3BbMF0gPT09IDYgfHwgb3BbMF0gPT09IDIpKSB7IF8gPSAwOyBjb250aW51ZTsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChvcFswXSA9PT0gMyAmJiAoIXQgfHwgKG9wWzFdID4gdFswXSAmJiBvcFsxXSA8IHRbM10pKSkgeyBfLmxhYmVsID0gb3BbMV07IGJyZWFrOyB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wWzBdID09PSA2ICYmIF8ubGFiZWwgPCB0WzFdKSB7IF8ubGFiZWwgPSB0WzFdOyB0ID0gb3A7IGJyZWFrOyB9XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgXy5sYWJlbCA8IHRbMl0pIHsgXy5sYWJlbCA9IHRbMl07IF8ub3BzLnB1c2gob3ApOyBicmVhazsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICh0WzJdKSBfLm9wcy5wb3AoKTtcclxuICAgICAgICAgICAgICAgICAgICBfLnRyeXMucG9wKCk7IGNvbnRpbnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIG9wID0gYm9keS5jYWxsKHRoaXNBcmcsIF8pO1xyXG4gICA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