mirror of
https://github.com/Ellpeck/ObsidianCustomFrames.git
synced 2024-11-22 17:48:34 +01:00
parent
cecae7de83
commit
126000617f
3 changed files with 23 additions and 1 deletions
|
@ -16,7 +16,7 @@ export class CustomFrame {
|
|||
let style = `padding: ${this.settings.padding}px;`;
|
||||
if (additionalStyle)
|
||||
style += additionalStyle;
|
||||
if (Platform.isDesktopApp) {
|
||||
if (Platform.isDesktopApp && !this.data.forceIframe) {
|
||||
this.frame = document.createElement("webview");
|
||||
this.frame.setAttribute("allowpopups", "");
|
||||
this.frame.addEventListener("dom-ready", () => {
|
||||
|
|
|
@ -111,6 +111,20 @@ export class CustomFramesSettingTab extends PluginSettingTab {
|
|||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new Setting(content)
|
||||
.setName("Force iframe")
|
||||
.setDesc(createFragment(f => {
|
||||
f.createSpan({ text: "Whether this frame should use iframes on desktop as opposed to Electron webviews." });
|
||||
f.createEl("br");
|
||||
f.createEl("em", { text: "Only enable this setting if the frame is causing issues or frequent crashes. This setting causes all Desktop-only settings to be ignored." });
|
||||
}))
|
||||
.addToggle(t => {
|
||||
t.setValue(frame.forceIframe);
|
||||
t.onChange(async v => {
|
||||
frame.forceIframe = v;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new Setting(content)
|
||||
.setName("Page Zoom")
|
||||
.setDesc("The zoom that this frame's page should be displayed with, as a percentage.")
|
||||
|
@ -171,6 +185,7 @@ export class CustomFramesSettingTab extends PluginSettingTab {
|
|||
addRibbonIcon: false,
|
||||
openInCenter: false,
|
||||
zoomLevel: 1,
|
||||
forceIframe: false,
|
||||
customCss: ""
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ export const presets: Record<string, CustomFrameSettings> = {
|
|||
addRibbonIcon: true,
|
||||
openInCenter: true,
|
||||
zoomLevel: 1,
|
||||
forceIframe: false,
|
||||
customCss: ""
|
||||
},
|
||||
"calendar": {
|
||||
|
@ -21,6 +22,7 @@ export const presets: Record<string, CustomFrameSettings> = {
|
|||
addRibbonIcon: true,
|
||||
openInCenter: true,
|
||||
zoomLevel: 1,
|
||||
forceIframe: false,
|
||||
customCss: `/* hide right-side menu, and some buttons */
|
||||
div.d6McF,
|
||||
div.pw6cBb,
|
||||
|
@ -40,6 +42,7 @@ div.dwlvNd {
|
|||
addRibbonIcon: false,
|
||||
openInCenter: false,
|
||||
zoomLevel: 1,
|
||||
forceIframe: false,
|
||||
customCss: `/* hide the menu bar and the "Keep" text */
|
||||
html > body > div:nth-child(2) > div:nth-child(2) > div:first-child,
|
||||
html > body > div:first-child > header:first-child > div > div:first-child > div > div:first-child > a:first-child > span {
|
||||
|
@ -54,6 +57,7 @@ html > body > div:first-child > header:first-child > div > div:first-child > div
|
|||
addRibbonIcon: false,
|
||||
openInCenter: false,
|
||||
zoomLevel: 1,
|
||||
forceIframe: false,
|
||||
customCss: `/* hide the help, home, search, and productivity overview buttons, create extra space, and prevent toast pop-up from acting weird */
|
||||
[aria-label="Go to Home view"], #quick_find, [aria-label="Productivity"], [aria-label="Help & Feedback"] {
|
||||
display: none !important;
|
||||
|
@ -80,6 +84,7 @@ html > body > div:first-child > header:first-child > div > div:first-child > div
|
|||
addRibbonIcon: true,
|
||||
openInCenter: true,
|
||||
zoomLevel: 1,
|
||||
forceIframe: false,
|
||||
customCss: ""
|
||||
},
|
||||
"twitter": {
|
||||
|
@ -90,6 +95,7 @@ html > body > div:first-child > header:first-child > div > div:first-child > div
|
|||
addRibbonIcon: false,
|
||||
openInCenter: false,
|
||||
zoomLevel: 1,
|
||||
forceIframe: false,
|
||||
customCss: ""
|
||||
}
|
||||
};
|
||||
|
@ -107,6 +113,7 @@ export interface CustomFrameSettings {
|
|||
addRibbonIcon: boolean;
|
||||
openInCenter: boolean;
|
||||
zoomLevel: number;
|
||||
forceIframe: boolean;
|
||||
customCss: string;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue