文件
mynode/packages/editor/events.ts
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

77 行
1.5 KiB
TypeScript

import type SelectionFormatting from './SelectionFormatting';
import type { SearchState } from './types';
export enum EditorEventType {
Change,
UndoRedoDepthChange,
SelectionRangeChange,
SelectionFormattingChange,
UpdateSearchDialog,
EditLink,
FollowLink,
Scroll,
Remove,
}
export interface ChangeEvent {
kind: EditorEventType.Change;
// New editor content
value: string;
}
export interface UndoRedoDepthChangeEvent {
kind: EditorEventType.UndoRedoDepthChange;
undoDepth: number;
redoDepth: number;
}
export interface SelectionRangeChangeEvent {
kind: EditorEventType.SelectionRangeChange;
anchor: number;
head: number;
from: number;
to: number;
}
export interface SelectionFormattingChangeEvent {
kind: EditorEventType.SelectionFormattingChange;
formatting: SelectionFormatting;
}
export interface EditorScrolledEvent {
kind: EditorEventType.Scroll;
// A fraction from 0 to 1, where 1 corresponds to the end of the document
fraction: number;
}
export interface UpdateSearchDialogEvent {
kind: EditorEventType.UpdateSearchDialog;
searchState: SearchState;
changeSources: string[];
}
export interface RequestEditLinkEvent {
kind: EditorEventType.EditLink;
}
export interface FollowLinkEvent {
kind: EditorEventType.FollowLink;
link: string;
}
export interface RemoveEvent {
kind: EditorEventType.Remove;
}
export type EditorEvent =
ChangeEvent|UndoRedoDepthChangeEvent|SelectionRangeChangeEvent|
EditorScrolledEvent|
SelectionFormattingChangeEvent|UpdateSearchDialogEvent|
RequestEditLinkEvent|FollowLinkEvent|RemoveEvent;