mirror of
https://github.com/Ellpeck/ObsidianCustomFrames.git
synced 2024-11-22 01:33:29 +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();
|
||||
});
|
||||
});
|
||||
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)
|
||||
.setName("Additional CSS")
|
||||
.setDesc(createFragment(f => {
|
||||
|
|
|
@ -8,15 +8,13 @@ export const presets: Record<string, CustomFrame> = {
|
|||
displayName: "Obsidian Forum",
|
||||
icon: "edit",
|
||||
hideOnMobile: true,
|
||||
minimumWidth: 367,
|
||||
customCss: ""
|
||||
},
|
||||
"calendar": {
|
||||
"calendar": {
|
||||
url: "https://calendar.google.com/calendar/u/0/r/day",
|
||||
displayName: "Google Calendar",
|
||||
icon: "calendar",
|
||||
hideOnMobile: true,
|
||||
minimumWidth: 490,
|
||||
customCss: `/* hide right-side menu, and some buttons */
|
||||
div.d6McF,
|
||||
div.pw6cBb,
|
||||
|
@ -33,7 +31,6 @@ div.dwlvNd {
|
|||
displayName: "Google Keep",
|
||||
icon: "files",
|
||||
hideOnMobile: true,
|
||||
minimumWidth: 370,
|
||||
customCss: `/* hide the menu bar and the "Keep" text */
|
||||
.PvRhvb-qAWA2, .gb_2d.gb_Zc {
|
||||
display: none !important;
|
||||
|
@ -44,7 +41,6 @@ div.dwlvNd {
|
|||
displayName: "Notion",
|
||||
icon: "box",
|
||||
hideOnMobile: true,
|
||||
minimumWidth: 400,
|
||||
customCss: ""
|
||||
},
|
||||
"twitter": {
|
||||
|
@ -52,7 +48,6 @@ div.dwlvNd {
|
|||
displayName: "Twitter",
|
||||
icon: "twitter",
|
||||
hideOnMobile: true,
|
||||
minimumWidth: 400,
|
||||
customCss: ""
|
||||
}
|
||||
};
|
||||
|
@ -67,6 +62,5 @@ export interface CustomFrame {
|
|||
displayName: string;
|
||||
icon: string;
|
||||
hideOnMobile: boolean;
|
||||
minimumWidth: number;
|
||||
customCss: string;
|
||||
}
|
||||
|
|
|
@ -55,15 +55,6 @@ export class CustomFrameView extends ItemView {
|
|||
this.frame.setAttribute("allowpopups", "");
|
||||
this.frame.addEventListener("dom-ready", () => {
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue