show ignis version instead of installer version
This commit is contained in:
parent
2e66588b62
commit
c225f73859
1 changed files with 35 additions and 4 deletions
|
|
@ -28,7 +28,33 @@ function removeExistingIgnisGroups(tabHeadersEl) {
|
||||||
// Collected here so the openTab patch can manage is-active across all of them.
|
// Collected here so the openTab patch can manage is-active across all of them.
|
||||||
const allIgnisNavEls = new Map(); // tab id -> nav element
|
const allIgnisNavEls = new Map(); // tab id -> nav element
|
||||||
|
|
||||||
function patchOpenTab(setting) {
|
function replaceInstallerVersionRow(setting, ignisVersion) {
|
||||||
|
const container = setting.tabContentContainer || setting.contentEl;
|
||||||
|
|
||||||
|
if (!container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rows = container.querySelectorAll(".setting-item");
|
||||||
|
|
||||||
|
for (const row of rows) {
|
||||||
|
const desc = row.querySelector(".setting-item-description");
|
||||||
|
|
||||||
|
if (!desc || !desc.textContent.startsWith("Installer version:")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
desc.empty();
|
||||||
|
desc.createEl("strong", { text: `Running in Ignis v${ignisVersion}` });
|
||||||
|
desc.createEl("br");
|
||||||
|
desc.appendText(
|
||||||
|
"Obsidian is served through Ignis. There's no installer to update.",
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function patchOpenTab(setting, plugin) {
|
||||||
if (setting._ignisOpenTabPatched) {
|
if (setting._ignisOpenTabPatched) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -49,17 +75,22 @@ function patchOpenTab(setting) {
|
||||||
if (navEl) {
|
if (navEl) {
|
||||||
navEl.addClass("is-active");
|
navEl.addClass("is-active");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tab && tab.id === "about") {
|
||||||
|
replaceInstallerVersionRow(setting, plugin.manifest.version);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setting._ignisOpenTabPatched = true;
|
setting._ignisOpenTabPatched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function injectIgnisSettings(setting, app) {
|
function injectIgnisSettings(setting, app, plugin) {
|
||||||
removeExistingIgnisGroups(setting.tabHeadersEl);
|
removeExistingIgnisGroups(setting.tabHeadersEl);
|
||||||
clearOwnedPluginIds();
|
clearOwnedPluginIds();
|
||||||
allIgnisNavEls.clear();
|
allIgnisNavEls.clear();
|
||||||
|
|
||||||
patchOpenTab(setting);
|
patchOpenTab(setting, plugin);
|
||||||
|
replaceInstallerVersionRow(setting, plugin.manifest.version);
|
||||||
|
|
||||||
const ignis = createGroup("Ignis");
|
const ignis = createGroup("Ignis");
|
||||||
|
|
||||||
|
|
@ -96,7 +127,7 @@ function patchSettingsModal(plugin) {
|
||||||
|
|
||||||
plugin.app.setting.onOpen = function () {
|
plugin.app.setting.onOpen = function () {
|
||||||
original.call(this);
|
original.call(this);
|
||||||
injectIgnisSettings(this, app);
|
injectIgnisSettings(this, app, plugin);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue