diskfile_editor_state.svelte.ts view source
Manages the editor state for a diskfile.
app
type Frontend
diskfile
type Diskfile
unsaved_edit_entry_id
type Uuid | null
selected_history_entry_id
type Uuid | null
content_was_modified_by_user
type boolean
last_seen_disk_content
type string | null
original_content
type string | null
path
type DiskfilePath
has_changes
history
type DiskfileHistory | undefined
selected_history_entry
content_history
type Array<HistoryEntry>
saved_history_entries
type Array<HistoryEntry>
unsaved_history_entries
type Array<HistoryEntry>
has_history
has_unsaved_edits
can_clear_history
can_clear_unsaved_edits
unsaved_entry_ids
content_matching_entry_ids
type Array<Uuid>
original_length
current_length
length_diff
length_diff_percent
original_token_count
current_token_count
token_diff
token_diff_percent
constructor
type new (options: { app: Frontend; diskfile: Diskfile; }): DiskfileEditorState
options
{ app: Frontend; diskfile: Diskfile; }reset
Clear and reset the editor state to match the current diskfile content.
type (): void
voidcheck_disk_changes
Check if the diskfile content has changed on disk. Call this when receiving file updates from the server.
type (): void
voidsave_changes
Save changes to the diskfile.
type (): Promise<boolean>
Promise<boolean>set_content_from_history
Set content from history entry.
type (id: string & $brand<"Uuid">): void
id
string & $brand<"Uuid">voidupdate_diskfile
Update the diskfile reference. This allows reusing the same editor state instance with a new diskfile.
type (diskfile: Diskfile): void
diskfile
voidclear_history
Clear content history, keeping only specific entries based on selection state.
type (): void
voidclear_unsaved_edits
Clear all unsaved edit entries from history and reset the editor state if needed.
type (): void
void