mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-27 09:44:39 +00:00
* docs(clipboard): Added the plan to guide AI implementation. * feat(clipboard): Changed requirement to reflect the fact that some functions can't be done in browsers. * feat(clipboard): Added Ctrl-v pasting functionality from clipboard. - Storing image in IndexedDB in browser, and storing image in userdata path in Electron. - Added image resizing in markdown. * docs(clipboard): Removed requirement file since it's implemented. * feat(clipboard): Added clipboard images management in settings. * feat(tests): Enhance focus mode and inline markdown tests with mock store and actions * feat(clipboard): Add electron-only annotation to findImageFile function * feat(clipboard): Prevent memory leaks by revoking cached blob URLs on image deletion * feat(clipboard): Improve paste handling by tracking current placeholder and cleaning up old progress * Merge branch 'master' into feat/clipboard-files * feat(marked-options): Refactor renderer methods and add hooks for image sizing syntax * feat(clipboard): Added feature that pasted image will be added to task attachment. * revert: Revert the change of lock file from last merge. * revert: Removed unwanted changes. * refactor(clipboard): Cleaned up code that seems not necessary. * feat(clipboard): Handle storage quota exceeded error and update messages * feat(clipboard): Implement validated IPC handlers for clipboard image operations * feat(clipboard): Add error handling for clipboard image URL resolution * feat(clipboard): Refactor file operations to use async fs promises * feat(clipboard): Integrate ClipboardPasteHandlerService for improved paste handling * feat(clipboard): Rename resolveUrl to resolveIndexedDbUrl for clarity and update references * feat(clipboard): Add defaultPath option to showOpenDialog for improved user experience * feat(clipboard): Implement getDefaultClipboardImagesPath utility for consistent image path retrieval * feat(clipboard): Refactor MIME type handling to use centralized mapping for improved maintainability * feat(clipboard): Add computed property to toggle markdown parsing based on formatting settings * revert: Removed unwanted changes. * revert: Removed unwanted chagnes. * revert: Removed unwanted chagnes. * fix(clipboard-images-cfg): remove debug log from selectImagePath method * refactor(paste-handler): update currentPlaceholder to use getter/setter methods * fix(docs): correct formatting and improve clarity in multiple wiki pages * fix: update dialog handling in initLocalFileSyncAdapter for type safety * revert: Revert space change. * fix(inline-markdown): ensure model is set to an empty string instead of undefined * fix(tests): update clipboard images section locator to use collapsible title
209 lines
5 KiB
TypeScript
209 lines
5 KiB
TypeScript
import { IpcRendererEvent } from 'electron';
|
|
import {
|
|
GlobalConfigState,
|
|
TakeABreakConfig,
|
|
} from '../src/app/features/config/global-config.model';
|
|
import { KeyboardConfig } from '../src/app/features/config/keyboard-config.model';
|
|
import { JiraCfg } from '../src/app/features/issue/providers/jira/jira.model';
|
|
import { AppDataCompleteLegacy, SyncGetRevResult } from '../src/app/imex/sync/sync.model';
|
|
import { Task } from '../src/app/features/tasks/task.model';
|
|
import { LocalBackupMeta } from '../src/app/imex/local-backup/local-backup.model';
|
|
import { AppDataComplete } from '../src/app/op-log/model/model-config';
|
|
import {
|
|
PluginNodeScriptRequest,
|
|
PluginNodeScriptResult,
|
|
PluginManifest,
|
|
} from '../packages/plugin-api/src/types';
|
|
|
|
export interface ElectronAPI {
|
|
on(
|
|
channel: string,
|
|
listener: (event: IpcRendererEvent, ...args: unknown[]) => void,
|
|
): void;
|
|
|
|
// INVOKE
|
|
// ------
|
|
getUserDataPath(): Promise<string>;
|
|
|
|
getBackupPath(): Promise<string>;
|
|
|
|
checkBackupAvailable(): Promise<false | LocalBackupMeta>;
|
|
|
|
loadBackupData(backupPath: string): Promise<string>;
|
|
|
|
fileSyncGetRevAndClientUpdate(args: {
|
|
filePath: string;
|
|
localRev: string | null;
|
|
}): Promise<{ rev: string; clientUpdate?: number } | SyncGetRevResult>;
|
|
|
|
fileSyncSave(args: {
|
|
filePath: string;
|
|
localRev: string | null;
|
|
dataStr: string;
|
|
}): Promise<string | Error>;
|
|
|
|
fileSyncLoad(args: {
|
|
filePath: string;
|
|
localRev: string | null;
|
|
}): Promise<{ rev: string; dataStr: string | undefined } | Error>;
|
|
|
|
fileSyncRemove(args: { filePath: string }): Promise<unknown | Error>;
|
|
|
|
fileSyncListFiles(args: { dirPath: string }): Promise<string[] | Error>; // NEW
|
|
|
|
checkDirExists(args: { dirPath: string }): Promise<true | Error>;
|
|
|
|
pickDirectory(): Promise<string | undefined>;
|
|
|
|
showOpenDialog(options: {
|
|
properties: string[];
|
|
title?: string;
|
|
defaultPath?: string;
|
|
}): Promise<string[] | undefined>;
|
|
|
|
// checkDirExists(dirPath: string): Promise<true | Error>;
|
|
|
|
// STANDARD
|
|
// --------
|
|
setZoomFactor(zoomFactor: number): void;
|
|
|
|
getZoomFactor(): number;
|
|
|
|
openPath(path: string): void;
|
|
|
|
openExternalUrl(url: string): void;
|
|
|
|
saveFileDialog(
|
|
filename: string,
|
|
data: string,
|
|
): Promise<{ success: boolean; path?: string }>;
|
|
|
|
shareNative(payload: {
|
|
text?: string;
|
|
url?: string;
|
|
title?: string;
|
|
files?: string[];
|
|
}): Promise<{ success: boolean; error?: string }>;
|
|
|
|
isLinux(): boolean;
|
|
|
|
isMacOS(): boolean;
|
|
|
|
isSnap(): boolean;
|
|
|
|
isFlatpak(): boolean;
|
|
|
|
// CLIPBOARD IMAGES
|
|
// ----------------
|
|
saveClipboardImage(
|
|
basePath: string,
|
|
fileName: string,
|
|
base64Data: string,
|
|
mimeType: string,
|
|
): Promise<string>;
|
|
|
|
loadClipboardImage(
|
|
basePath: string,
|
|
imageId: string,
|
|
): Promise<{ base64: string; mimeType: string } | null>;
|
|
|
|
deleteClipboardImage(basePath: string, imageId: string): Promise<boolean>;
|
|
|
|
listClipboardImages(
|
|
basePath: string,
|
|
): Promise<{ id: string; mimeType: string; createdAt: number; size: number }[]>;
|
|
|
|
getClipboardImagePath(basePath: string, imageId: string): Promise<string | null>;
|
|
|
|
getClipboardFilePaths(): Promise<string[]>;
|
|
copyClipboardImageFile(
|
|
basePath: string,
|
|
filePath: string,
|
|
): Promise<{
|
|
id: string;
|
|
mimeType: string;
|
|
size: number;
|
|
createdAt: number;
|
|
} | null>;
|
|
|
|
readClipboardImage(basePath: string): Promise<{
|
|
id: string;
|
|
mimeType: string;
|
|
size: number;
|
|
createdAt: number;
|
|
} | null>;
|
|
|
|
getPathForFile(file: File): string | null;
|
|
|
|
// SEND
|
|
// ----
|
|
reloadMainWin(): void;
|
|
|
|
openDevTools(): void;
|
|
|
|
showEmojiPanel(): void;
|
|
|
|
relaunch(): void;
|
|
|
|
exit(exitCode: number): void;
|
|
|
|
shutdownNow(): void;
|
|
|
|
flashFrame(): void;
|
|
|
|
showOrFocus(): void;
|
|
|
|
lockScreen(): void;
|
|
|
|
informAboutAppReady(): void;
|
|
|
|
scheduleRegisterBeforeClose(id: string): void;
|
|
|
|
unscheduleRegisterBeforeClose(id: string): void;
|
|
|
|
setDoneRegisterBeforeClose(id: string): void;
|
|
|
|
setProgressBar(args: {
|
|
progress: number;
|
|
progressBarMode: 'normal' | 'pause' | 'none';
|
|
}): void;
|
|
|
|
sendAppSettingsToElectron(globalCfg: GlobalConfigState): void;
|
|
|
|
sendSettingsUpdate(globalCfg: GlobalConfigState): void;
|
|
|
|
updateTitleBarDarkMode(isDarkMode: boolean): void;
|
|
|
|
registerGlobalShortcuts(keyboardConfig: KeyboardConfig): void;
|
|
|
|
showFullScreenBlocker(args: { msg?: string; takeABreakCfg: TakeABreakConfig }): void;
|
|
|
|
// TODO use invoke instead
|
|
makeJiraRequest(args: {
|
|
requestId: string;
|
|
url: string;
|
|
requestInit: RequestInit;
|
|
jiraCfg: JiraCfg;
|
|
}): void;
|
|
|
|
jiraSetupImgHeaders(args: { jiraCfg: JiraCfg }): void;
|
|
|
|
backupAppData(appData: AppDataCompleteLegacy | AppDataComplete): void;
|
|
|
|
updateCurrentTask(
|
|
task: Task | null,
|
|
isPomodoroEnabled: boolean,
|
|
currentPomodoroSessionTime: number,
|
|
isFocusModeEnabled?: boolean,
|
|
currentFocusSessionTime?: number,
|
|
focusModeMode?: string,
|
|
);
|
|
|
|
exec(command: string): void;
|
|
|
|
pluginExecNodeScript(
|
|
pluginId: string,
|
|
manifest: PluginManifest,
|
|
request: PluginNodeScriptRequest,
|
|
): Promise<PluginNodeScriptResult>;
|
|
}
|