diskfile_editor_state.svelte.ts

Declarations
#

view source

DiskfileEditorState
#

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

readonly

path

type DiskfilePath

readonly

has_changes

readonly

history

type DiskfileHistory | undefined

readonly

selected_history_entry

readonly

content_history

type Array<HistoryEntry>

readonly

saved_history_entries

type Array<HistoryEntry>

readonly

unsaved_history_entries

type Array<HistoryEntry>

readonly

has_history

readonly

has_unsaved_edits

readonly

can_clear_history

readonly

can_clear_unsaved_edits

readonly

unsaved_entry_ids

readonly

content_matching_entry_ids

type Array<Uuid>

readonly

original_length

readonly

current_length

readonly

length_diff

readonly

length_diff_percent

readonly

original_token_count

readonly

current_token_count

readonly

token_diff

readonly

token_diff_percent

readonly

constructor

type new (options: { app: Frontend; diskfile: Diskfile; }): DiskfileEditorState

options
type { app: Frontend; diskfile: Diskfile; }

reset

Clear and reset the editor state to match the current diskfile content.

type (): void

returns void

check_disk_changes

Check if the diskfile content has changed on disk. Call this when receiving file updates from the server.

type (): void

returns void

save_changes

Save changes to the diskfile.

type (): Promise<boolean>

returns Promise<boolean>

set_content_from_history

Set content from history entry.

type (id: string & $brand<"Uuid">): void

id
type string & $brand<"Uuid">
returns void

update_diskfile

Update the diskfile reference. This allows reusing the same editor state instance with a new diskfile.

type (diskfile: Diskfile): void

diskfile
returns void

clear_history

Clear content history, keeping only specific entries based on selection state.

type (): void

returns void

clear_unsaved_edits

Clear all unsaved edit entries from history and reset the editor state if needed.

type (): void

returns void

Depends on
#

Imported by
#