@real1ty-obsidian-plugins/utils 2.29.0 → 2.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { App, Plugin } from "obsidian";
|
|
2
2
|
import { Modal } from "obsidian";
|
|
3
|
+
/**
|
|
4
|
+
* Default URLs for the What's New modal.
|
|
5
|
+
* These can be overridden in the config.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_WHATS_NEW_LINKS: {
|
|
8
|
+
/**
|
|
9
|
+
* Default tools page showcasing all plugins and productivity software.
|
|
10
|
+
*/
|
|
11
|
+
readonly TOOLS: "https://matejvavroproductivity.com/tools/";
|
|
12
|
+
/**
|
|
13
|
+
* Default YouTube channel with Obsidian tutorials and productivity tips.
|
|
14
|
+
* Includes subscription confirmation parameter.
|
|
15
|
+
*/
|
|
16
|
+
readonly YOUTUBE: "https://www.youtube.com/@MatejVavroProductivity?sub_confirmation=1";
|
|
17
|
+
};
|
|
3
18
|
export interface WhatsNewModalConfig {
|
|
4
19
|
/**
|
|
5
20
|
* The CSS class prefix/suffix to use for styling.
|
|
@@ -32,6 +47,16 @@ export interface WhatsNewModalConfig {
|
|
|
32
47
|
* Example: "https://docs.example.com" or "https://docs.example.com/"
|
|
33
48
|
*/
|
|
34
49
|
documentation: string;
|
|
50
|
+
/**
|
|
51
|
+
* URL to tools page showcasing all plugins and productivity tools.
|
|
52
|
+
* Defaults to DEFAULT_WHATS_NEW_LINKS.TOOLS if not provided.
|
|
53
|
+
*/
|
|
54
|
+
tools?: string;
|
|
55
|
+
/**
|
|
56
|
+
* URL to YouTube channel with tutorials and productivity tips.
|
|
57
|
+
* Defaults to DEFAULT_WHATS_NEW_LINKS.YOUTUBE if not provided.
|
|
58
|
+
*/
|
|
59
|
+
youtube?: string;
|
|
35
60
|
};
|
|
36
61
|
}
|
|
37
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whats-new-modal.d.ts","sourceRoot":"","sources":["../../src/components/whats-new-modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAoB,KAAK,EAAE,MAAM,UAAU,CAAC;AAGnD,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,KAAK,EAAE;QACN;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;;WAGG;QACH,aAAa,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"whats-new-modal.d.ts","sourceRoot":"","sources":["../../src/components/whats-new-modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAoB,KAAK,EAAE,MAAM,UAAU,CAAC;AAGnD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IACnC;;OAEG;;IAGH;;;OAGG;;CAEM,CAAC;AAEX,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,KAAK,EAAE;QACN;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;;WAGG;QACH,aAAa,EAAE,MAAM,CAAC;QAEtB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACF;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAGtC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,SAAS;gBAJjB,GAAG,EAAE,GAAG,EACA,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM;IAK1B;;OAEG;IACH,OAAO,CAAC,GAAG;IAIX;;OAEG;IACH,OAAO,CAAC,MAAM;IAId;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAmC5B,MAAM;IA6IZ,OAAO;CAGP"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { MarkdownRenderer, Modal } from "obsidian";
|
|
3
3
|
import { formatChangelogSections, getChangelogSince } from "../string/changelog-parser";
|
|
4
|
+
/**
|
|
5
|
+
* Default URLs for the What's New modal.
|
|
6
|
+
* These can be overridden in the config.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_WHATS_NEW_LINKS = {
|
|
9
|
+
/**
|
|
10
|
+
* Default tools page showcasing all plugins and productivity software.
|
|
11
|
+
*/
|
|
12
|
+
TOOLS: "https://matejvavroproductivity.com/tools/",
|
|
13
|
+
/**
|
|
14
|
+
* Default YouTube channel with Obsidian tutorials and productivity tips.
|
|
15
|
+
* Includes subscription confirmation parameter.
|
|
16
|
+
*/
|
|
17
|
+
YOUTUBE: "https://www.youtube.com/@MatejVavroProductivity?sub_confirmation=1",
|
|
18
|
+
};
|
|
4
19
|
/**
|
|
5
20
|
* Generic "What's New" modal that displays changelog entries between versions.
|
|
6
21
|
* Supports custom CSS prefixes, plugin names, and configurable links.
|
|
@@ -62,6 +77,7 @@ export class WhatsNewModal extends Modal {
|
|
|
62
77
|
}
|
|
63
78
|
onOpen() {
|
|
64
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
var _a, _b;
|
|
65
81
|
const { contentEl } = this;
|
|
66
82
|
contentEl.empty();
|
|
67
83
|
this.addCls(contentEl, "whats-new-modal");
|
|
@@ -88,6 +104,31 @@ export class WhatsNewModal extends Modal {
|
|
|
88
104
|
supportText.createSpan({
|
|
89
105
|
text: ". Your support helps keep this plugin maintained and improved!",
|
|
90
106
|
});
|
|
107
|
+
// Discover more section
|
|
108
|
+
const discoverSection = contentEl.createDiv({
|
|
109
|
+
cls: this.cls("whats-new-discover"),
|
|
110
|
+
});
|
|
111
|
+
discoverSection.createEl("h3", { text: "Discover More" });
|
|
112
|
+
// Other tools
|
|
113
|
+
const toolsText = discoverSection.createEl("p");
|
|
114
|
+
toolsText.createSpan({ text: "🔧 Check out my " });
|
|
115
|
+
toolsText.createEl("a", {
|
|
116
|
+
text: "other plugins and productivity tools",
|
|
117
|
+
href: (_a = this.config.links.tools) !== null && _a !== void 0 ? _a : DEFAULT_WHATS_NEW_LINKS.TOOLS,
|
|
118
|
+
});
|
|
119
|
+
toolsText.createSpan({
|
|
120
|
+
text: " to enhance your workflow even further.",
|
|
121
|
+
});
|
|
122
|
+
// YouTube channel
|
|
123
|
+
const youtubeText = discoverSection.createEl("p");
|
|
124
|
+
youtubeText.createSpan({ text: "📺 Subscribe to my " });
|
|
125
|
+
youtubeText.createEl("a", {
|
|
126
|
+
text: "YouTube channel",
|
|
127
|
+
href: (_b = this.config.links.youtube) !== null && _b !== void 0 ? _b : DEFAULT_WHATS_NEW_LINKS.YOUTUBE,
|
|
128
|
+
});
|
|
129
|
+
youtubeText.createSpan({
|
|
130
|
+
text: " for Obsidian tutorials and productivity tips!",
|
|
131
|
+
});
|
|
91
132
|
contentEl.createEl("hr");
|
|
92
133
|
// Changelog content
|
|
93
134
|
const changelogSections = getChangelogSince(this.config.changelogContent, this.fromVersion, this.toVersion);
|
|
@@ -124,6 +165,22 @@ export class WhatsNewModal extends Modal {
|
|
|
124
165
|
docsBtn.addEventListener("click", () => {
|
|
125
166
|
window.open(this.config.links.documentation, "_blank");
|
|
126
167
|
});
|
|
168
|
+
// Tools button
|
|
169
|
+
const toolsBtn = buttonContainer.createEl("button", {
|
|
170
|
+
text: "My Tools",
|
|
171
|
+
});
|
|
172
|
+
toolsBtn.addEventListener("click", () => {
|
|
173
|
+
var _a;
|
|
174
|
+
window.open((_a = this.config.links.tools) !== null && _a !== void 0 ? _a : DEFAULT_WHATS_NEW_LINKS.TOOLS, "_blank");
|
|
175
|
+
});
|
|
176
|
+
// YouTube button
|
|
177
|
+
const youtubeBtn = buttonContainer.createEl("button", {
|
|
178
|
+
text: "YouTube Channel",
|
|
179
|
+
});
|
|
180
|
+
youtubeBtn.addEventListener("click", () => {
|
|
181
|
+
var _a;
|
|
182
|
+
window.open((_a = this.config.links.youtube) !== null && _a !== void 0 ? _a : DEFAULT_WHATS_NEW_LINKS.YOUTUBE, "_blank");
|
|
183
|
+
});
|
|
127
184
|
// Close button (always present)
|
|
128
185
|
const closeBtn = buttonContainer.createEl("button", {
|
|
129
186
|
text: "Close",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whats-new-modal.js","sourceRoot":"","sources":["../../src/components/whats-new-modal.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA0CxF;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACvC,YACC,GAAQ,EACA,MAAc,EACd,MAA2B,EAC3B,WAAmB,EACnB,SAAiB;QAEzB,KAAK,CAAC,GAAG,CAAC,CAAC;QALH,WAAM,GAAN,MAAM,CAAQ;QACd,WAAM,GAAN,MAAM,CAAqB;QAC3B,gBAAW,GAAX,WAAW,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAQ;IAG1B,CAAC;IAED;;OAEG;IACK,GAAG,CAAC,MAAc;QACzB,OAAO,GAAG,IAAI,CAA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ACxB,MAAM,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBACvD,IAAI,EAAE,gBAAgB;aACtB,CAAC,CAAC;YACH,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC3C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;YAEH,uBAAuB;YACvB,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBAClD,IAAI,EAAE,eAAe;aACrB,CAAC,CAAC;YACH,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;gBACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;YAEH,gCAAgC;YAChC,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBACnD,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;aACxB,CAAC,CAAC;YACH,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACxD,CAAC;KAAA;IAED,OAAO;QACN,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type { App, Plugin } from \"obsidian\";\nimport { MarkdownRenderer, Modal } from \"obsidian\";\nimport { formatChangelogSections, getChangelogSince } from \"../string/changelog-parser\";\n\nexport interface WhatsNewModalConfig {\n\t/**\n\t * The CSS class prefix/suffix to use for styling.\n\t * Example: \"custom-calendar\" will generate classes like \"custom-calendar-whats-new-modal\"\n\t */\n\tcssPrefix: string;\n\n\t/**\n\t * Display name of the plugin.\n\t * Example: \"Custom Calendar\"\n\t */\n\tpluginName: string;\n\n\t/**\n\t * Raw changelog markdown content to parse.\n\t */\n\tchangelogContent: string;\n\n\t/**\n\t * Links to external resources.\n\t */\n\tlinks: {\n\t\t/**\n\t\t * URL to support/donate page.\n\t\t */\n\t\tsupport: string;\n\n\t\t/**\n\t\t * URL to full changelog page.\n\t\t */\n\t\tchangelog: string;\n\n\t\t/**\n\t\t * Base URL for documentation (used to resolve relative links in changelog).\n\t\t * Example: \"https://docs.example.com\" or \"https://docs.example.com/\"\n\t\t */\n\t\tdocumentation: string;\n\t};\n}\n\n/**\n * Generic \"What's New\" modal that displays changelog entries between versions.\n * Supports custom CSS prefixes, plugin names, and configurable links.\n */\nexport class WhatsNewModal extends Modal {\n\tconstructor(\n\t\tapp: App,\n\t\tprivate plugin: Plugin,\n\t\tprivate config: WhatsNewModalConfig,\n\t\tprivate fromVersion: string,\n\t\tprivate toVersion: string\n\t) {\n\t\tsuper(app);\n\t}\n\n\t/**\n\t * Helper to create CSS class names with the configured prefix.\n\t */\n\tprivate cls(suffix: string): string {\n\t\treturn `${this.config.cssPrefix}-${suffix}`;\n\t}\n\n\t/**\n\t * Helper to add CSS class to an element.\n\t */\n\tprivate addCls(el: HTMLElement, suffix: string): void {\n\t\tel.classList.add(this.cls(suffix));\n\t}\n\n\t/**\n\t * Makes external links in rendered markdown clickable by adding click handlers.\n\t * Handles both absolute URLs (http/https) and relative URLs (starting with /).\n\t * Relative URLs are resolved against the documentation base URL.\n\t */\n\tprivate makeExternalLinksClickable(container: HTMLElement): void {\n\t\tconst links = container.querySelectorAll<HTMLAnchorElement>(\"a[href]\");\n\n\t\t// Convert NodeList to Array for iteration\n\t\tArray.from(links).forEach((link) => {\n\t\t\tconst href = link.getAttribute(\"href\");\n\t\t\tif (!href) return;\n\n\t\t\tlet finalUrl: string | null = null;\n\n\t\t\t// Handle absolute HTTP(S) links\n\t\t\tif (href.startsWith(\"http://\") || href.startsWith(\"https://\")) {\n\t\t\t\tfinalUrl = href;\n\t\t\t}\n\t\t\t// Handle relative links (starting with /)\n\t\t\telse if (href.startsWith(\"/\")) {\n\t\t\t\t// Get base documentation URL and ensure proper slash handling\n\t\t\t\tconst baseUrl = this.config.links.documentation;\n\t\t\t\tconst normalizedBase = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n\t\t\t\tfinalUrl = `${normalizedBase}${href}`;\n\t\t\t}\n\n\t\t\t// Add click handler for external links\n\t\t\tif (finalUrl) {\n\t\t\t\tlink.addEventListener(\"click\", (event: MouseEvent) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\twindow.open(finalUrl, \"_blank\");\n\t\t\t\t});\n\n\t\t\t\t// Add visual indicator that it's an external link\n\t\t\t\tlink.classList.add(\"external-link\");\n\t\t\t}\n\t\t});\n\t}\n\n\tasync onOpen() {\n\t\tconst { contentEl } = this;\n\t\tcontentEl.empty();\n\n\t\tthis.addCls(contentEl, \"whats-new-modal\");\n\n\t\t// Header section\n\t\tconst header = contentEl.createDiv({ cls: this.cls(\"whats-new-header\") });\n\t\theader.createEl(\"h2\", {\n\t\t\ttext: `${this.config.pluginName} updated to v${this.toVersion}`,\n\t\t});\n\n\t\theader.createEl(\"p\", {\n\t\t\ttext: `Changes since v${this.fromVersion}`,\n\t\t\tcls: this.cls(\"whats-new-subtitle\"),\n\t\t});\n\n\t\t// Support section\n\t\tconst supportSection = contentEl.createDiv({\n\t\t\tcls: this.cls(\"whats-new-support\"),\n\t\t});\n\n\t\tsupportSection.createEl(\"h3\", { text: \"Support My Work\" });\n\n\t\tconst supportText = supportSection.createEl(\"p\");\n\t\tsupportText.createSpan({ text: \"If you enjoy using this plugin, please consider \" });\n\t\tsupportText.createEl(\"a\", {\n\t\t\ttext: \"supporting my work\",\n\t\t\thref: this.config.links.support,\n\t\t});\n\t\tsupportText.createSpan({\n\t\t\ttext: \". Your support helps keep this plugin maintained and improved!\",\n\t\t});\n\n\t\tcontentEl.createEl(\"hr\");\n\n\t\t// Changelog content\n\t\tconst changelogSections = getChangelogSince(\n\t\t\tthis.config.changelogContent,\n\t\t\tthis.fromVersion,\n\t\t\tthis.toVersion\n\t\t);\n\n\t\tif (changelogSections.length === 0) {\n\t\t\tcontentEl.createEl(\"p\", {\n\t\t\t\ttext: \"No significant changes found in this update.\",\n\t\t\t\tcls: this.cls(\"whats-new-empty\"),\n\t\t\t});\n\t\t} else {\n\t\t\tconst changelogContainer = contentEl.createDiv({\n\t\t\t\tcls: this.cls(\"whats-new-content\"),\n\t\t\t});\n\n\t\t\tconst markdownContent = formatChangelogSections(changelogSections);\n\n\t\t\tawait MarkdownRenderer.render(\n\t\t\t\tthis.app,\n\t\t\t\tmarkdownContent,\n\t\t\t\tchangelogContainer,\n\t\t\t\t\"/\",\n\t\t\t\tthis.plugin\n\t\t\t);\n\n\t\t\t// Make external links clickable\n\t\t\tthis.makeExternalLinksClickable(changelogContainer);\n\t\t}\n\n\t\t// Action buttons\n\t\tconst buttonContainer = contentEl.createDiv({\n\t\t\tcls: this.cls(\"whats-new-buttons\"),\n\t\t});\n\n\t\t// Full changelog button\n\t\tconst changelogBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"Full Changelog\",\n\t\t});\n\t\tchangelogBtn.addEventListener(\"click\", () => {\n\t\t\twindow.open(this.config.links.changelog, \"_blank\");\n\t\t});\n\n\t\t// Documentation button\n\t\tconst docsBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"Documentation\",\n\t\t});\n\t\tdocsBtn.addEventListener(\"click\", () => {\n\t\t\twindow.open(this.config.links.documentation, \"_blank\");\n\t\t});\n\n\t\t// Close button (always present)\n\t\tconst closeBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"Close\",\n\t\t\tcls: this.cls(\"mod-cta\"),\n\t\t});\n\t\tcloseBtn.addEventListener(\"click\", () => this.close());\n\t}\n\n\tonClose() {\n\t\tthis.contentEl.empty();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"whats-new-modal.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AgB,CAAC,OAAO,EAAE,GAAG,EAAE;;gBACvC,MAAM,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,mCAAI,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;YAEH,iBAAiB;YACjB,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBACrD,IAAI,EAAE,iBAAiB;aACvB,CAAC,CAAC;YACH,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;;gBACzC,MAAM,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,mCAAI,uBAAuB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;YAEH,gCAAgC;YAChC,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBACnD,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;aACxB,CAAC,CAAC;YACH,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACxD,CAAC;KAAA;IAED,OAAO;QACN,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type { App, Plugin } from \"obsidian\";\nimport { MarkdownRenderer, Modal } from \"obsidian\";\nimport { formatChangelogSections, getChangelogSince } from \"../string/changelog-parser\";\n\n/**\n * Default URLs for the What's New modal.\n * These can be overridden in the config.\n */\nexport const DEFAULT_WHATS_NEW_LINKS = {\n\t/**\n\t * Default tools page showcasing all plugins and productivity software.\n\t */\n\tTOOLS: \"https://matejvavroproductivity.com/tools/\",\n\n\t/**\n\t * Default YouTube channel with Obsidian tutorials and productivity tips.\n\t * Includes subscription confirmation parameter.\n\t */\n\tYOUTUBE: \"https://www.youtube.com/@MatejVavroProductivity?sub_confirmation=1\",\n} as const;\n\nexport interface WhatsNewModalConfig {\n\t/**\n\t * The CSS class prefix/suffix to use for styling.\n\t * Example: \"custom-calendar\" will generate classes like \"custom-calendar-whats-new-modal\"\n\t */\n\tcssPrefix: string;\n\n\t/**\n\t * Display name of the plugin.\n\t * Example: \"Custom Calendar\"\n\t */\n\tpluginName: string;\n\n\t/**\n\t * Raw changelog markdown content to parse.\n\t */\n\tchangelogContent: string;\n\n\t/**\n\t * Links to external resources.\n\t */\n\tlinks: {\n\t\t/**\n\t\t * URL to support/donate page.\n\t\t */\n\t\tsupport: string;\n\n\t\t/**\n\t\t * URL to full changelog page.\n\t\t */\n\t\tchangelog: string;\n\n\t\t/**\n\t\t * Base URL for documentation (used to resolve relative links in changelog).\n\t\t * Example: \"https://docs.example.com\" or \"https://docs.example.com/\"\n\t\t */\n\t\tdocumentation: string;\n\n\t\t/**\n\t\t * URL to tools page showcasing all plugins and productivity tools.\n\t\t * Defaults to DEFAULT_WHATS_NEW_LINKS.TOOLS if not provided.\n\t\t */\n\t\ttools?: string;\n\n\t\t/**\n\t\t * URL to YouTube channel with tutorials and productivity tips.\n\t\t * Defaults to DEFAULT_WHATS_NEW_LINKS.YOUTUBE if not provided.\n\t\t */\n\t\tyoutube?: string;\n\t};\n}\n\n/**\n * Generic \"What's New\" modal that displays changelog entries between versions.\n * Supports custom CSS prefixes, plugin names, and configurable links.\n */\nexport class WhatsNewModal extends Modal {\n\tconstructor(\n\t\tapp: App,\n\t\tprivate plugin: Plugin,\n\t\tprivate config: WhatsNewModalConfig,\n\t\tprivate fromVersion: string,\n\t\tprivate toVersion: string\n\t) {\n\t\tsuper(app);\n\t}\n\n\t/**\n\t * Helper to create CSS class names with the configured prefix.\n\t */\n\tprivate cls(suffix: string): string {\n\t\treturn `${this.config.cssPrefix}-${suffix}`;\n\t}\n\n\t/**\n\t * Helper to add CSS class to an element.\n\t */\n\tprivate addCls(el: HTMLElement, suffix: string): void {\n\t\tel.classList.add(this.cls(suffix));\n\t}\n\n\t/**\n\t * Makes external links in rendered markdown clickable by adding click handlers.\n\t * Handles both absolute URLs (http/https) and relative URLs (starting with /).\n\t * Relative URLs are resolved against the documentation base URL.\n\t */\n\tprivate makeExternalLinksClickable(container: HTMLElement): void {\n\t\tconst links = container.querySelectorAll<HTMLAnchorElement>(\"a[href]\");\n\n\t\t// Convert NodeList to Array for iteration\n\t\tArray.from(links).forEach((link) => {\n\t\t\tconst href = link.getAttribute(\"href\");\n\t\t\tif (!href) return;\n\n\t\t\tlet finalUrl: string | null = null;\n\n\t\t\t// Handle absolute HTTP(S) links\n\t\t\tif (href.startsWith(\"http://\") || href.startsWith(\"https://\")) {\n\t\t\t\tfinalUrl = href;\n\t\t\t}\n\t\t\t// Handle relative links (starting with /)\n\t\t\telse if (href.startsWith(\"/\")) {\n\t\t\t\t// Get base documentation URL and ensure proper slash handling\n\t\t\t\tconst baseUrl = this.config.links.documentation;\n\t\t\t\tconst normalizedBase = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n\t\t\t\tfinalUrl = `${normalizedBase}${href}`;\n\t\t\t}\n\n\t\t\t// Add click handler for external links\n\t\t\tif (finalUrl) {\n\t\t\t\tlink.addEventListener(\"click\", (event: MouseEvent) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\twindow.open(finalUrl, \"_blank\");\n\t\t\t\t});\n\n\t\t\t\t// Add visual indicator that it's an external link\n\t\t\t\tlink.classList.add(\"external-link\");\n\t\t\t}\n\t\t});\n\t}\n\n\tasync onOpen() {\n\t\tconst { contentEl } = this;\n\t\tcontentEl.empty();\n\n\t\tthis.addCls(contentEl, \"whats-new-modal\");\n\n\t\t// Header section\n\t\tconst header = contentEl.createDiv({ cls: this.cls(\"whats-new-header\") });\n\t\theader.createEl(\"h2\", {\n\t\t\ttext: `${this.config.pluginName} updated to v${this.toVersion}`,\n\t\t});\n\n\t\theader.createEl(\"p\", {\n\t\t\ttext: `Changes since v${this.fromVersion}`,\n\t\t\tcls: this.cls(\"whats-new-subtitle\"),\n\t\t});\n\n\t\t// Support section\n\t\tconst supportSection = contentEl.createDiv({\n\t\t\tcls: this.cls(\"whats-new-support\"),\n\t\t});\n\n\t\tsupportSection.createEl(\"h3\", { text: \"Support My Work\" });\n\n\t\tconst supportText = supportSection.createEl(\"p\");\n\t\tsupportText.createSpan({ text: \"If you enjoy using this plugin, please consider \" });\n\t\tsupportText.createEl(\"a\", {\n\t\t\ttext: \"supporting my work\",\n\t\t\thref: this.config.links.support,\n\t\t});\n\t\tsupportText.createSpan({\n\t\t\ttext: \". Your support helps keep this plugin maintained and improved!\",\n\t\t});\n\n\t\t// Discover more section\n\t\tconst discoverSection = contentEl.createDiv({\n\t\t\tcls: this.cls(\"whats-new-discover\"),\n\t\t});\n\n\t\tdiscoverSection.createEl(\"h3\", { text: \"Discover More\" });\n\n\t\t// Other tools\n\t\tconst toolsText = discoverSection.createEl(\"p\");\n\t\ttoolsText.createSpan({ text: \"🔧 Check out my \" });\n\t\ttoolsText.createEl(\"a\", {\n\t\t\ttext: \"other plugins and productivity tools\",\n\t\t\thref: this.config.links.tools ?? DEFAULT_WHATS_NEW_LINKS.TOOLS,\n\t\t});\n\t\ttoolsText.createSpan({\n\t\t\ttext: \" to enhance your workflow even further.\",\n\t\t});\n\n\t\t// YouTube channel\n\t\tconst youtubeText = discoverSection.createEl(\"p\");\n\t\tyoutubeText.createSpan({ text: \"📺 Subscribe to my \" });\n\t\tyoutubeText.createEl(\"a\", {\n\t\t\ttext: \"YouTube channel\",\n\t\t\thref: this.config.links.youtube ?? DEFAULT_WHATS_NEW_LINKS.YOUTUBE,\n\t\t});\n\t\tyoutubeText.createSpan({\n\t\t\ttext: \" for Obsidian tutorials and productivity tips!\",\n\t\t});\n\n\t\tcontentEl.createEl(\"hr\");\n\n\t\t// Changelog content\n\t\tconst changelogSections = getChangelogSince(\n\t\t\tthis.config.changelogContent,\n\t\t\tthis.fromVersion,\n\t\t\tthis.toVersion\n\t\t);\n\n\t\tif (changelogSections.length === 0) {\n\t\t\tcontentEl.createEl(\"p\", {\n\t\t\t\ttext: \"No significant changes found in this update.\",\n\t\t\t\tcls: this.cls(\"whats-new-empty\"),\n\t\t\t});\n\t\t} else {\n\t\t\tconst changelogContainer = contentEl.createDiv({\n\t\t\t\tcls: this.cls(\"whats-new-content\"),\n\t\t\t});\n\n\t\t\tconst markdownContent = formatChangelogSections(changelogSections);\n\n\t\t\tawait MarkdownRenderer.render(\n\t\t\t\tthis.app,\n\t\t\t\tmarkdownContent,\n\t\t\t\tchangelogContainer,\n\t\t\t\t\"/\",\n\t\t\t\tthis.plugin\n\t\t\t);\n\n\t\t\t// Make external links clickable\n\t\t\tthis.makeExternalLinksClickable(changelogContainer);\n\t\t}\n\n\t\t// Action buttons\n\t\tconst buttonContainer = contentEl.createDiv({\n\t\t\tcls: this.cls(\"whats-new-buttons\"),\n\t\t});\n\n\t\t// Full changelog button\n\t\tconst changelogBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"Full Changelog\",\n\t\t});\n\t\tchangelogBtn.addEventListener(\"click\", () => {\n\t\t\twindow.open(this.config.links.changelog, \"_blank\");\n\t\t});\n\n\t\t// Documentation button\n\t\tconst docsBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"Documentation\",\n\t\t});\n\t\tdocsBtn.addEventListener(\"click\", () => {\n\t\t\twindow.open(this.config.links.documentation, \"_blank\");\n\t\t});\n\n\t\t// Tools button\n\t\tconst toolsBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"My Tools\",\n\t\t});\n\t\ttoolsBtn.addEventListener(\"click\", () => {\n\t\t\twindow.open(this.config.links.tools ?? DEFAULT_WHATS_NEW_LINKS.TOOLS, \"_blank\");\n\t\t});\n\n\t\t// YouTube button\n\t\tconst youtubeBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"YouTube Channel\",\n\t\t});\n\t\tyoutubeBtn.addEventListener(\"click\", () => {\n\t\t\twindow.open(this.config.links.youtube ?? DEFAULT_WHATS_NEW_LINKS.YOUTUBE, \"_blank\");\n\t\t});\n\n\t\t// Close button (always present)\n\t\tconst closeBtn = buttonContainer.createEl(\"button\", {\n\t\t\ttext: \"Close\",\n\t\t\tcls: this.cls(\"mod-cta\"),\n\t\t});\n\t\tcloseBtn.addEventListener(\"click\", () => this.close());\n\t}\n\n\tonClose() {\n\t\tthis.contentEl.empty();\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,6 +2,23 @@ import type { App, Plugin } from "obsidian";
|
|
|
2
2
|
import { MarkdownRenderer, Modal } from "obsidian";
|
|
3
3
|
import { formatChangelogSections, getChangelogSince } from "../string/changelog-parser";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Default URLs for the What's New modal.
|
|
7
|
+
* These can be overridden in the config.
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_WHATS_NEW_LINKS = {
|
|
10
|
+
/**
|
|
11
|
+
* Default tools page showcasing all plugins and productivity software.
|
|
12
|
+
*/
|
|
13
|
+
TOOLS: "https://matejvavroproductivity.com/tools/",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Default YouTube channel with Obsidian tutorials and productivity tips.
|
|
17
|
+
* Includes subscription confirmation parameter.
|
|
18
|
+
*/
|
|
19
|
+
YOUTUBE: "https://www.youtube.com/@MatejVavroProductivity?sub_confirmation=1",
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
5
22
|
export interface WhatsNewModalConfig {
|
|
6
23
|
/**
|
|
7
24
|
* The CSS class prefix/suffix to use for styling.
|
|
@@ -39,6 +56,18 @@ export interface WhatsNewModalConfig {
|
|
|
39
56
|
* Example: "https://docs.example.com" or "https://docs.example.com/"
|
|
40
57
|
*/
|
|
41
58
|
documentation: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* URL to tools page showcasing all plugins and productivity tools.
|
|
62
|
+
* Defaults to DEFAULT_WHATS_NEW_LINKS.TOOLS if not provided.
|
|
63
|
+
*/
|
|
64
|
+
tools?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* URL to YouTube channel with tutorials and productivity tips.
|
|
68
|
+
* Defaults to DEFAULT_WHATS_NEW_LINKS.YOUTUBE if not provided.
|
|
69
|
+
*/
|
|
70
|
+
youtube?: string;
|
|
42
71
|
};
|
|
43
72
|
}
|
|
44
73
|
|
|
@@ -145,6 +174,35 @@ export class WhatsNewModal extends Modal {
|
|
|
145
174
|
text: ". Your support helps keep this plugin maintained and improved!",
|
|
146
175
|
});
|
|
147
176
|
|
|
177
|
+
// Discover more section
|
|
178
|
+
const discoverSection = contentEl.createDiv({
|
|
179
|
+
cls: this.cls("whats-new-discover"),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
discoverSection.createEl("h3", { text: "Discover More" });
|
|
183
|
+
|
|
184
|
+
// Other tools
|
|
185
|
+
const toolsText = discoverSection.createEl("p");
|
|
186
|
+
toolsText.createSpan({ text: "🔧 Check out my " });
|
|
187
|
+
toolsText.createEl("a", {
|
|
188
|
+
text: "other plugins and productivity tools",
|
|
189
|
+
href: this.config.links.tools ?? DEFAULT_WHATS_NEW_LINKS.TOOLS,
|
|
190
|
+
});
|
|
191
|
+
toolsText.createSpan({
|
|
192
|
+
text: " to enhance your workflow even further.",
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// YouTube channel
|
|
196
|
+
const youtubeText = discoverSection.createEl("p");
|
|
197
|
+
youtubeText.createSpan({ text: "📺 Subscribe to my " });
|
|
198
|
+
youtubeText.createEl("a", {
|
|
199
|
+
text: "YouTube channel",
|
|
200
|
+
href: this.config.links.youtube ?? DEFAULT_WHATS_NEW_LINKS.YOUTUBE,
|
|
201
|
+
});
|
|
202
|
+
youtubeText.createSpan({
|
|
203
|
+
text: " for Obsidian tutorials and productivity tips!",
|
|
204
|
+
});
|
|
205
|
+
|
|
148
206
|
contentEl.createEl("hr");
|
|
149
207
|
|
|
150
208
|
// Changelog content
|
|
@@ -199,6 +257,22 @@ export class WhatsNewModal extends Modal {
|
|
|
199
257
|
window.open(this.config.links.documentation, "_blank");
|
|
200
258
|
});
|
|
201
259
|
|
|
260
|
+
// Tools button
|
|
261
|
+
const toolsBtn = buttonContainer.createEl("button", {
|
|
262
|
+
text: "My Tools",
|
|
263
|
+
});
|
|
264
|
+
toolsBtn.addEventListener("click", () => {
|
|
265
|
+
window.open(this.config.links.tools ?? DEFAULT_WHATS_NEW_LINKS.TOOLS, "_blank");
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// YouTube button
|
|
269
|
+
const youtubeBtn = buttonContainer.createEl("button", {
|
|
270
|
+
text: "YouTube Channel",
|
|
271
|
+
});
|
|
272
|
+
youtubeBtn.addEventListener("click", () => {
|
|
273
|
+
window.open(this.config.links.youtube ?? DEFAULT_WHATS_NEW_LINKS.YOUTUBE, "_blank");
|
|
274
|
+
});
|
|
275
|
+
|
|
202
276
|
// Close button (always present)
|
|
203
277
|
const closeBtn = buttonContainer.createEl("button", {
|
|
204
278
|
text: "Close",
|