update
This commit is contained in:
69
.obsidian/plugins/postfix/main.js
vendored
69
.obsidian/plugins/postfix/main.js
vendored
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// main.ts
|
||||
var main_exports = {};
|
||||
__export(main_exports, {
|
||||
default: () => MyPlugin
|
||||
});
|
||||
module.exports = __toCommonJS(main_exports);
|
||||
var import_obsidian = require("obsidian");
|
||||
var MyPlugin = class extends import_obsidian.Plugin {
|
||||
async onload() {
|
||||
const templates = [
|
||||
{ regex: /(.*)\.###\s+(.*)$/, before: "### ", after: "$1$2" },
|
||||
{ regex: /(.*)\.##\s+(.*)$/, before: "## ", after: "$1$2" },
|
||||
{ regex: /(.*)\.#\s+(.*)$/, before: "# ", after: "$1$2" },
|
||||
{ regex: /(.*)\.\-\s+(.*)$/, before: "- ", after: "$1$2" },
|
||||
{ regex: /(.*)\.>\s+(.*)$/, before: "> ", after: "$1$2" },
|
||||
{ regex: /(.*)\.\+\s+(.*)$/, before: "+ ", after: "$1$2" },
|
||||
{ regex: /\-(.*)\.\[\]\s+(.*)$/, before: "- [ ] ", after: "$1$2 " },
|
||||
{ regex: /(.*)\.\[\]\s+(.*)$/, before: "[ ] ", after: "$1$2 " },
|
||||
{ regex: /\-(.*)\.\[x\]\s+(.*)$/, before: "- [x] ", after: "$1$2 " },
|
||||
{ regex: /(.*)\.\[x\]\s+(.*)$/, before: "[x] ", after: "$1$2 " }
|
||||
];
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("editor-change", (editor) => {
|
||||
const cm = editor;
|
||||
const cursor = cm.getCursor();
|
||||
const line = cm.getLine(cursor.line);
|
||||
const lineLength = line.length;
|
||||
const prevLine = cm.getLine(cursor.line - 1);
|
||||
const prevLineLength = prevLine.length;
|
||||
for (const { regex, before, after } of templates) {
|
||||
if (regex.test(line)) {
|
||||
const newLine = line.replace(regex, `${before}$2${after}`);
|
||||
cm.replaceRange(newLine, { line: cursor.line, ch: 0 }, { line: cursor.line, ch: lineLength });
|
||||
break;
|
||||
} else if (regex.test(prevLine)) {
|
||||
const newLine = prevLine.replace(regex, `${before}$2${after}`);
|
||||
cm.replaceRange(newLine, { line: cursor.line - 1, ch: 0 }, { line: cursor.line - 1, ch: prevLineLength });
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
onunload() {
|
||||
}
|
||||
};
|
14
.obsidian/plugins/postfix/manifest.json
vendored
14
.obsidian/plugins/postfix/manifest.json
vendored
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"id": "postfix",
|
||||
"name": "Postfix",
|
||||
"minAppVersion": "0.15.0",
|
||||
"version": "1.1.3",
|
||||
"description": "This plugin provides postfix completions for Obsidian. The built-in completions are provided for markdown.",
|
||||
"author": "Bhagya Nirmaan Silva",
|
||||
"authorUrl": "https://github.com/bhagyas",
|
||||
"fundingUrl": {
|
||||
"Buy me a Coffee": "https://www.buymeacoffee.com/bhagyas",
|
||||
"Say Hello on LinkedIn": "https://linkedin.com/in/bhagyas"
|
||||
},
|
||||
"isDesktopOnly": false
|
||||
}
|
8
.obsidian/plugins/postfix/styles.css
vendored
8
.obsidian/plugins/postfix/styles.css
vendored
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
|
||||
This CSS file will be included with your plugin, and
|
||||
available in the app when your plugin is enabled.
|
||||
|
||||
If your plugin does not need CSS, delete this file.
|
||||
|
||||
*/
|
Reference in New Issue
Block a user