added a setting to force iframe usage

Closes #25
This commit is contained in:
Ell 2022-04-26 13:05:22 +02:00
parent cecae7de83
commit 126000617f
3 changed files with 23 additions and 1 deletions

View file

@ -16,7 +16,7 @@ export class CustomFrame {
let style = `padding: ${this.settings.padding}px;`; let style = `padding: ${this.settings.padding}px;`;
if (additionalStyle) if (additionalStyle)
style += additionalStyle; style += additionalStyle;
if (Platform.isDesktopApp) { if (Platform.isDesktopApp && !this.data.forceIframe) {
this.frame = document.createElement("webview"); this.frame = document.createElement("webview");
this.frame.setAttribute("allowpopups", ""); this.frame.setAttribute("allowpopups", "");
this.frame.addEventListener("dom-ready", () => { this.frame.addEventListener("dom-ready", () => {

View file

@ -111,6 +111,20 @@ export class CustomFramesSettingTab extends PluginSettingTab {
await this.plugin.saveSettings(); 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) new Setting(content)
.setName("Page Zoom") .setName("Page Zoom")
.setDesc("The zoom that this frame's page should be displayed with, as a percentage.") .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, addRibbonIcon: false,
openInCenter: false, openInCenter: false,
zoomLevel: 1, zoomLevel: 1,
forceIframe: false,
customCss: "" customCss: ""
}); });
} }

View file

@ -11,6 +11,7 @@ export const presets: Record<string, CustomFrameSettings> = {
addRibbonIcon: true, addRibbonIcon: true,
openInCenter: true, openInCenter: true,
zoomLevel: 1, zoomLevel: 1,
forceIframe: false,
customCss: "" customCss: ""
}, },
"calendar": { "calendar": {
@ -21,6 +22,7 @@ export const presets: Record<string, CustomFrameSettings> = {
addRibbonIcon: true, addRibbonIcon: true,
openInCenter: true, openInCenter: true,
zoomLevel: 1, zoomLevel: 1,
forceIframe: false,
customCss: `/* hide right-side menu, and some buttons */ customCss: `/* hide right-side menu, and some buttons */
div.d6McF, div.d6McF,
div.pw6cBb, div.pw6cBb,
@ -40,6 +42,7 @@ div.dwlvNd {
addRibbonIcon: false, addRibbonIcon: false,
openInCenter: false, openInCenter: false,
zoomLevel: 1, zoomLevel: 1,
forceIframe: false,
customCss: `/* hide the menu bar and the "Keep" text */ 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: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 { 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, addRibbonIcon: false,
openInCenter: false, openInCenter: false,
zoomLevel: 1, 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 */ 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"] { [aria-label="Go to Home view"], #quick_find, [aria-label="Productivity"], [aria-label="Help & Feedback"] {
display: none !important; display: none !important;
@ -80,6 +84,7 @@ html > body > div:first-child > header:first-child > div > div:first-child > div
addRibbonIcon: true, addRibbonIcon: true,
openInCenter: true, openInCenter: true,
zoomLevel: 1, zoomLevel: 1,
forceIframe: false,
customCss: "" customCss: ""
}, },
"twitter": { "twitter": {
@ -90,6 +95,7 @@ html > body > div:first-child > header:first-child > div > div:first-child > div
addRibbonIcon: false, addRibbonIcon: false,
openInCenter: false, openInCenter: false,
zoomLevel: 1, zoomLevel: 1,
forceIframe: false,
customCss: "" customCss: ""
} }
}; };
@ -107,6 +113,7 @@ export interface CustomFrameSettings {
addRibbonIcon: boolean; addRibbonIcon: boolean;
openInCenter: boolean; openInCenter: boolean;
zoomLevel: number; zoomLevel: number;
forceIframe: boolean;
customCss: string; customCss: string;
} }