mirror of
https://github.com/Ellpeck/ObsidianCustomFrames.git
synced 2024-11-22 09:43:30 +01:00
removed wonky minimum width setting
This commit is contained in:
parent
6558acea1e
commit
97f122c33b
3 changed files with 1 additions and 31 deletions
|
@ -76,21 +76,6 @@ export class CustomFramesSettingTab extends PluginSettingTab {
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
new Setting(this.containerEl)
|
|
||||||
.setName("Minimum Width")
|
|
||||||
.setDesc(createFragment(f => {
|
|
||||||
f.createSpan({ text: "The width that this frame's pane should be adjusted to automatically if it is lower. Set to 0 to disable." });
|
|
||||||
f.createEl("br");
|
|
||||||
f.createEl("em", { text: "Note that this is only applied on Desktop." });
|
|
||||||
}))
|
|
||||||
.addText(t => {
|
|
||||||
t.inputEl.type = "number";
|
|
||||||
t.setValue(String(frame.minimumWidth));
|
|
||||||
t.onChange(async v => {
|
|
||||||
frame.minimumWidth = v.length ? Number(v) : 0;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
new Setting(this.containerEl)
|
new Setting(this.containerEl)
|
||||||
.setName("Additional CSS")
|
.setName("Additional CSS")
|
||||||
.setDesc(createFragment(f => {
|
.setDesc(createFragment(f => {
|
||||||
|
|
|
@ -8,7 +8,6 @@ export const presets: Record<string, CustomFrame> = {
|
||||||
displayName: "Obsidian Forum",
|
displayName: "Obsidian Forum",
|
||||||
icon: "edit",
|
icon: "edit",
|
||||||
hideOnMobile: true,
|
hideOnMobile: true,
|
||||||
minimumWidth: 367,
|
|
||||||
customCss: ""
|
customCss: ""
|
||||||
},
|
},
|
||||||
"calendar": {
|
"calendar": {
|
||||||
|
@ -16,7 +15,6 @@ export const presets: Record<string, CustomFrame> = {
|
||||||
displayName: "Google Calendar",
|
displayName: "Google Calendar",
|
||||||
icon: "calendar",
|
icon: "calendar",
|
||||||
hideOnMobile: true,
|
hideOnMobile: true,
|
||||||
minimumWidth: 490,
|
|
||||||
customCss: `/* hide right-side menu, and some buttons */
|
customCss: `/* hide right-side menu, and some buttons */
|
||||||
div.d6McF,
|
div.d6McF,
|
||||||
div.pw6cBb,
|
div.pw6cBb,
|
||||||
|
@ -33,7 +31,6 @@ div.dwlvNd {
|
||||||
displayName: "Google Keep",
|
displayName: "Google Keep",
|
||||||
icon: "files",
|
icon: "files",
|
||||||
hideOnMobile: true,
|
hideOnMobile: true,
|
||||||
minimumWidth: 370,
|
|
||||||
customCss: `/* hide the menu bar and the "Keep" text */
|
customCss: `/* hide the menu bar and the "Keep" text */
|
||||||
.PvRhvb-qAWA2, .gb_2d.gb_Zc {
|
.PvRhvb-qAWA2, .gb_2d.gb_Zc {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
|
@ -44,7 +41,6 @@ div.dwlvNd {
|
||||||
displayName: "Notion",
|
displayName: "Notion",
|
||||||
icon: "box",
|
icon: "box",
|
||||||
hideOnMobile: true,
|
hideOnMobile: true,
|
||||||
minimumWidth: 400,
|
|
||||||
customCss: ""
|
customCss: ""
|
||||||
},
|
},
|
||||||
"twitter": {
|
"twitter": {
|
||||||
|
@ -52,7 +48,6 @@ div.dwlvNd {
|
||||||
displayName: "Twitter",
|
displayName: "Twitter",
|
||||||
icon: "twitter",
|
icon: "twitter",
|
||||||
hideOnMobile: true,
|
hideOnMobile: true,
|
||||||
minimumWidth: 400,
|
|
||||||
customCss: ""
|
customCss: ""
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -67,6 +62,5 @@ export interface CustomFrame {
|
||||||
displayName: string;
|
displayName: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
hideOnMobile: boolean;
|
hideOnMobile: boolean;
|
||||||
minimumWidth: number;
|
|
||||||
customCss: string;
|
customCss: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,15 +55,6 @@ export class CustomFrameView extends ItemView {
|
||||||
this.frame.setAttribute("allowpopups", "");
|
this.frame.setAttribute("allowpopups", "");
|
||||||
this.frame.addEventListener("dom-ready", () => {
|
this.frame.addEventListener("dom-ready", () => {
|
||||||
this.frame.insertCSS(this.data.customCss);
|
this.frame.insertCSS(this.data.customCss);
|
||||||
|
|
||||||
if (this.data.minimumWidth) {
|
|
||||||
let parent = this.contentEl.closest<HTMLElement>(".workspace-split.mod-horizontal");
|
|
||||||
if (parent) {
|
|
||||||
let minWidth = `${this.data.minimumWidth + 2 * this.settings.padding}px`;
|
|
||||||
if (parent.style.width < minWidth)
|
|
||||||
parent.style.width = minWidth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue