fix image urls, fix context menu

This commit is contained in:
Nystik
2026-03-10 20:49:10 +01:00
parent b48ef720b8
commit d8d12054b7
9 changed files with 157 additions and 39 deletions

View File

@@ -1,18 +1,18 @@
// @electron/remote shim
// Returned when Obsidian calls: window.require('@electron/remote')
import { clipboardShim } from './clipboard.js';
import { shellShim } from './shell.js';
import { dialogShim } from './dialog.js';
import { menuShim, menuItemShim } from './menu.js';
import { appShim } from './app.js';
import { windowShim, webContentsShim } from './window.js';
import { themeShim } from './theme.js';
import { sessionShim } from './session.js';
import { systemPreferencesShim } from './system-preferences.js';
import { screenShim } from './screen.js';
import { nativeImageShim } from './native-image.js';
import { notificationShim } from './notification.js';
import { clipboardShim } from "./clipboard.js";
import { shellShim } from "./shell.js";
import { dialogShim } from "./dialog.js";
import { menuShim, menuItemShim } from "./menu.js";
import { appShim } from "./app.js";
import { windowShim, webContentsShim } from "./window.js";
import { themeShim } from "./theme.js";
import { sessionShim } from "./session.js";
import { systemPreferencesShim } from "./system-preferences.js";
import { screenShim } from "./screen.js";
import { nativeImageShim } from "./native-image.js";
import { notificationShim } from "./notification.js";
export const remoteShim = {
clipboard: clipboardShim,
@@ -33,6 +33,8 @@ export const remoteShim = {
return windowShim._current();
},
webContents: webContentsShim,
getCurrentWebContents() {
return webContentsShim._current();
},

View File

@@ -135,6 +135,7 @@ const currentWindow = {
};
const currentWebContents = {
id: 1,
_zoomLevel: 0,
get zoomLevel() {
@@ -182,7 +183,25 @@ const currentWebContents = {
undo() {},
redo() {},
pasteAndMatchStyle() {},
cut() {
document.execCommand("cut");
},
copy() {
document.execCommand("copy");
},
paste() {
document.execCommand("paste");
},
pasteAndMatchStyle() {
document.execCommand("paste");
},
replaceMisspelling(word) {},
session: {
availableSpellCheckerLanguages: [],
setSpellCheckerLanguages(langs) {},
addWordToSpellCheckerDictionary(word) {},
},
setSpellCheckerLanguages(langs) {},
@@ -212,4 +231,7 @@ export const windowShim = {
export const webContentsShim = {
_current: () => currentWebContents,
fromId(id) {
return id === currentWebContents.id ? currentWebContents : null;
},
};