mirror of
https://github.com/Ellpeck/ObsidianCustomFrames.git
synced 2024-11-14 14:59:08 +01:00
updated to new obsidian API
This commit is contained in:
parent
c37dff03fd
commit
5022385ee1
4 changed files with 17 additions and 74 deletions
65
package-lock.json
generated
65
package-lock.json
generated
|
@ -4,43 +4,6 @@
|
|||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@codemirror/rangeset": {
|
||||
"version": "0.19.9",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.9.tgz",
|
||||
"integrity": "sha512-V8YUuOvK+ew87Xem+71nKcqu1SXd5QROMRLMS/ljT5/3MCxtgrRie1Cvild0G/Z2f1fpWxzX78V0U4jjXBorBQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@codemirror/state": "^0.19.0"
|
||||
}
|
||||
},
|
||||
"@codemirror/state": {
|
||||
"version": "0.19.9",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.9.tgz",
|
||||
"integrity": "sha512-psOzDolKTZkx4CgUqhBQ8T8gBc0xN5z4gzed109aF6x7D7umpDRoimacI/O6d9UGuyl4eYuDCZmDFr2Rq7aGOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@codemirror/text": "^0.19.0"
|
||||
}
|
||||
},
|
||||
"@codemirror/text": {
|
||||
"version": "0.19.6",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/text/-/text-0.19.6.tgz",
|
||||
"integrity": "sha512-T9jnREMIygx+TPC1bOuepz18maGq/92q2a+n4qTqObKwvNMg+8cMTslb8yxeEDEq7S3kpgGWxgO1UWbQRij0dA==",
|
||||
"dev": true
|
||||
},
|
||||
"@codemirror/view": {
|
||||
"version": "0.19.47",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.47.tgz",
|
||||
"integrity": "sha512-SfbagKvJQl5dtt+9wYpo9sa3ZkMgUxTq+/hXDf0KVwIx+zu3cJIqfEm9xSx6yXkq7it7RsPGHaPasApNffF/8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@codemirror/rangeset": "^0.19.5",
|
||||
"@codemirror/state": "^0.19.3",
|
||||
"@codemirror/text": "^0.19.0",
|
||||
"style-mod": "^4.0.0",
|
||||
"w3c-keyname": "^2.2.4"
|
||||
}
|
||||
},
|
||||
"@electron/get": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz",
|
||||
|
@ -688,9 +651,9 @@
|
|||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==",
|
||||
"version": "2.29.3",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
|
||||
"integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==",
|
||||
"dev": true
|
||||
},
|
||||
"ms": {
|
||||
|
@ -724,15 +687,13 @@
|
|||
"optional": true
|
||||
},
|
||||
"obsidian": {
|
||||
"version": "0.13.30",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.13.30.tgz",
|
||||
"integrity": "sha512-uAOrIyeHE9qYzg1Qjfpy/qlyLUFX9oyKWeHYO8NVDoI+pm5VUTMe7XWcsXPwb9iVsVmggVJcdV15Vqm9bljhxQ==",
|
||||
"version": "0.15.1",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.15.1.tgz",
|
||||
"integrity": "sha512-zE6jq3F/iMJTZ5x3lmn7OClS2U+T4VGbAsLrPmyJtc3X2UEEBmXbU4EVrx2+PmjVbgPie/etPWZvP9ZGwfgdAw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@codemirror/state": "^0.19.6",
|
||||
"@codemirror/view": "^0.19.31",
|
||||
"@types/codemirror": "0.0.108",
|
||||
"moment": "2.29.1"
|
||||
"moment": "2.29.3"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
|
@ -882,12 +843,6 @@
|
|||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"style-mod": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.0.0.tgz",
|
||||
"integrity": "sha512-OPhtyEjyyN9x3nhPsu76f52yUGXiZcgvsrFVtvTkyGRQJ0XK+GPc6ov1z+lRpbeabka+MYEQxOYRnt5nF30aMw==",
|
||||
"dev": true
|
||||
},
|
||||
"sumchecker": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz",
|
||||
|
@ -956,12 +911,6 @@
|
|||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"dev": true
|
||||
},
|
||||
"w3c-keyname": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.4.tgz",
|
||||
"integrity": "sha512-tOhfEwEzFLJzf6d1ZPkYfGj+FWhIpBux9ppoP3rlclw3Z0BZv3N7b7030Z1kYth+6rDuAsXUFr+d0VE6Ed1ikw==",
|
||||
"dev": true
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
|
|
12
src/frame.ts
12
src/frame.ts
|
@ -23,8 +23,7 @@ export class CustomFrame {
|
|||
this.frame.setZoomFactor(this.data.zoomLevel);
|
||||
this.frame.insertCSS(this.data.customCss);
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.frame = document.createElement("iframe");
|
||||
this.frame.setAttribute("sandbox", "allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation");
|
||||
this.frame.setAttribute("allow", "encrypted-media; fullscreen; oversized-images; picture-in-picture; sync-xhr; geolocation;");
|
||||
|
@ -63,8 +62,7 @@ export class CustomFrame {
|
|||
public goBack(): void {
|
||||
if (this.frame instanceof HTMLIFrameElement) {
|
||||
this.frame.contentWindow.history.back();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.frame.goBack();
|
||||
}
|
||||
}
|
||||
|
@ -72,8 +70,7 @@ export class CustomFrame {
|
|||
public goForward(): void {
|
||||
if (this.frame instanceof HTMLIFrameElement) {
|
||||
this.frame.contentWindow.history.forward();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.frame.goForward();
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +79,7 @@ export class CustomFrame {
|
|||
if (!(this.frame instanceof HTMLIFrameElement)) {
|
||||
if (!this.frame.isDevToolsOpened()) {
|
||||
this.frame.openDevTools();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.frame.closeDevTools();
|
||||
}
|
||||
}
|
||||
|
|
11
src/main.ts
11
src/main.ts
|
@ -83,13 +83,12 @@ export default class CustomFramesPlugin extends Plugin {
|
|||
private async openLeaf(name: string, center: boolean, split: boolean): Promise<void> {
|
||||
if (center) {
|
||||
this.app.workspace.detachLeavesOfType(name);
|
||||
let leaf = split ? this.app.workspace.splitActiveLeaf() : this.app.workspace.getUnpinnedLeaf();
|
||||
await leaf.setViewState({ type: name });
|
||||
}
|
||||
else {
|
||||
let leaf = this.app.workspace.getLeaf(split);
|
||||
await leaf.setViewState({ type: name, active: true });
|
||||
} else {
|
||||
if (!this.app.workspace.getLeavesOfType(name).length)
|
||||
await this.app.workspace.getRightLeaf(false).setViewState({ type: name });
|
||||
await this.app.workspace.getRightLeaf(false).setViewState({ type: name, active: true });
|
||||
this.app.workspace.revealLeaf(this.app.workspace.getLeavesOfType(name)[0]);
|
||||
}
|
||||
this.app.workspace.revealLeaf(this.app.workspace.getLeavesOfType(name)[0]);
|
||||
}
|
||||
}
|
|
@ -182,8 +182,7 @@ export class CustomFramesSettingTab extends PluginSettingTab {
|
|||
forceIframe: false,
|
||||
customCss: ""
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.plugin.settings.frames.push(presets[option]);
|
||||
}
|
||||
await this.plugin.saveSettings();
|
||||
|
|
Loading…
Reference in a new issue