forked from SkepticMystic/semantic-links
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
242 lines (231 loc) · 44.2 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
if you want to view the source visit the plugins github repository
*/
'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());
});
}
const DEFAULT_SETTINGS = {};
const A_TAG = new RegExp(/^\s*<a.*?>.*?<\/a>\s*$/);
class SettingTab extends obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
let { containerEl } = this;
containerEl.empty();
}
}
class EmojiSuggester extends obsidian.EditorSuggest {
constructor(plugin) {
super(plugin.app);
this.options = ["type1", "type2", "another", "more"];
this.plugin = plugin;
}
onTrigger(cursor, editor) {
const sub = editor.getLine(cursor.line).substring(0, cursor.ch);
const match = sub.match(/<a[\s\w]*?(\w*)$/);
const query = match === null || match === void 0 ? void 0 : match[1].trim();
if (query !== undefined) {
return {
end: cursor,
start: {
ch: match.index,
line: cursor.line,
},
query,
};
}
return null;
}
getSuggestions(context) {
if (context.query === "") {
return this.options;
}
return this.options.filter((p) => p.includes(context.query.replace("<a", "")));
}
renderSuggestion(suggestion, el) {
const outer = el.createDiv({ cls: "SL-suggester-container" });
outer.createDiv().setText(suggestion);
}
selectSuggestion(suggestion) {
const { editor, query, start, end } = this.context;
const range = editor.getRange(start, end);
const realStart = editor.posToOffset(editor.getCursor()) - query.length;
if (this.context) {
editor.replaceRange(`${range[range.length - 1] === " " ? "" : " "}${suggestion} `, editor.offsetToPos(realStart), end);
}
}
}
class SLPlugin extends obsidian.Plugin {
onload() {
return __awaiter(this, void 0, void 0, function* () {
yield this.loadSettings();
this.registerEditorSuggest(new EmojiSuggester(this));
this.addCommand({
id: "cmd",
name: "Command",
callback: () => __awaiter(this, void 0, void 0, function* () {
console.time("cmd");
console.log(yield this.getSLs(this.app.workspace.getActiveFile()));
console.timeEnd("cmd");
}),
});
this.addSettingTab(new SettingTab(this.app, this));
});
}
onunload() { }
// parseAttrs(attrs: string): ParsedSemanticLink {
// }
// async getSLs(file: TFile): Promise<ParsedSemanticLink[]> {
// const SLs: ParsedSemanticLink[] = [];
// const { links } = this.app.metadataCache.getFileCache(file);
// if (!links) return;
// const content = await this.app.vault.cachedRead(file);
// const matches = [...content.matchAll(SL_ELEMENT)];
// matches.forEach((match) => {
// console.log({ match });
// const [text, index] = [match[0], match.index];
// const lBefore = links.find((l) => l.position.end.offset + 1 === index);
// const lAfter = links.find(
// (l) => l.position.start.offset - 1 === index + text.length
// );
// if (!lBefore && !lAfter) return;
// var { firstChild } = createEl("a", {}, (el) => (el.innerHTML = text));
// const attrs = [...firstChild.attributes];
// const currSL: ParsedSemanticLink = { inner: "" };
// currSL.from = lBefore.link;
// currSL.to = lAfter.link;
// currSL.inner = firstChild.innerText;
// attrs.forEach((attr) => {
// const { name, value } = attr;
// currSL[name] = value === "" ? true : value;
// });
// SLs.push(currSL);
// });
// return SLs;
// }
// async getSL(file: TFile): Promise<ParsedSemanticLink[]> {
// const { links } = this.app.metadataCache.getFileCache(file);
// if (!links) return;
// const content = await this.app.vault.cachedRead(file);
// const tempLinks: { link: LinkCache; aBefore: string; aAfter: string }[] =
// [];
// links.forEach((l) => {
// const {
// position: { start, end },
// } = l;
// const sOff = start.offset;
// const eOff = end.offset;
// const tBefore = content.slice(0, sOff === 0 ? 0 : sOff - 1);
// const tAfter = content.slice(
// eOff === content.length ? content.length : eOff + 1
// );
// const aBefore = tBefore.split("<a").last();
// const aAfter = tAfter.split("</a>").first();
// const currLink: { link: LinkCache; aBefore: string; aAfter: string } = {
// link: l,
// aBefore: undefined,
// aAfter: undefined,
// };
// if (aBefore) currLink.aBefore = "<a" + aBefore;
// if (aAfter) currLink.aAfter = aAfter + "</a>";
// tempLinks.push(currLink);
// });
// console.log(tempLinks);
// const SLs: ParsedSemanticLink[] = [];
// tempLinks.forEach((currL) => {
// const matchingLink = tempLinks.find(
// (l) =>
// currL.aAfter &&
// currL.link.position.end.offset + 2 + currL.aAfter.length ===
// l.link.position.start.offset
// );
// console.log({ matchingLink });
// if (matchingLink !== undefined) {
// var { firstChild } = createEl(
// "a",
// {},
// (el) => (el.innerHTML = matchingLink.aBefore)
// );
// const attrs = [...firstChild.attributes];
// const currSL: ParsedSemanticLink = { inner: "" };
// currSL.from = currL.link.link;
// currSL.to = matchingLink.link.link;
// currSL.inner = firstChild.innerText;
// attrs.forEach((attr) => {
// const { name, value } = attr;
// currSL[name] = value === "" ? true : value;
// });
// SLs.push(currSL);
// }
// });
// console.log({ SLs });
// }
getSLs(file) {
return __awaiter(this, void 0, void 0, function* () {
const { links } = this.app.metadataCache.getFileCache(file);
if (!links)
return;
const SLs = [];
const content = yield this.app.vault.cachedRead(file);
links.forEach((curr, i) => {
var _a;
const next = links[i + 1];
if (!next)
return;
const currE = curr.position.end.offset;
const nextS = next.position.start.offset;
const between = content.slice(currE, nextS);
const tag = (_a = between.match(A_TAG)) === null || _a === void 0 ? void 0 : _a[0];
if (tag) {
var { firstChild } = createEl("div", {}, (el) => (el.innerHTML = tag.trim()));
const currSL = {
inner: firstChild.innerText,
from: curr.link,
to: next.link,
};
[...firstChild.attributes].forEach((attr) => {
const { name, value } = attr;
currSL[name] = value || true;
});
SLs.push(currSL);
}
});
return SLs;
});
}
loadSettings() {
return __awaiter(this, void 0, void 0, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __awaiter(this, void 0, void 0, function* () {
yield this.saveData(this.settings);
});
}
}
module.exports = SLPlugin;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsInNyYy9jb25z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KCkpO1xyXG59XHJcblxyXG5leHBvcnQgdmFyIF9fYXNzaWduID0gZnVuY3Rpb24oKSB7XHJcbiAgICBfX2Fzc2lnbiA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gX19hc3NpZ24odCkge1xyXG4gICAgICAgIGZvciAodmFyIHMsIGkgPSAxLCBuID0gYXJndW1lbnRzLmxlbmd0aDsgaSA8IG47IGkrKykge1xyXG4gICAgICAgICAgICBzID0gYXJndW1lbnRzW2ldO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkpIHRbcF0gPSBzW3BdO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdDtcclxuICAgIH1cclxuICAgIHJldHVybiBfX2Fzc2lnbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19yZXN0KHMsIGUpIHtcclxuICAgIHZhciB0ID0ge307XHJcbiAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkgJiYgZS5pbmRleE9mKHApIDwgMClcclxuICAgICAgICB0W3BdID0gc1twXTtcclxuICAgIGlmIChzICE9IG51bGwgJiYgdHlwZW9mIE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgPT09IFwiZnVuY3Rpb25cIilcclxuICAgICAgICBmb3IgKHZhciBpID0gMCwgcCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMocyk7IGkgPCBwLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgIGlmIChlLmluZGV4T2YocFtpXSkgPCAwICYmIE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChzLCBwW2ldKSlcclxuICAgICAgICAgICAgICAgIHRbcFtpXV0gPSB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oIChvcFswXSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAwOiBjYXNlIDE6IHQgPSBvcDsgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDQ6IF8ubGFiZWwrKzsgcmV0dXJuIHsgdmFsdWU6IG9wWzFdLCBkb25lOiBmYWxzZSB9O1xyXG4gICAgICAgICAgICAgICAgY2FzZSA1OiBfLmxhYmVsKys7IHkgPSBvcFsxXTsgb3AgPSBbMF07IGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA3OiBvcCA9IF8ub3BzLnBvcCgpOyBfLnRyeXMucG9wKCk7IGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISh0ID0gXy50cnlzLCB0ID0gdC5sZW5ndGggPiAwICYmIHRbdC5sZW5ndGggLSAxXSkgJiYgKG9wWzBdID09PSA2IHx8IG9wWzBdID09PSAyKSkgeyBfID0gMDsgY29udGludWU7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAob3BbMF0gPT09IDMgJiYgKCF0IHx8IChvcFsxXSA+IHRbMF0gJiYgb3BbMV0gPCB0WzNdKSkpIHsgXy5sYWJlbCA9IG9wWzFdOyBicmVhazsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChvcFswXSA9PT0gNiAmJiBfLmxhYmVsIDwgdFsxXSkgeyBfLmxhYmVsID0gdFsxXTsgdCA9IG9wOyBicmVhazsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICh0ICYmIF8ubGFiZWwgPCB0WzJdKSB7IF8ubGFiZWwgPSB0WzJdOyBfLm9wcy5wdXNoKG9wKTsgYnJlYWs7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAodFsyXSkgXy5vcHMucG9wKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgXy50cnlzLnBvcCgpOyBjb250aW51ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIC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ICAgaWYgKG0pIHJldHVybiBtLmNhbGwobyk7XHJcbiAgICBpZiAobyAmJiB0eXBlb2Ygby5sZW5ndGggPT09IFwibnVtYmVyXCIpIHJldHVybiB7XHJcbiAgICAgICAgbmV4dDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICBpZiAobyAmJiBpID49IG8ubGVuZ3RoKSBvID0gdm9pZCAwO1xyXG4gICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogbyAmJiBvW2krK10sIGRvbmU6ICFvIH07XHJcbiAgICAgICAgfVxyXG4gICAgfTtcclxuICAgIHRocm93IG5ldyBUeXBlRXJyb3IocyA/IFwiT2JqZWN0IGlzIG5vdCBpdGVyYWJsZS5cIiA6IFwiU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLlwiKTtcclxufVxyXG5cclxuZXhwb3J0IGZ1bmN0aW9uIF9fcmVhZChvLCBuKSB7XHJcbiAgICB2YXIgbSA9IHR5cGVvZiBTeW1ib2wgPT09IFwiZnVuY3Rpb25cIiAmJiBvW1N5bWJvbC5pdGVyYXRvcl07XHJcbiAgICBpZiAoIW0pIHJldHVybiBvO1xyXG4gICAgdmFyIGkgPSBtLmNhbGwobyksIHIsIGFyID0gW10sIGU7XHJcbiAgICB0cnkge1xyXG4gICAgICAgIHdoaWxlICgobiA9PT0gdm9pZCAwIHx8IG4tLSA+IDApICYmICEociA9IGkubmV4dCgpKS5kb25lKSBhci5wdXNoKHIudmFsdWUpO1xyXG4gICAgfVxyXG4gICAgY2F0Y2ggKGVycm9yKSB7IGUgPSB7IGVycm9yOiBlcnJvciB9OyB9XHJcbiAgICBmaW5hbGx5IHtcclxuICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICBpZiAociAmJiAhci5kb25lICYmIChtID0gaVtcInJldHVyblwiXSkpIG0uY2FsbChpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZmluYWxseSB7IGlmIChlKSB0aHJvdyBlLmVycm9yOyB9XHJcbiAgICB9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